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


Python SagaUtils.getSagaInstalledVersion方法代码示例

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


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

示例1: processAlgorithm

# 需要导入模块: import SagaUtils [as 别名]
# 或者: from SagaUtils import getSagaInstalledVersion [as 别名]
    def processAlgorithm(self, progress):
        # TODO: check correct num of bands
        input = self.getParameterValue(SplitRGBBands.INPUT)
        temp = getTempFilename(None).replace('.', '')
        basename = os.path.basename(temp)
        validChars = \
            'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
        safeBasename = ''.join(c for c in basename if c in validChars)
        temp = os.path.join(os.path.dirname(temp), safeBasename)

        r = self.getOutputValue(SplitRGBBands.R)
        g = self.getOutputValue(SplitRGBBands.G)
        b = self.getOutputValue(SplitRGBBands.B)
        commands = []
        version = SagaUtils.getSagaInstalledVersion(True)
        trailing = "000" if version != "2.1.4" else ""
        lib = "" if isWindows() else "lib"
        commands.append('%sio_gdal 0 -GRIDS "%s" -FILES "%s"' % (lib, temp, input)
                        + '"')
        commands.append('%sio_gdal 1 -GRIDS "%s_%s1.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, r)
                        )
        commands.append('%sio_gdal 1 -GRIDS "%s_%s2.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, g)
                        )
        commands.append('%sio_gdal 1 -GRIDS "%s_%s3.sgrd" -FORMAT 1 -TYPE 0 -FILE "%s"' %(lib, temp, trailing, b)
                        )


        SagaUtils.createSagaBatchJobFileFromSagaCommands(commands)
        SagaUtils.executeSaga(progress)
开发者ID:Nikhil14,项目名称:QGIS,代码行数:31,代码来源:SplitRGBBands.py

示例2: _loadAlgorithms

# 需要导入模块: import SagaUtils [as 别名]
# 或者: from SagaUtils import getSagaInstalledVersion [as 别名]
    def _loadAlgorithms(self):
        self.algs = []
        version = SagaUtils.getSagaInstalledVersion(True)
        if version is None:
            ProcessingLog.addToLog(
                ProcessingLog.LOG_ERROR,
                self.tr("Problem with SAGA installation: SAGA was not found or is not correctly installed"),
            )
            return
        if version not in self.supportedVersions:
            lastVersion = sorted(self.supportedVersions.keys())[-1]
            if version > lastVersion:
                version = lastVersion
            else:
                ProcessingLog.addToLog(
                    ProcessingLog.LOG_ERROR,
                    self.tr("Problem with SAGA installation: installed SAGA version (%s) is not supported" % version),
                )
                return

        folder = SagaUtils.sagaDescriptionPath()
        folder = os.path.join(folder, self.supportedVersions[version][0])
        for descriptionFile in os.listdir(folder):
            if descriptionFile.endswith("txt"):
                f = os.path.join(folder, descriptionFile)
                self._loadAlgorithm(f, version)
        self.algs.append(SplitRGBBands())
开发者ID:JudeHu,项目名称:QGIS,代码行数:29,代码来源:SagaAlgorithmProvider.py

示例3: _loadAlgorithms

# 需要导入模块: import SagaUtils [as 别名]
# 或者: from SagaUtils import getSagaInstalledVersion [as 别名]
    def _loadAlgorithms(self):
        self.algs = []
        version = SagaUtils.getSagaInstalledVersion(True)
        if version is None:
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                self.tr('Problem with SAGA installation: SAGA was not found or is not correctly installed'))
            return
        if version not in self.supportedVersions:
            ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                self.tr('Problem with SAGA installation: installed SAGA version (%s) is not supported' % version))
            return

        folder = SagaUtils.sagaDescriptionPath()
        folder = os.path.join(folder, self.supportedVersions[SagaUtils.getSagaInstalledVersion()][0])
        for descriptionFile in os.listdir(folder):
            if descriptionFile.endswith('txt'):
                f = os.path.join(folder, descriptionFile)
                self._loadAlgorithm(f)
        self.algs.append(SplitRGBBands())
开发者ID:Ariki,项目名称:QGIS,代码行数:21,代码来源:SagaAlgorithmProvider.py

示例4: _loadAlgorithm

# 需要导入模块: import SagaUtils [as 别名]
# 或者: from SagaUtils import getSagaInstalledVersion [as 别名]
 def _loadAlgorithm(self, descriptionFile):
     try:
         alg = self.supportedVersions[SagaUtils.getSagaInstalledVersion()][1](descriptionFile)
         if alg.name.strip() != '':
             self.algs.append(alg)
         else:
             ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
                 self.tr('Could not open SAGA algorithm: %s' % descriptionFile))
     except Exception, e:
         ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
             self.tr('Could not open SAGA algorithm: %s\n%s' % (descriptionFile, str(e))))
开发者ID:dengchangtao,项目名称:Quantum-GIS,代码行数:13,代码来源:SagaAlgorithmProvider.py

示例5: getDescription

# 需要导入模块: import SagaUtils [as 别名]
# 或者: from SagaUtils import getSagaInstalledVersion [as 别名]
 def getDescription(self):
     version = SagaUtils.getSagaInstalledVersion()
     return 'SAGA (%s)' %  version if version is not None else 'SAGA'
开发者ID:dengchangtao,项目名称:Quantum-GIS,代码行数:5,代码来源:SagaAlgorithmProvider.py


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