Exemple #1
0
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip("\n").strip()
     self.appkey = line
     line = lines.readline().strip("\n").strip()
     self.cliName = line
     line = lines.readline().strip("\n").strip()
     self.name = line
     line = lines.readline().strip("\n").strip()
     self.group = line
     while line != "":
         try:
             line = line.strip("\n").strip()
             if line.startswith("Parameter"):
                 param = ParameterFactory.getFromString(line)
                 # Hack for initializing the elevation parameters from Processing configuration
                 if param.name == "-elev.dem.path" or param.name == "-elev.dem":
                     param.default = OTBUtils.otbSRTMPath()
                 elif param.name == "-elev.dem.geoid" or param.name == "-elev.geoid":
                     param.default = OTBUtils.otbGeoidPath()
                 self.addParameter(param)
             elif line.startswith("*Parameter"):
                 param = ParameterFactory.getFromString(line[1:])
                 param.isAdvanced = True
                 self.addParameter(param)
             elif line.startswith("Extent"):
                 self.addParameter(ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1"))
                 self.hasROI = True
             else:
                 self.addOutput(OutputFactory.getFromString(line))
             line = lines.readline().strip("\n").strip()
         except Exception,e:
             ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, "Could not open OTB algorithm: " + self.descriptionFile + "\n" + line)
             raise e
Exemple #2
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(
         Setting(self.getDescription(), OTBUtils.OTB_FOLDER,
                 "OTB command line tools folder", OTBUtils.otbPath()))
     ProcessingConfig.addSetting(
         Setting(self.getDescription(), OTBUtils.OTB_LIB_FOLDER,
                 "OTB applications folder", OTBUtils.otbLibPath()))
     ProcessingConfig.addSetting(
         Setting(self.getDescription(), OTBUtils.OTB_SRTM_FOLDER,
                 "SRTM tiles folder", OTBUtils.otbSRTMPath()))
     ProcessingConfig.addSetting(
         Setting(self.getDescription(), OTBUtils.OTB_GEOID_FILE,
                 "Geoid file", OTBUtils.otbGeoidPath()))
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                 OTBUtils.OTB_FOLDER,
                                 'OTB command line tools folder',
                                 OTBUtils.otbPath()))
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                 OTBUtils.OTB_LIB_FOLDER,
                                 'OTB applications folder',
                                 OTBUtils.otbLibPath()))
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                 OTBUtils.OTB_SRTM_FOLDER,
                                 'SRTM tiles folder',
                                 OTBUtils.otbSRTMPath()))
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                 OTBUtils.OTB_GEOID_FILE, 'Geoid file',
                                 OTBUtils.otbGeoidPath()))
Exemple #4
0
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip('\n').strip()
     self.appkey = line
     line = lines.readline().strip('\n').strip()
     self.cliName = line
     line = lines.readline().strip('\n').strip()
     self.name = line
     line = lines.readline().strip('\n').strip()
     self.group = line
     while line != '':
         try:
             line = line.strip('\n').strip()
             if line.startswith('Parameter'):
                 param = ParameterFactory.getFromString(line)
                 # Hack for initializing the elevation parameters
                 # from Processing configuration
                 if param.name == '-elev.dem.path' or param.name \
                     == '-elev.dem':
                     param.default = OTBUtils.otbSRTMPath()
                 elif param.name == '-elev.dem.geoid' or param.name \
                     == '-elev.geoid':
                     param.default = OTBUtils.otbGeoidPath()
                 self.addParameter(param)
             elif line.startswith('*Parameter'):
                 param = ParameterFactory.getFromString(line[1:])
                 param.isAdvanced = True
                 self.addParameter(param)
             elif line.startswith('Extent'):
                 self.addParameter(ParameterExtent(self.REGION_OF_INTEREST,
                                   'Region of interest', '0,1,0,1'))
                 self.hasROI = True
             else:
                 self.addOutput(OutputFactory.getFromString(line))
             line = lines.readline().strip('\n').strip()
         except Exception, e:
             ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                                    'Could not open OTB algorithm: '
                                    + self.descriptionFile + '\n' + line)
             raise e
Exemple #5
0
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip("\n").strip()
     self.appkey = line
     line = lines.readline().strip("\n").strip()
     self.cliName = line
     line = lines.readline().strip("\n").strip()
     self.name = line
     line = lines.readline().strip("\n").strip()
     self.group = line
     while line != "":
         try:
             line = line.strip("\n").strip()
             if line.startswith("Parameter"):
                 param = ParameterFactory.getFromString(line)
                 # Hack for initializing the elevation parameters from Processing configuration
                 if param.name == "-elev.dem.path" or param.name == "-elev.dem":
                     param.default = OTBUtils.otbSRTMPath()
                 elif param.name == "-elev.dem.geoid" or param.name == "-elev.geoid":
                     param.default = OTBUtils.otbGeoidPath()
                 self.addParameter(param)
             elif line.startswith("*Parameter"):
                 param = ParameterFactory.getFromString(line[1:])
                 param.isAdvanced = True
                 self.addParameter(param)
             elif line.startswith("Extent"):
                 self.addParameter(
                     ParameterExtent(self.REGION_OF_INTEREST,
                                     "Region of interest", "0,1,0,1"))
                 self.hasROI = True
             else:
                 self.addOutput(OutputFactory.getFromString(line))
             line = lines.readline().strip("\n").strip()
         except Exception, e:
             ProcessingLog.addToLog(
                 ProcessingLog.LOG_ERROR, "Could not open OTB algorithm: " +
                 self.descriptionFile + "\n" + line)
             raise e