本文整理汇总了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)
示例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())
示例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())
示例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))))
示例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'