[GRASS-SVN] r47795 - grass-addons/grass7/raster/r.modis/libmodis
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 21 13:01:42 EDT 2011
Author: lucadelu
Date: 2011-08-21 10:01:42 -0700 (Sun, 21 Aug 2011)
New Revision: 47795
Modified:
grass-addons/grass7/raster/r.modis/libmodis/modis.py
Log:
move some functions to private functions;add some functions in parseModisMulti to write other variables on mosaic xml
Modified: grass-addons/grass7/raster/r.modis/libmodis/modis.py
===================================================================
--- grass-addons/grass7/raster/r.modis/libmodis/modis.py 2011-08-21 13:47:50 UTC (rev 47794)
+++ grass-addons/grass7/raster/r.modis/libmodis/modis.py 2011-08-21 17:01:42 UTC (rev 47795)
@@ -158,42 +158,42 @@
if self.debug==True:
logging.debug("Close connection %s" % self.url)
- def setDirectoryIn(self,day):
+ def _setDirectoryIn(self,day):
""" Enter in the directory of the day """
try:
self.ftp.cwd(day)
except (ftplib.error_reply,socket.error), e:
logging.error("Error %s entering in directory %s" % e, day)
- self.setDirectoryIn(day)
+ self._setDirectoryIn(day)
- def setDirectoryOver(self):
+ def _setDirectoryOver(self):
""" Come back to old path """
try:
self.ftp.cwd('..')
except (ftplib.error_reply,socket.error), e:
logging.error("Error %s when try to come back" % e)
- self.setDirectoryOver()
+ self._setDirectoryOver()
- def str2date(self,strin):
+ def _str2date(self,strin):
"""Return a date object from a string"""
todaySplit = strin.split('-')
return date(int(todaySplit[0]), int(todaySplit[1]),int(todaySplit[2]))
- def getToday(self):
+ def _getToday(self):
"""Return the first day for start to download"""
if self.today == None:
# set today variable to today
self.today = date.today()
else:
# set today variable to data pass from user
- self.today = self.str2date(self.today)
+ self.today = self._str2date(self.today)
# set enday variable to data
if self.enday != None:
- self.enday = self.str2date(self.enday)
+ self.enday = self._str2date(self.enday)
def getListDays(self):
""" Return a list of all selected days """
- self.getToday()
+ self._getToday()
today_s = self.today.strftime("%Y.%m.%d")
# dirData is reverse sorted
@@ -264,7 +264,7 @@
logging.error("Error %s when try to receive list of files" % e)
self.getFilesList()
- def checkDataExist(self,listNewFile, move = 0):
+ def _checkDataExist(self,listNewFile, move = 0):
""" Check if a data already exists in the directory of download
Move serve to know if function is called from download or move function"""
fileInPath = []
@@ -280,7 +280,7 @@
listOfDifferent = list(set(fileInPath) - set(listNewFile))
return listOfDifferent
- def getNewerVersion(self,oldFile,newFile):
+ def _getNewerVersion(self,oldFile,newFile):
""" Return newer version of a file"""
oldFileSplit = oldFile.split('.')
newFileSplit = newFile.split('.')
@@ -320,7 +320,7 @@
file_hdf = open(os.path.join(self.writeFilePath,i), "wb")
elif numFiles == 1:
# check the version of file
- fileDown = self.getNewerVersion(oldFile[0],i)
+ fileDown = self._getNewerVersion(oldFile[0],i)
if fileDown != oldFile[0]:
os.remove(os.path.join(self.writeFilePath,oldFile[0]))
file_hdf = open(os.path.join(self.writeFilePath,fileDown), "wb")
@@ -339,14 +339,14 @@
#for each day
for day in days:
#enter in the directory of day
- self.setDirectoryIn(day)
+ self._setDirectoryIn(day)
#obtain list of all files
listAllFiles = self.getFilesList()
#obtain list of files to download
- listFilesDown = self.checkDataExist(listAllFiles)
+ listFilesDown = self._checkDataExist(listAllFiles)
#download files for a day
self.dayDownload(listFilesDown)
- self.setDirectoryOver()
+ self._setDirectoryOver()
self.closeFTP()
if self.debug==True:
logging.debug("Download terminated")
@@ -393,11 +393,11 @@
logger = debugLog()
days = self.getListDays()
for day in days:
- self.setDirectoryIn(day)
+ self._setDirectoryIn(day)
listAllFiles = self.getFilesList()
string = day + ": " + str(len(listAllFiles)) + "\n"
logger.debug(string)
- self.setDirectoryOver()
+ self._setDirectoryOver()
class parseModis:
"""Class to parse MODIS xml files, it also can create the parameter
@@ -451,48 +451,48 @@
retString = "%s = %s\n" % (node.tag,node.text)
return retString
- def getRoot(self):
+ def _getRoot(self):
"""Set the root element"""
self.rootree = self.tree.getroot()
def retDTD(self):
"""Return the DTDVersion element"""
- self.getRoot()
+ self._getRoot()
return self.rootree.find('DTDVersion').text
def retDataCenter(self):
"""Return the DataCenterId element"""
- self.getRoot()
+ self._getRoot()
return self.rootree.find('DataCenterId').text
- def getGranule(self):
+ def _getGranule(self):
"""Set the GranuleURMetaData element"""
- self.getRoot()
+ self._getRoot()
self.granule = self.rootree.find('GranuleURMetaData')
def retGranuleUR(self):
"""Return the GranuleUR element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('GranuleUR').text
def retDbID(self):
"""Return the DbID element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('DbID').text
def retInsertTime(self):
"""Return the DbID element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('InsertTime').text
def retLastUpdate(self):
"""Return the DbID element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('LastUpdate').text
def retCollectionMetaData(self):
"""Return the CollectionMetaData element"""
- self.getGranule()
+ self._getGranule()
collect = {}
for i in self.granule.find('CollectionMetaData').getiterator():
if i.text.strip() != '':
@@ -501,7 +501,7 @@
def retDataFiles(self):
"""Return the DataFiles element"""
- self.getGranule()
+ self._getGranule()
collect = {}
datafiles = self.granule.find('DataFiles')
for i in datafiles.find('DataFileContainer').getiterator():
@@ -511,7 +511,7 @@
def retDataGranule(self):
"""Return the ECSDataGranule elements"""
- self.getGranule()
+ self._getGranule()
datagran = {}
for i in self.granule.find('ECSDataGranule').getiterator():
if i.text.strip() != '':
@@ -520,14 +520,14 @@
def retPGEVersion(self):
"""Return the PGEVersion element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('PGEVersionClass').find('PGEVersion').text
def retRangeTime(self):
"""Return the RangeDateTime elements inside a dictionary with the element
name like dictionary key
"""
- self.getGranule()
+ self._getGranule()
rangeTime = {}
for i in self.granule.find('RangeDateTime').getiterator():
if i.text != None:
@@ -537,7 +537,7 @@
def retBoundary(self):
"""Return the maximum extend of the MODIS file inside a dictionary"""
- self.getGranule()
+ self._getGranule()
self.boundary = []
lat = []
lon = []
@@ -557,7 +557,7 @@
def retMeasure(self):
"""Return statistics inside a dictionary"""
value = {}
- self.getGranule()
+ self._getGranule()
mes = self.granule.find('MeasuredParameter')
mespc = mes.find('MeasuredParameterContainer')
value['ParameterName'] = mespc.find('ParameterName').text
@@ -578,7 +578,7 @@
def retPlatform(self):
"""Return the platform values inside a dictionary."""
value = {}
- self.getGranule()
+ self._getGranule()
plat = self.granule.find('Platform')
value['PlatformShortName'] = plat.find('PlatformShortName').text
instr = plat.find('Instrument')
@@ -592,7 +592,7 @@
and PSAValue is the value
"""
value = {}
- self.getGranule()
+ self._getGranule()
psas = self.granule.find('PSAs')
for i in psas.findall('PSA'):
value[i.find('PSAName').text] = i.find('PSAValue').text
@@ -601,7 +601,7 @@
def retInputGranule(self):
"""Return the input files used to process the considered file"""
value = []
- self.getGranule()
+ self._getGranule()
for i in self.granule.find('InputGranule').getiterator():
if i.tag != 'InputGranule':
value.append(i.text)
@@ -609,10 +609,13 @@
def retBrowseProduct(self):
"""Return the PGEVersion element"""
- self.getGranule()
+ self._getGranule()
return self.granule.find('BrowseProduct').find('BrowseGranuleId').text
def metastring(self):
+ """Return a string with some metadata. The output it's used on GRASS GIS
+ to set the metadata with r.support command
+ """
date = self.retRangeTime()
qa = self.retMeasure()
pge = self.retPGEVersion()
@@ -661,7 +664,10 @@
if not output:
fileout = self.tifname
else:
- fileout = output
+ if output.find('.tif') == -1:
+ fileout = os.path.join(self.path, output + '.tif')
+ else:
+ fileout = os.path.join(self.path, output)
# the name of the output parameters files for resample MRT software
filename = os.path.join(self.path,'%s_mrt_resample.conf' % self.code)
# if the file already exists it remove it
@@ -808,7 +814,14 @@
self.parModis.append(parseModis(i))
self.nfiles += 1
+ def _retValues(self, funct):
+ values = []
+ for i in self.parModis:
+ values.append(getattr(i,funct)())
+ return values
+
def _checkval(self,vals):
+ """Internal function to return the different values from a list"""
if vals.count(vals[0]) == self.nfiles:
return [vals[0]]
else:
@@ -819,6 +832,7 @@
return outvals
def _checkvaldict(self,vals):
+ """Internal function to return the different values from a dict"""
keys = vals[0].keys()
outvals = {}
for k in keys:
@@ -829,72 +843,79 @@
outvals[k] = valtemp[0]
else:
raise IOError('Something wrong reading XML files')
-
return outvals
def _minval(self, vals):
+ """Internal function to return the minimun value"""
outval = vals[0]
for i in range(1,len(vals)):
- if outval > i:
- outval = i
+ if outval > vals[i]:
+ outval = vals[i]
return outval
def _maxval(self, vals):
+ """Internal function to return the maximum value"""
outval = vals[0]
for i in range(1,len(vals)):
- if outval < i:
- outval = i
+ if outval < vals[i]:
+ outval = vals[i]
return outval
-
+
+ def _meanval(self,vals):
+ """Internal function to return the mean value"""
+ out = 0
+ for v in vals:
+ out += float(v)
+ return out/len(vals)
+
def _cicle_values(self, ele,values):
"""Function to add values from a dictionary"""
for k,v in values.iteritems():
elem = self.ElementTree.SubElement(ele,k)
elem.text = v
- def moreValues(self, fun, obj, ele):
- values = []
- for i in self.parModis:
- values.append(getattr(i,fun)())
+ def _moreValues(self, obj, fun, ele):
+ """Funtion to add elemets to the xml from a list"""
+ values = self._retValues(fun)
for i in self._checkval(values):
dtd = self.ElementTree.SubElement(obj,ele)
dtd.text = i
- def valInsTime(self,obj):
- values = []
- for i in self.parModis:
- values.append(i.retInsertTime())
- obj.text = self._minval(values)
-
- def valCollectionMetaData(self,obj):
- values = []
- for i in self.parModis:
- values.append(i.retCollectionMetaData())
+ def _moreValuesCicle(self, obj, fun):
+ """Funtion to add elemets to the xml from a dict"""
+ values = self._retValues(fun)
self._cicle_values(obj,self._checkvaldict(values))
-
- def valDataFiles(self, obj):
- values = []
- for i in self.parModis:
- values.append(i.retDataFiles())
+
+ def _valInsertTime(self, obj):
+ """Function to add InsertTime value"""
+ values = self._retValues('retInsertTime')
+ time = self.ElementTree.SubElement(obj,'InsertTime')
+ minimum = self._minval(values)
+ time.text = minimum
+
+ def _valLastUpdate(self, obj):
+ """Function to add InsertTime value"""
+ values = self._retValues('retLastUpdate')
+ time = self.ElementTree.SubElement(obj,'LastUpdate')
+ minimum = self._maxval(values)
+ time.text = minimum
+
+ def _valDataFiles(self, obj):
+ """Function to add DataFileContainer values"""
+ values = self._retValues('retDataFiles')
for i in values:
dfc = self.ElementTree.SubElement(obj, 'DataFileContainer')
self._cicle_values(dfc,i)
-
- def valPGEVersion(self,obj):
- values = []
- for i in self.parModis:
- values.append(i.retPGEVersion())
+
+ def _valPGEVersion(self,obj):
+ """Function to add PGEVersion values"""
+ values = self._retValues('retPGEVersion')
for i in self._checkval(values):
pge = self.ElementTree.SubElement(obj,'PGEVersion')
pge.text = i
-
- def valRangeTime(self,obj):
- values = []
- for i in self.parModis:
- values.append(i.retRangeTime())
- self._cicle_values(obj,self._checkvaldict(values))
-
- def valBound(self):
+
+ def _valBound(self):
+ """Return the maximun extent of mosaic"""
boundary = self.parModis[0].retBoundary()
for i in range(1,len(self.parModis)):
bound = self.parModis[i].retBoundary()
@@ -907,47 +928,61 @@
if bound['max_lon'] > boundary['max_lon']:
boundary['max_lon'] = bound['max_lon']
self.boundary = boundary
-
- def valMeasuredParameter(self,obj):
- valuesQAStats = []
- valuesQAFlags = []
+
+ def _addPoint(self,obj,lon,lat):
+ """Function to add a single point of maximum extent"""
+ pt = self.ElementTree.SubElement(obj, 'Point')
+ ptlon = self.ElementTree.SubElement(pt, 'PointLongitude')
+ ptlon.text = str(self.boundary[lon])
+ ptlat = self.ElementTree.SubElement(pt, 'PointLatitude')
+ ptlat.text = str(self.boundary[lat])
+
+ def _valMeasuredParameter(self,obj):
+ """Function to add MeasuredParameter values"""
+ valuesQAStats = {}
+ valuesQAFlags = {}
valuesParameter = []
+ keysQAStats = self.parModis[0].retMeasure()['QAStats'].keys()
+ for i in keysQAStats:
+ valuesQAStats[i] = []
+ keysQAFlags = self.parModis[0].retMeasure()['QAFlags'].keys()
+ for i in keysQAFlags:
+ valuesQAFlags[i] = []
for i in self.parModis:
- valuesQAStats.append(i.retMeasure()['QAStats'])
- valuesQAFlags.append(i.retMeasure()['QAFlags'])
+ for k,v in i.retMeasure()['QAStats'].iteritems():
+ valuesQAStats[k].append(v)
+ for k,v in i.retMeasure()['QAFlags'].iteritems():
+ valuesQAFlags[k].append(v)
valuesParameter.append(i.retMeasure()['ParameterName'])
for i in self._checkval(valuesParameter):
pn = self.ElementTree.SubElement(obj,'ParameterName')
pn.text = i
-
- def valInputPointer(self,obj):
+ qstats = self.ElementTree.SubElement(obj,'QAStats')
+ for k, v in valuesQAStats.iteritems():
+ qstat = self.ElementTree.SubElement(qstats,k)
+ qstat.text = str(self._meanval(v))
+
+ def _valInputPointer(self,obj):
+ """Function to add InputPointer values"""
for i in self.parModis:
for v in i.retInputGranule():
ip = self.ElementTree.SubElement(obj,'InputPointer')
ip.text = v
-
- def addPoint(self,obj,lon,lat):
- pt = self.ElementTree.SubElement(obj, 'Point')
- ptlon = self.ElementTree.SubElement(pt, 'PointLongitude')
- ptlon.text = str(self.boundary[lon])
- ptlat = self.ElementTree.SubElement(pt, 'PointLatitude')
- ptlat.text = str(self.boundary[lat])
-
- def valPlatform(self, obj):
+
+ def _valPlatform(self, obj):
+ """Function to add Platform values"""
valuesSName = []
valuesInstr = []
valuesSensor = []
for i in self.parModis:
- valuesSName.append(i.retPlatform()['PlatformShortName'])
- valuesInstr.append(i.retPlatform()['InstrumentShortName'])
- valuesSensor.append(i.retPlatform()['SensorShortName'])
+ valuesSName.append(i.retPlatform()['PlatformShortName'])
+ valuesInstr.append(i.retPlatform()['InstrumentShortName'])
+ valuesSensor.append(i.retPlatform()['SensorShortName'])
for i in self._checkval(valuesSName):
pn = self.ElementTree.SubElement(obj,'PlatformShortName')
pn.text = i
-
valInstr = self._checkval(valuesInstr)
valSens = self._checkval(valuesSensor)
-
if len(valInstr) != len(valSens):
raise IOError('Something wrong reading XML files')
else:
@@ -959,67 +994,112 @@
ps = self.ElementTree.SubElement(sens,'SensorShortName')
ps.text = valSens[i]
+ def _valPSA(self, obj):
+ """Function to add PSA values"""
+ values = {}
+ # add all keys
+ keys = self.parModis[0].retPSA().keys()
+ for i in keys:
+ values[i] = []
+ # for each key create a list of values
+ for i in self.parModis:
+ for k,v in i.retPSA().iteritems():
+ values[k].append(v)
+ # these values could be different so they must be added all
+ valApp = ['TileID','HORIZONTALTILENUMBER','VERTICALTILENUMBER']
+ for v in valApp:
+ for i in values[v]:
+ psa = self.ElementTree.SubElement(obj,'PSA')
+ psaname = self.ElementTree.SubElement(psa, 'PSAName')
+ psaname.text = v
+ psavalue = self.ElementTree.SubElement(psa, 'PSAValue')
+ psavalue.text = i
+ # add CLOUD_CONTAMINATED_LST_SCREENED, if one of values is NO set NO otherwise YES
+ try:
+ psa = self.ElementTree.SubElement(obj,'PSA')
+ psaname = self.ElementTree.SubElement(psa, 'PSAName')
+ psaname.text = 'CLOUD_CONTAMINATED_LST_SCREENED'
+ psavalue = self.ElementTree.SubElement(psa, 'PSAValue')
+ if values['CLOUD_CONTAMINATED_LST_SCREENED'].count('NO') == 0:
+ psavalue.text = 'NO'
+ else:
+ psavalue.text = 'YES'
+ except:
+ pass
+ # for these values calculate the mean value
+ valMean = ['QAFRACTIONGOODQUALITY', 'QAPERCENTNOTPRODUCEDOTHER', 'N_GRAN_POINTERS',
+ 'QAFRACTIONNOTPRODUCEDCLOUD','QAPERCENTOTHERQUALITY','QAFRACTIONNOTPRODUCEDOTHER',
+ 'QAPERCENTNOTPRODUCEDCLOUD','QAFRACTIONOTHERQUALITY','QAPERCENTGOODQUALITY']
+ for v in valMean:
+ if v in values.keys():
+ psa = self.ElementTree.SubElement(obj,'PSA')
+ psaname = self.ElementTree.SubElement(psa, 'PSAName')
+ psaname.text = v
+ psavalue = self.ElementTree.SubElement(psa, 'PSAValue')
+ psavalue.text = str(self._meanval(values[v]))
+
def writexml(self,outputname):
"""Return a xml file for a mosaic"""
# the root element
granule = self.ElementTree.Element('GranuleMetaDataFile')
# add DTDVersion
- self.moreValues('retDTD',granule,'DTDVersion')
- #self.valDTD(granule)
+ self._moreValues(granule, 'retDTD', 'DTDVersion')
# add DataCenterId
- self.moreValues('retDataCenter',granule,'DataCenterId')
+ self._moreValues(granule, 'retDataCenter', 'DataCenterId')
# add GranuleURMetaData
gurmd = self.ElementTree.SubElement(granule,'GranuleURMetaData')
# add GranuleUR
- self.moreValues('retGranuleUR',granule,'GranuleUR')
+ self._moreValues(granule, 'retGranuleUR', 'GranuleUR')
# add dbID
- self.moreValues('retDbID',granule,'DbID')
+ self._moreValues(granule, 'retDbID', 'DbID')
- # TODO ADD InsertTime LastUpdate
+ self._valInsertTime(granule)
+ self._valLastUpdate(granule)
+ # CHECK InsertTime LastUpdate
# add CollectionMetaData
cmd = self.ElementTree.SubElement(gurmd,'CollectionMetaData')
- self.valCollectionMetaData(cmd)
+ self._moreValuesCicle(cmd,'retCollectionMetaData')
# add DataFiles
df = self.ElementTree.SubElement(gurmd,'DataFiles')
- self.valDataFiles(df)
+ self._valDataFiles(df)
# TODO ADD ECSDataGranule
# add PGEVersionClass
pgevc = self.ElementTree.SubElement(gurmd,'PGEVersionClass')
- self.valPGEVersion(pgevc)
+ self._valPGEVersion(pgevc)
# add RangeDateTime
rdt = self.ElementTree.SubElement(gurmd,'RangeDateTime')
- self.valRangeTime(rdt)
+ self._moreValuesCicle(rdt,'retRangeTime')
# SpatialDomainContainer
sdc = self.ElementTree.SubElement(gurmd,'SpatialDomainContainer')
hsdc = self.ElementTree.SubElement(sdc,'HorizontalSpatialDomainContainer')
gp = self.ElementTree.SubElement(hsdc,'GPolygon')
bound = self.ElementTree.SubElement(gp,'Boundary')
- self.valBound()
- self.addPoint(bound,'min_lon','max_lat')
- self.addPoint(bound,'max_lon','max_lat')
- self.addPoint(bound,'min_lon','min_lat')
- self.addPoint(bound,'max_lon','min_lat')
+ self._valBound()
+ self._addPoint(bound,'min_lon','max_lat')
+ self._addPoint(bound,'max_lon','max_lat')
+ self._addPoint(bound,'min_lon','min_lat')
+ self._addPoint(bound,'max_lon','min_lat')
# add MeasuredParameter
mp = self.ElementTree.SubElement(gurmd,'MeasuredParameter')
mpc = self.ElementTree.SubElement(mp,'MeasuredParameterContainer')
- self.valMeasuredParameter(mpc)
+ self._valMeasuredParameter(mpc)
- # TODO ADD qstats qflags
+ # TODO ADD qflags
# Platform
pl = self.ElementTree.SubElement(gurmd,'Platform')
- self.valPlatform(pl)
-
+ self._valPlatform(pl)
# add PSAs
psas = self.ElementTree.SubElement(gurmd,'PSAs')
- # TODO ADD all PSA
+ self._valPSA(psas)
# add InputGranule and InputPointer
ig = self.ElementTree.SubElement(gurmd,'InputGranule')
- self.valInputPointer(ig)
+ self._valInputPointer(ig)
# TODO ADD BrowseProduct
+ # write output file
output = open(outputname, 'w')
output.write('<?xml version="1.0" encoding="UTF-8"?>')
output.write('<!DOCTYPE GranuleMetaDataFile SYSTEM "http://ecsinfo.gsfc.nasa.gov/ECSInfo/ecsmetadata/dtds/DPL/ECS/ScienceGranuleMetadata.dtd">')
@@ -1062,7 +1142,7 @@
else:
raise IOError('The path %s not exists' % mrtpath)
- def executable(self):
+ def _executable(self):
"""Return the executable of resample MRT software
"""
if sys.platform.count('linux') != -1:
@@ -1075,7 +1155,7 @@
def run(self):
"""Exec the process"""
import subprocess
- execut = self.executable()
+ execut = self._executable()
if not os.path.exists(execut):
raise IOError('The path %s not exists, could be an erroneus path or '\
+ 'software') % execut
@@ -1117,7 +1197,7 @@
self.outxml = os.path.join(self.basepath, self.out + '.xml')
self.subset = subset
- def write_mosaic_xml(self):
+ def _write_mosaic_xml(self):
self.finalfile = open(os.path.join(self.basepath,'mosaic%i' % os.getpid()),'w')
listHDF = []
for i in self.HDFfiles:
@@ -1132,7 +1212,7 @@
pmm = parseModisMulti(listHDF)
pmm.writexml(self.outxml)
- def executable(self):
+ def _executable(self):
"""Return the executable of mrtmosaic MRT software
"""
if sys.platform.count('linux') != -1:
@@ -1145,12 +1225,12 @@
def run(self):
"""Exect the mosaic process"""
import subprocess
- execut = self.executable()
+ execut = self._executable()
if not os.path.exists(execut):
raise IOError('The path %s not exists, could be an erroneus path or '\
+ 'software') % execut
else:
- self.write_mosaic_xml()
+ self._write_mosaic_xml()
if self.subset:
subprocess.call([execut,'-i',self.finalfile.name,'-o',self.out,'-s',self.subset],
stderr = subprocess.STDOUT)
@@ -1199,7 +1279,7 @@
else:
raise IOError('The path %s not exists' % mrtpath)
- def executable(self):
+ def _executable(self):
"""Return the executable of resample MRT software
"""
if sys.platform.count('linux') != -1:
@@ -1212,7 +1292,7 @@
def run(self):
"""Exec the process"""
import subprocess
- execut = self.executable()
+ execut = self._executable()
if not os.path.exists(execut):
raise IOError('The path %s not exists, could be an erroneus path or '\
+ 'software') % execut
More information about the grass-commit
mailing list