当前位置: 首页>>代码示例>>Python>>正文


Python OtbUtils.geoidFile方法代码示例

本文整理汇总了Python中processing.algs.otb.OtbUtils.OtbUtils.geoidFile方法的典型用法代码示例。如果您正苦于以下问题:Python OtbUtils.geoidFile方法的具体用法?Python OtbUtils.geoidFile怎么用?Python OtbUtils.geoidFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在processing.algs.otb.OtbUtils.OtbUtils的用法示例。


在下文中一共展示了OtbUtils.geoidFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load

# 需要导入模块: from processing.algs.otb.OtbUtils import OtbUtils [as 别名]
# 或者: from processing.algs.otb.OtbUtils.OtbUtils import geoidFile [as 别名]
 def load(self):
     group = self.name()
     ProcessingConfig.settingIcons[group] = self.icon()
     ProcessingConfig.addSetting(Setting(group, OtbUtils.ACTIVATE, self.tr('Activate'), True))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.FOLDER,
                                         self.tr("OTB folder"),
                                         OtbUtils.otbFolder(),
                                         valuetype=Setting.FOLDER,
                                         validator=self.validateOtbFolder
                                         ))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.APP_FOLDER,
                                         self.tr("OTB application folder"),
                                         OtbUtils.appFolder(),
                                         valuetype=Setting.MULTIPLE_FOLDERS,
                                         validator=self.validateAppFolders
                                         ))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.SRTM_FOLDER,
                                         self.tr("SRTM tiles folder"),
                                         OtbUtils.srtmFolder(),
                                         valuetype=Setting.FOLDER
                                         ))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.GEOID_FILE,
                                         self.tr("Geoid file"),
                                         OtbUtils.geoidFile(),
                                         valuetype=Setting.FOLDER
                                         ))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.MAX_RAM_HINT,
                                         self.tr("Maximum RAM to use"),
                                         OtbUtils.maxRAMHint(),
                                         valuetype=Setting.STRING
                                         ))
     ProcessingConfig.addSetting(Setting(group, OtbUtils.LOGGER_LEVEL,
                                         self.tr("Logger level"),
                                         OtbUtils.loggerLevel(),
                                         valuetype=Setting.STRING,
                                         validator=self.validateLoggerLevel
                                         ))
     ProcessingConfig.readSettings()
     self.refreshAlgorithms()
     return True
开发者ID:boundlessgeo,项目名称:QGIS,代码行数:42,代码来源:OtbAlgorithmProvider.py

示例2: defineCharacteristicsFromFile

# 需要导入模块: from processing.algs.otb.OtbUtils import OtbUtils [as 别名]
# 或者: from processing.algs.otb.OtbUtils.OtbUtils import geoidFile [as 别名]
    def defineCharacteristicsFromFile(self):
        line = None
        try:
            with open(self._descriptionfile) as lines:
                line = lines.readline().strip('\n').strip()
                self._name = line.split('|')[0]
                self.appkey = self._name
                line = lines.readline().strip('\n').strip()
                self.doc = line
                self.i18n_doc = QCoreApplication.translate("OtbAlgorithm", self.doc)
                #self._name = self._name #+ " - " + self.doc
                self._display_name = self.tr(self._name)
                self.i18n_name = QCoreApplication.translate("OtbAlgorithm", self._name)

                line = lines.readline().strip('\n').strip()
                self._group = line
                self.i18n_group = QCoreApplication.translate("OtbAlgorithm", self._group)
                line = lines.readline().strip('\n').strip()
                while line != '':
                    line = line.strip('\n').strip()
                    if line.startswith('#'):
                        line = lines.readline().strip('\n').strip()
                        continue
                    param = None
                    if 'OTBParameterChoice' in line:
                        tokens = line.split("|")
                        params = [t if str(t) != str(None) else None for t in tokens[1:]]
                        options = params[2].split(';')
                        param = OtbParameterChoice(params[0], params[1], options, params[3], params[4])
                    else:
                        param = getParameterFromString(line, 'OtbAlgorithm')

                    #if parameter is None, then move to next line and continue
                    if param is None:
                        line = lines.readline().strip('\n').strip()
                        continue

                    name = param.name()
                    if '.' in name and len(name.split('.')) > 2:
                        p = name.split('.')[:-2]
                        group_key = '.'.join(p)
                        group_value = name.split('.')[-2]
                        metadata = param.metadata()
                        metadata['group_key'] = group_key
                        metadata['group_value'] = group_value
                        param.setMetadata(metadata)

                    #'elev.dem.path', 'elev.dem', 'elev.dem.geoid', 'elev.geoid' are special!
                    #Even though it is not typical for OTB to fix on parameter keys,
                    #we current use below !hack! to set SRTM path and GEOID files
                    #Future releases of OTB must follow this rule keep
                    #compatibility or update this checklist.
                    if name in ["elev.dem.path", "elev.dem"]:
                        param.setDefaultValue(OtbUtils.srtmFolder())
                    if name in ["elev.dem.geoid", "elev.geoid"]:
                        param.setDefaultValue(OtbUtils.geoidFile())

                    # outputpixeltype is a special parameter associated with raster output
                    # reset list of options to 'self.pixelTypes'.
                    if name == 'outputpixeltype':
                        param.setOptions(self.pixelTypes)
                        param.setDefaultValue(self.pixelTypes.index('float'))

                    self.addParameter(param)
                    #parameter is added now and we must move to next line
                    line = lines.readline().strip('\n').strip()

        except BaseException as e:
            import traceback
            errmsg = "Could not open OTB algorithm from file: \n" + self._descriptionfile + "\nline=" + line + "\nError:\n" + traceback.format_exc()
            QgsMessageLog.logMessage(self.tr(errmsg), self.tr('Processing'), Qgis.Critical)
            raise e
开发者ID:m-kuhn,项目名称:QGIS,代码行数:74,代码来源:OtbAlgorithm.py


注:本文中的processing.algs.otb.OtbUtils.OtbUtils.geoidFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。