[FEATURE] (Processing) Initial Grass 7 support

This commit is contained in:
Markus Neteler 2014-03-30 20:58:11 +02:00 committed by Pirmin Kalberer
parent 3dc2d8c0ea
commit 72457b331f
181 changed files with 3268 additions and 0 deletions

View File

@ -6,6 +6,7 @@ ADD_SUBDIRECTORY(commander)
ADD_SUBDIRECTORY(core)
ADD_SUBDIRECTORY(gdal)
ADD_SUBDIRECTORY(grass)
ADD_SUBDIRECTORY(grass7)
ADD_SUBDIRECTORY(gui)
ADD_SUBDIRECTORY(images)
ADD_SUBDIRECTORY(lidar)

View File

@ -48,6 +48,7 @@ from processing.modeler.ModelerOnlyAlgorithmProvider import \
ModelerOnlyAlgorithmProvider
from processing.algs.QGISAlgorithmProvider import QGISAlgorithmProvider
from processing.grass.GrassAlgorithmProvider import GrassAlgorithmProvider
from processing.grass7.Grass7AlgorithmProvider import Grass7AlgorithmProvider
from processing.lidar.LidarToolsAlgorithmProvider import \
LidarToolsAlgorithmProvider
from processing.gdal.GdalOgrAlgorithmProvider import GdalOgrAlgorithmProvider
@ -146,6 +147,7 @@ class Processing:
Processing.addProvider(RAlgorithmProvider())
Processing.addProvider(SagaAlgorithmProvider())
Processing.addProvider(GrassAlgorithmProvider())
Processing.addProvider(Grass7AlgorithmProvider())
Processing.addProvider(ScriptAlgorithmProvider())
Processing.addProvider(TauDEMAlgorithmProvider())
Processing.addProvider(AdminToolsAlgorithmProvider())

View File

@ -0,0 +1,8 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB OTHER_FILES grass7.txt)
FILE(GLOB DESCR_FILES description/*.txt)
ADD_SUBDIRECTORY(ext)
PLUGIN_INSTALL(processing grass7 ${PY_FILES} ${OTHER_FILES})
PLUGIN_INSTALL(processing grass7/description ${DESCR_FILES})

View File

@ -0,0 +1,544 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
Grass7Algorithm.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Victor Olaya'
__date__ = 'April 2014'
__copyright__ = '(C) 2014, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import os
import time
import uuid
import importlib
from qgis.core import *
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from processing import interface
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
from processing.core.WrongHelpFileException import WrongHelpFileException
from processing.core.GeoAlgorithmExecutionException import \
GeoAlgorithmExecutionException
from processing.parameters.ParameterFactory import ParameterFactory
from processing.parameters.ParameterTable import ParameterTable
from processing.parameters.ParameterMultipleInput import ParameterMultipleInput
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterExtent import ParameterExtent
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterString import ParameterString
from processing.parameters.ParameterSelection import ParameterSelection
from processing.outputs.OutputRaster import OutputRaster
from processing.outputs.OutputHTML import OutputHTML
from processing.outputs.OutputVector import OutputVector
from processing.outputs.OutputFactory import OutputFactory
from processing.outputs.OutputFile import OutputFile
from processing.grass7.Grass7Utils import Grass7Utils
from processing.tools import dataobjects, system
class Grass7Algorithm(GeoAlgorithm):
GRASS_OUTPUT_TYPE_PARAMETER = 'GRASS_OUTPUT_TYPE_PARAMETER'
GRASS_MIN_AREA_PARAMETER = 'GRASS_MIN_AREA_PARAMETER'
GRASS_SNAP_TOLERANCE_PARAMETER = 'GRASS_SNAP_TOLERANCE_PARAMETER'
GRASS_REGION_EXTENT_PARAMETER = 'GRASS_REGION_PARAMETER'
GRASS_REGION_CELLSIZE_PARAMETER = 'GRASS_REGION_CELLSIZE_PARAMETER'
GRASS_REGION_ALIGN_TO_RESOLUTION = '-a_r.region'
OUTPUT_TYPES = ['auto', 'point', 'line', 'area']
def __init__(self, descriptionfile):
GeoAlgorithm.__init__(self)
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
# GRASS GIS 7 console output, needed to do postprocessing in case GRASS
# dumps results to the console
self.consoleOutput = []
def getCopy(self):
newone = Grass7Algorithm(self.descriptionFile)
newone.provider = self.provider
return newone
def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../images/grass.png')
def helpFile(self):
return 'http://grass.osgeo.org/grass70/manuals/' + self.grassName \
+ '.html'
def getParameterDescriptions(self):
descs = {}
try:
helpfile = self.helpFile()
except WrongHelpFileException:
return descs
if helpfile:
try:
infile = open(helpfile)
lines = infile.readlines()
for i in range(len(lines)):
if lines[i].startswith('<DT><b>'):
for param in self.parameters:
searchLine = '<b>' + param.name + '</b>'
if searchLine in lines[i]:
i += 1
descs[param.name] = (lines[i])[4:-6]
break
infile.close()
except Exception:
pass
return descs
def defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
line = lines.readline().strip('\n').strip()
self.grassName = line
line = lines.readline().strip('\n').strip()
self.name = line
line = lines.readline().strip('\n').strip()
self.group = line
hasRasterOutput = False
hasVectorInput = False
vectorOutputs = 0
while line != '':
try:
line = line.strip('\n').strip()
if line.startswith('Parameter'):
parameter = ParameterFactory.getFromString(line)
self.addParameter(parameter)
if isinstance(parameter, ParameterVector):
hasVectorInput = True
if isinstance(parameter, ParameterMultipleInput) \
and parameter.datatype < 3:
hasVectorInput = True
elif line.startswith('*Parameter'):
param = ParameterFactory.getFromString(line[1:])
param.isAdvanced = True
self.addParameter(param)
else:
output = OutputFactory.getFromString(line)
self.addOutput(output)
if isinstance(output, OutputRaster):
hasRasterOutput = True
elif isinstance(output, OutputVector):
vectorOutputs += 1
line = lines.readline().strip('\n').strip()
except Exception, e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
'Could not open GRASS GIS 7 algorithm: '
+ self.descriptionFile + '\n' + line)
raise e
lines.close()
self.addParameter(ParameterExtent(self.GRASS_REGION_EXTENT_PARAMETER,
'GRASS GIS 7 region extent'))
if hasRasterOutput:
self.addParameter(ParameterNumber(
self.GRASS_REGION_CELLSIZE_PARAMETER,
'GRASS GIS 7 region cellsize (leave 0 for default)',
0, None, 0.0))
if hasVectorInput:
param = ParameterNumber(self.GRASS_SNAP_TOLERANCE_PARAMETER,
'v.in.ogr snap tolerance (-1 = no snap)',
-1, None, -1.0)
param.isAdvanced = True
self.addParameter(param)
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER,
'v.in.ogr min area', 0, None, 0.0001)
param.isAdvanced = True
self.addParameter(param)
if vectorOutputs == 1:
param = ParameterSelection(self.GRASS_OUTPUT_TYPE_PARAMETER,
'v.out.ogr output type',
self.OUTPUT_TYPES)
param.isAdvanced = True
self.addParameter(param)
def getDefaultCellsize(self):
cellsize = 0
for param in self.parameters:
if param.value:
if isinstance(param, ParameterRaster):
if isinstance(param.value, QgsRasterLayer):
layer = param.value
else:
layer = dataobjects.getObjectFromUri(param.value)
cellsize = max(cellsize, (layer.extent().xMaximum()
- layer.extent().xMinimum())
/ layer.width())
elif isinstance(param, ParameterMultipleInput):
layers = param.value.split(';')
for layername in layers:
layer = dataobjects.getObjectFromUri(layername)
if isinstance(layer, QgsRasterLayer):
cellsize = max(cellsize,
(layer.extent().xMaximum()
- layer.extent().xMinimum())
/ layer.width())
if cellsize == 0:
cellsize = 1
return cellsize
def processAlgorithm(self, progress):
if system.isWindows():
path = Grass7Utils.grassPath()
if path == '':
raise GeoAlgorithmExecutionException('GRASS GIS 7 folder is not \
configured.\nPlease configure it before running GRASS GIS 7\
algorithms.')
commands = []
self.exportedLayers = {}
outputCommands = []
# If GRASS session has been created outside of this algorithm then
# get the list of layers loaded in GRASS otherwise start a new
# session
existingSession = Grass7Utils.sessionRunning
if existingSession:
self.exportedLayers = Grass7Utils.getSessionLayers()
else:
Grass7Utils.startGrass7Session()
# 1: Export layer to grass mapset
for param in self.parameters:
if isinstance(param, ParameterRaster):
if param.value is None:
continue
value = param.value
# Check if the layer hasn't already been exported in, for
# example, previous GRASS calls in this session
if value in self.exportedLayers.keys():
continue
else:
self.setSessionProjectionFromLayer(value, commands)
commands.append(self.exportRasterLayer(value))
if isinstance(param, ParameterVector):
if param.value is None:
continue
value = param.value
if value in self.exportedLayers.keys():
continue
else:
self.setSessionProjectionFromLayer(value, commands)
commands.append(self.exportVectorLayer(value))
if isinstance(param, ParameterTable):
pass
if isinstance(param, ParameterMultipleInput):
if param.value is None:
continue
layers = param.value.split(';')
if layers is None or len(layers) == 0:
continue
if param.datatype == ParameterMultipleInput.TYPE_RASTER:
for layer in layers:
if layer in self.exportedLayers.keys():
continue
else:
self.setSessionProjectionFromLayer(layer, commands)
commands.append(self.exportRasterLayer(layer))
elif param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
for layer in layers:
if layer in self.exportedLayers.keys():
continue
else:
self.setSessionProjectionFromLayer(layer, commands)
commands.append(self.exportVectorLayer(layer))
self.setSessionProjectionFromProject(commands)
region = \
str(self.getParameterValue(self.GRASS_REGION_EXTENT_PARAMETER))
regionCoords = region.split(',')
command = 'g.region'
command += ' n=' + str(regionCoords[3])
command += ' s=' + str(regionCoords[2])
command += ' e=' + str(regionCoords[1])
command += ' w=' + str(regionCoords[0])
cellsize = self.getParameterValue(self.GRASS_REGION_CELLSIZE_PARAMETER)
if cellsize:
command += ' res=' + str(cellsize)
else:
command += ' res=' + str(self.getDefaultCellsize())
alignToResolution = \
self.getParameterValue(self.GRASS_REGION_ALIGN_TO_RESOLUTION)
if alignToResolution:
command += ' -a'
commands.append(command)
# 2: Set parameters and outputs
command = self.grassName
for param in self.parameters:
if param.value is None or param.value == '':
continue
if param.name == self.GRASS_REGION_CELLSIZE_PARAMETER \
or param.name == self.GRASS_REGION_EXTENT_PARAMETER \
or param.name == self.GRASS_MIN_AREA_PARAMETER or param.name \
== self.GRASS_SNAP_TOLERANCE_PARAMETER or param.name \
== self.GRASS_OUTPUT_TYPE_PARAMETER or param.name \
== self.GRASS_REGION_ALIGN_TO_RESOLUTION:
continue
if isinstance(param, (ParameterRaster, ParameterVector)):
value = param.value
if value in self.exportedLayers.keys():
command += ' ' + param.name + '=' \
+ self.exportedLayers[value]
else:
command += ' ' + param.name + '=' + value
elif isinstance(param, ParameterMultipleInput):
s = param.value
for layer in self.exportedLayers.keys():
s = s.replace(layer, self.exportedLayers[layer])
s = s.replace(';', ',')
command += ' ' + param.name + '=' + s
elif isinstance(param, ParameterBoolean):
if param.value:
command += ' ' + param.name
elif isinstance(param, ParameterSelection):
idx = int(param.value)
command += ' ' + param.name + '=' + str(param.options[idx])
elif isinstance(param, ParameterString):
command += ' ' + param.name + '="' + str(param.value) + '"'
else:
command += ' ' + param.name + '="' + str(param.value) + '"'
uniqueSufix = str(uuid.uuid4()).replace('-', '')
for out in self.outputs:
if isinstance(out, OutputFile):
if out.name == 'outputtext':
# The 'outputtext' file is generated by piping output
# from GRASS, is not an actual grass command
command += ' > ' + out.value
else:
command += ' ' + out.name + '="' + out.value + '"'
elif not isinstance(out, OutputHTML):
# Html files are not generated by GRASS, only by us to
# decorate GRASS output, so we skip them. An output name
# to make sure it is unique if the session uses this
# algorithm several times.
uniqueOutputName = out.name + uniqueSufix
command += ' ' + out.name + '=' + uniqueOutputName
# Add output file to exported layers, to indicate that
# they are present in GRASS
self.exportedLayers[out.value] = uniqueOutputName
command += ' --overwrite'
commands.append(command)
# 3: Export resulting layers to a format that qgis can read
for out in self.outputs:
if isinstance(out, OutputRaster):
filename = out.value
# Raster layer output: adjust region to layer before
# exporting
commands.append('g.region rast=' + out.name + uniqueSufix)
outputCommands.append('g.region rast=' + out.name
+ uniqueSufix)
if self.grassName == 'r.composite':
command = 'r.out.tiff -t --verbose'
command += ' input='
command += out.name + uniqueSufix
command += ' output="' + filename + '"'
commands.append(command)
outputCommands.append(command)
else:
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='
if self.grassName == 'r.horizon':
command += out.name + uniqueSufix + '_0'
else:
command += out.name + uniqueSufix
command += ' output="' + filename + '"'
commands.append(command)
outputCommands.append(command)
if isinstance(out, OutputVector):
filename = out.value
# FIXME: check if needed: -c Also export features without category (not labeled). Otherwise only features with category are exported.
command = 'v.out.ogr -s -e input=' + out.name + uniqueSufix
command += ' dsn="' + os.path.dirname(out.value) + '"'
command += ' format=ESRI_Shapefile'
command += ' olayer=' + os.path.basename(out.value)[:-4]
typeidx = \
self.getParameterValue(self.GRASS_OUTPUT_TYPE_PARAMETER)
outtype = ('auto' if typeidx
is None else self.OUTPUT_TYPES[typeidx])
command += ' type=' + outtype
commands.append(command)
outputCommands.append(command)
# 4: Run GRASS
loglines = []
loglines.append('GRASS GIS 7 execution commands')
for line in commands:
progress.setCommand(line)
loglines.append(line)
if ProcessingConfig.getSetting(Grass7Utils.GRASS_LOG_COMMANDS):
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
self.consoleOutput = Grass7Utils.executeGrass7(commands, progress,
outputCommands)
self.postProcessResults()
# If the session has been created outside of this algorithm, add
# the new GRASS GIS 7 layers to it otherwise finish the session
if existingSession:
Grass7Utils.addSessionLayers(self.exportedLayers)
else:
Grass7Utils.endGrass7Session()
def postProcessResults(self):
name = self.commandLineName().replace('.', '_')[len('grass7:'):]
try:
module = importlib.import_module('processing.grass7.ext.' + name)
except ImportError:
return
if hasattr(module, 'postProcessResults'):
func = getattr(module, 'postProcessResults')
func(self)
def exportVectorLayer(self, orgFilename):
# TODO: improve this. We are now exporting if it is not a shapefile,
# but the functionality of v.in.ogr could be used for this.
# We also export if there is a selection
if not os.path.exists(orgFilename) or not orgFilename.endswith('shp'):
layer = dataobjects.getObjectFromUri(orgFilename, False)
if layer:
filename = dataobjects.exportVectorLayer(layer)
else:
layer = dataobjects.getObjectFromUri(orgFilename, False)
if layer:
useSelection = \
ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED)
if useSelection and layer.selectedFeatureCount() != 0:
filename = dataobjects.exportVectorLayer(layer)
else:
filename = orgFilename
else:
filename = orgFilename
destFilename = self.getTempFilename()
self.exportedLayers[orgFilename] = destFilename
command = 'v.in.ogr'
min_area = self.getParameterValue(self.GRASS_MIN_AREA_PARAMETER)
command += ' min_area=' + str(min_area)
snap = self.getParameterValue(self.GRASS_SNAP_TOLERANCE_PARAMETER)
command += ' snap=' + str(snap)
command += ' dsn="' + os.path.dirname(filename) + '"'
command += ' layer=' + os.path.basename(filename)[:-4]
command += ' output=' + destFilename
command += ' --overwrite -o'
return command
def setSessionProjectionFromProject(self, commands):
if not Grass7Utils.projectionSet:
proj4 = interface.iface.mapCanvas().mapRenderer().destinationCrs().toProj4()
command = 'g.proj'
command += ' -c'
command += ' proj4="' + proj4 + '"'
commands.append(command)
Grass7Utils.projectionSet = True
def setSessionProjectionFromLayer(self, layer, commands):
if not Grass7Utils.projectionSet:
qGisLayer = dataobjects.getObjectFromUri(layer)
if qGisLayer:
proj4 = str(qGisLayer.crs().toProj4())
command = 'g.proj'
command += ' -c'
command += ' proj4="' + proj4 + '"'
commands.append(command)
Grass7Utils.projectionSet = True
def exportRasterLayer(self, layer):
destFilename = self.getTempFilename()
self.exportedLayers[layer] = destFilename
command = 'r.external'
command += ' input="' + layer + '"'
command += ' band=1'
command += ' output=' + destFilename
command += ' --overwrite -o'
return command
def getTempFilename(self):
filename = 'tmp' + str(time.time()).replace('.', '') \
+ str(system.getNumExportedLayers())
return filename
def commandLineName(self):
return 'grass7:' + self.name[:self.name.find(' ')]
def checkBeforeOpeningParametersDialog(self):
msg = Grass7Utils.checkGrass7IsInstalled()
if msg is not None:
html = '<p>This algorithm requires GRASS GIS 7 to be run. \
Unfortunately, it seems that GRASS GIS 7 is not installed in \
your system, or it is not correctly configured to be used \
from QGIS</p>'
html += '<p><a href="http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a> to know more about how to install and configure GRASS GIS 7 to be used with QGIS</p>' # FIXME update URL or page
return html
def checkParameterValuesBeforeExecuting(self):
name = self.commandLineName().replace('.', '_')[len('grass7:'):]
try:
module = importlib.import_module('processing.grass7.ext.' + name)
except ImportError:
return
if hasattr(module, 'checkParameterValuesBeforeExecuting'):
func = getattr(module, 'checkParameterValuesBeforeExecuting')
return func(self)
def getPostProcessingErrorMessage(self, wrongLayers):
html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
msg = Grass7Utils.checkGrass7IsInstalled(True)
html += '<p>This algorithm requires GRASS GIS 7 to be run. A test \
to check if GRASS GIS 7 is correctly installed and configured in \
your system has been performed, with the following \
result:</p><ul><i>'
if msg is None:
html += 'GRASS GIS 7 seems to be correctly installed and \
configured</i></li></ul>'
else:
html += msg + '</i></li></ul>'
html += '<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a> to know more about how to install and configure GRASS GIS 7 to be used with QGIS</p>'
return html

View File

@ -0,0 +1,107 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
Grass7AlgorithmProvider.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
from processing.grass7.nviz7 import nviz7
__author__ = 'Victor Olaya'
__date__ = 'April 2014'
__copyright__ = '(C) 2014, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import os
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingLog import ProcessingLog
from processing.grass7.Grass7Utils import Grass7Utils
from processing.grass7.Grass7Algorithm import Grass7Algorithm
from processing.tools.system import *
class Grass7AlgorithmProvider(AlgorithmProvider):
def __init__(self):
AlgorithmProvider.__init__(self)
self.createAlgsList() # Preloading algorithms to speed up
def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
if isWindows() or isMac():
ProcessingConfig.addSetting(Setting(self.getDescription(),
Grass7Utils.GRASS_FOLDER, 'GRASS7 folder',
Grass7Utils.grassPath()))
ProcessingConfig.addSetting(Setting(self.getDescription(),
Grass7Utils.GRASS_WIN_SHELL, 'Msys folder',
Grass7Utils.grassWinShell()))
ProcessingConfig.addSetting(Setting(self.getDescription(),
Grass7Utils.GRASS_LOG_COMMANDS,
'Log execution commands', False))
ProcessingConfig.addSetting(Setting(self.getDescription(),
Grass7Utils.GRASS_LOG_CONSOLE,
'Log console output', False))
def unload(self):
AlgorithmProvider.unload(self)
if isWindows() or isMac():
ProcessingConfig.removeSetting(Grass7Utils.GRASS_FOLDER)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_WIN_SHELL)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_COMMANDS)
ProcessingConfig.removeSetting(Grass7Utils.GRASS_LOG_CONSOLE)
def createAlgsList(self):
self.preloadedAlgs = []
folder = Grass7Utils.grassDescriptionPath()
for descriptionFile in os.listdir(folder):
if descriptionFile.endswith('txt'):
try:
alg = Grass7Algorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != '':
self.preloadedAlgs.append(alg)
else:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
'Could not open GRASS GIS 7 algorithm: '
+ descriptionFile)
except Exception, e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
'Could not open GRASS GIS 7 algorithm: '
+ descriptionFile)
self.preloadedAlgs.append(nviz7())
def _loadAlgorithms(self):
self.algs = self.preloadedAlgs
def getDescription(self):
return 'GRASS GIS 7 commands'
def getName(self):
return 'grass70'
def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../images/grass.png')
def getSupportedOutputVectorLayerExtensions(self):
return ['shp']
def getSupportedOutputRasterLayerExtensions(self):
return ['tif']

View File

@ -0,0 +1,395 @@
# -*- coding: utf-8 -*-
"""
***************************************************************************
GrassUtils.py
---------------------
Date : April 2014
Copyright : (C) 2014 by Victor Olaya
Email : volayaf at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Victor Olaya'
__date__ = 'April 2014'
__copyright__ = '(C) 2014, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import stat
import shutil
import traceback
import subprocess
from qgis.core import QgsApplication
from PyQt4.QtCore import *
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.ProcessingLog import ProcessingLog
from processing.tools.system import *
from processing.tests.TestData import points
class Grass7Utils:
GRASS_REGION_XMIN = 'GRASS_REGION_XMIN'
GRASS_REGION_YMIN = 'GRASS_REGION_YMIN'
GRASS_REGION_XMAX = 'GRASS_REGION_XMAX'
GRASS_REGION_YMAX = 'GRASS_REGION_YMAX'
GRASS_REGION_CELLSIZE = 'GRASS_REGION_CELLSIZE'
GRASS_FOLDER = 'GRASS7_FOLDER'
GRASS_WIN_SHELL = 'GRASS7_WIN_SHELL'
GRASS_LOG_COMMANDS = 'GRASS_LOG_COMMANDS'
GRASS_LOG_CONSOLE = 'GRASS_LOG_CONSOLE'
sessionRunning = False
sessionLayers = {}
projectionSet = False
isGrass7Installed = False
@staticmethod
def grassBatchJobFilename():
'''This is used in Linux. This is the batch job that we assign to
GRASS_BATCH_JOB and then call GRASS and let it do the work
'''
filename = 'grass7_batch_job.sh'
batchfile = userFolder() + os.sep + filename
return batchfile
@staticmethod
def grassScriptFilename():
'''This is used in windows. We create a script that initializes
GRASS and then uses grass commands
'''
filename = 'grass7_script.bat'
filename = userFolder() + os.sep + filename
return filename
@staticmethod
def getGrassVersion():
# FIXME: I do not know if this should be removed or let the user enter it
# or something like that... This is just a temporary thing
return '7.0.0'
@staticmethod
def grassPath():
if not isWindows() and not isMac():
return ''
folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_FOLDER)
if folder is None:
if isWindows():
testfolder = os.path.dirname(str(QgsApplication.prefixPath()))
testfolder = os.path.join(testfolder, 'grass7')
if os.path.isdir(testfolder):
for subfolder in os.listdir(testfolder):
if subfolder.startswith('grass7'):
folder = os.path.join(testfolder, subfolder)
break
else:
folder = os.path.join(str(QgsApplication.prefixPath()), 'grass7'
)
if not os.path.isdir(folder):
folder = '/Applications/GRASS-7.0.app/Contents/MacOS'
return folder
@staticmethod
def grassWinShell():
folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_WIN_SHELL)
if folder is None:
folder = os.path.dirname(str(QgsApplication.prefixPath()))
folder = os.path.join(folder, 'msys')
return folder
@staticmethod
def grassDescriptionPath():
return os.path.join(os.path.dirname(__file__), 'description')
@staticmethod
def createGrass7Script(commands):
folder = Grass7Utils.grassPath()
shell = Grass7Utils.grassWinShell()
script = Grass7Utils.grassScriptFilename()
gisrc = userFolder() + os.sep + 'processing.gisrc7' #FIXME: use temporary file
# Temporary gisrc file
output = open(gisrc, 'w')
location = 'temp_location'
gisdbase = Grass7Utils.grassDataFolder()
output.write('GISDBASE: ' + gisdbase + '\n')
output.write('LOCATION_NAME: ' + location + '\n')
output.write('MAPSET: PERMANENT \n')
output.write('GRASS_GUI: text\n')
output.close()
output = open(script, 'w')
output.write('set HOME=' + os.path.expanduser('~') + '\n')
output.write('set GISRC=' + gisrc + '\n')
output.write('set GRASS_SH=' + shell + '\\bin\\sh.exe\n')
output.write('set PATH=' + shell + os.sep + 'bin;' + shell + os.sep
+ 'lib;' + '%PATH%\n')
output.write('set WINGISBASE=' + folder + '\n')
output.write('set GISBASE=' + folder + '\n')
output.write('set GRASS_PROJSHARE=' + folder + os.sep + 'share'
+ os.sep + 'proj' + '\n')
output.write('set GRASS_MESSAGE_FORMAT=gui\n')
# Replacement code for etc/Init.bat
output.write('if "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%PATH%\n')
output.write('if not "%GRASS_ADDON_PATH%"=="" set PATH=%WINGISBASE%\\bin;%WINGISBASE%\\lib;%GRASS_ADDON_PATH%;%PATH%\n')
output.write('\n')
output.write('set GRASS_VERSION=' + Grass7Utils.getGrass7Version()
+ '\n')
output.write('if not "%LANG%"=="" goto langset\n')
output.write('FOR /F "usebackq delims==" %%i IN (`"%WINGISBASE%\\etc\\winlocale"`) DO @set LANG=%%i\n')
output.write(':langset\n')
output.write('\n')
output.write('set PATHEXT=%PATHEXT%;.PY\n')
output.write('set PYTHONPATH=%PYTHONPATH%;%WINGISBASE%\\etc\\python;%WINGISBASE%\\etc\\wxpython\\n')
output.write('\n')
output.write('g.gisenv.exe set="MAPSET=PERMANENT"\n')
output.write('g.gisenv.exe set="LOCATION=' + location + '"\n')
output.write('g.gisenv.exe set="LOCATION_NAME=' + location + '"\n')
output.write('g.gisenv.exe set="GISDBASE=' + gisdbase + '"\n')
output.write('g.gisenv.exe set="GRASS_GUI=text"\n')
for command in commands:
output.write(command + '\n')
output.write('\n')
output.write('exit\n')
output.close()
@staticmethod
def createGrass7BatchJobFileFromGrass7Commands(commands):
fout = open(Grass7Utils.grassBatchJobFilename(), 'w')
for command in commands:
fout.write(command + '\n')
fout.write('exit')
fout.close()
@staticmethod
def grassMapsetFolder():
folder = os.path.join(Grass7Utils.grassDataFolder(), 'temp_location')
mkdir(folder)
return folder
@staticmethod
def grassDataFolder():
tempfolder = os.path.join(tempFolder(), 'grassdata')
mkdir(tempfolder)
return tempfolder
@staticmethod
def createTempMapset():
'''Creates a temporary location and mapset(s) for GRASS data
processing. A minimal set of folders and files is created in the
system's default temporary directory. The settings files are
written with sane defaults, so GRASS can do its work. The mapset
projection will be set later, based on the projection of the first
input image or vector
'''
folder = Grass7Utils.grassMapsetFolder()
mkdir(os.path.join(folder, 'PERMANENT'))
mkdir(os.path.join(folder, 'PERMANENT', '.tmp'))
Grass7Utils.writeGrass7Window(os.path.join(folder, 'PERMANENT',
'DEFAULT_WIND'))
outfile = open(os.path.join(folder, 'PERMANENT', 'MYNAME'), 'w')
outfile.write(
'QGIS GRASS GIS 7 interface: temporary data processing location.\n')
outfile.close()
# FIXME: in GRASS 7 the SQLite driver is default (and more powerful)
Grass7Utils.writeGrass7Window(os.path.join(folder, 'PERMANENT', 'WIND'))
mkdir(os.path.join(folder, 'PERMANENT', 'dbf'))
outfile = open(os.path.join(folder, 'PERMANENT', 'VAR'), 'w')
outfile.write('DB_DRIVER: dbf\n')
outfile.write('DB_DATABASE: $GISDBASE/$LOCATION_NAME/$MAPSET/dbf/\n')
outfile.close()
@staticmethod
def writeGrass7Window(filename):
out = open(filename, 'w')
out.write('proj: 0\n')
out.write('zone: 0\n')
out.write('north: 1\n')
out.write('south: 0\n')
out.write('east: 1\n')
out.write('west: 0\n')
out.write('cols: 1\n')
out.write('rows: 1\n')
out.write('e-w resol: 1\n')
out.write('n-s resol: 1\n')
out.write('top: 1\n')
out.write('bottom: 0\n')
out.write('cols3: 1\n')
out.write('rows3: 1\n')
out.write('depths: 1\n')
out.write('e-w resol3: 1\n')
out.write('n-s resol3: 1\n')
out.write('t-b resol: 1\n')
out.close()
@staticmethod
def prepareGrass7Execution(commands):
if isWindows():
Grass7Utils.createGrass7Script(commands)
command = ['cmd.exe', '/C ', Grass7Utils.grassScriptFilename()]
else:
gisrc = userFolder() + os.sep + 'processing.gisrc7'
os.putenv('GISRC', gisrc)
os.putenv('GRASS_MESSAGE_FORMAT', 'gui')
os.putenv('GRASS_BATCH_JOB', Grass7Utils.grassBatchJobFilename())
Grass7Utils.createGrass7BatchJobFileFromGrass7Commands(commands)
os.chmod(Grass7Utils.grassBatchJobFilename(), stat.S_IEXEC
| stat.S_IREAD | stat.S_IWRITE)
if isMac():
command = Grass7Utils.grassPath() + os.sep + 'grass70.sh ' \
+ Grass7Utils.grassMapsetFolder() + '/PERMANENT'
else:
command = 'grass70 ' + Grass7Utils.grassMapsetFolder() \
+ '/PERMANENT'
return command
@staticmethod
def executeGrass7(commands, progress, outputCommands=None):
loglines = []
loglines.append('GRASS GIS 7 execution console output')
grassOutDone = False
command = Grass7Utils.prepareGrass7Execution(commands)
proc = subprocess.Popen(
command,
shell=True,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
for line in iter(proc.readline, ''):
if 'GRASS_INFO_PERCENT' in line:
try:
progress.setPercentage(int(line[len('GRASS_INFO_PERCENT')
+ 2:]))
except:
pass
else:
if 'r.out' in line or 'v.out' in line:
grassOutDone = True
loglines.append(line)
progress.setConsoleInfo(line)
# Some GRASS scripts, like r.mapcalculator or r.fillnulls, call
# other GRASS scripts during execution. This may override any
# commands that are still to be executed by the subprocess, which
# are usually the output ones. If that is the case runs the output
# commands again.
if not grassOutDone and outputCommands:
command = Grass7Utils.prepareGrass7Execution(outputCommands)
proc = subprocess.Popen(
command,
shell=True,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
).stdout
for line in iter(proc.readline, ''):
if 'GRASS_INFO_PERCENT' in line:
try:
progress.setPercentage(int(
line[len('GRASS_INFO_PERCENT') + 2:]))
except:
pass
else:
loglines.append(line)
progress.setConsoleInfo(line)
if ProcessingConfig.getSetting(Grass7Utils.GRASS_LOG_CONSOLE):
ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
return loglines
# GRASS session is used to hold the layers already exported or
# produced in GRASS between multiple calls to GRASS algorithms.
# This way they don't have to be loaded multiple times and
# following algorithms can use the results of the previous ones.
# Starting a session just involves creating the temp mapset
# structure
@staticmethod
def startGrass7Session():
if not Grass7Utils.sessionRunning:
Grass7Utils.createTempMapset()
Grass7Utils.sessionRunning = True
# End session by removing the temporary GRASS mapset and all
# the layers.
@staticmethod
def endGrass7Session():
shutil.rmtree(Grass7Utils.grassMapsetFolder(), True)
Grass7Utils.sessionRunning = False
Grass7Utils.sessionLayers = {}
Grass7Utils.projectionSet = False
@staticmethod
def getSessionLayers():
return Grass7Utils.sessionLayers
@staticmethod
def addSessionLayers(exportedLayers):
Grass7Utils.sessionLayers = dict(Grass7Utils.sessionLayers.items()
+ exportedLayers.items())
@staticmethod
def checkGrass7IsInstalled(ignorePreviousState=False):
if isWindows():
path = Grass7Utils.grassPath()
if path == '':
return 'GRASS GIS 7 folder is not configured.\nPlease configure \
it before running GRASS GIS 7 algorithms.'
cmdpath = os.path.join(path, 'bin', 'r.out.gdal.exe')
if not os.path.exists(cmdpath):
return 'The specified GRASS GIS 7 folder does not contain a valid \
set of GRASS GIS 7 modules.\n' \
+ 'Please, go to the Processing settings dialog, and \
check that the GRASS GIS 7\n' \
+ 'folder is correctly configured'
if not ignorePreviousState:
if Grass7Utils.isGrass7Installed:
return
try:
from processing import runalg
result = runalg(
'grass7:v.voronoi',
points(),
False,
False,
'270778.60198,270855.745301,4458921.97814,4458983.8488',
-1,
0.0001,
0,
None,
)
if not os.path.exists(result['output']):
return 'It seems that GRASS GIS 7 is not correctly installed and \
configured in your system.\nPlease install it before \
running GRASS GIS 7 algorithms.'
except:
s = traceback.format_exc()
return 'Error while checking GRASS GIS 7 installation. GRASS GIS 7 might not \
be correctly configured.\n' + s
Grass7Utils.isGrass7Installed = True

View File

@ -0,0 +1,15 @@
* TODO: Merged modules
r.average: merged into G7:r.statistics, G7:r.statistics2, G7:r.statistics3
r.bilinear merged into G7:r.resamp.interp
r.median: merged into G7:r.statistics, G7:r.statistics2, G7:r.statistics3
r.sum: merged into G7:r.statistics, G7:r.statistics2, G7:r.statistics3
* TODO: decide what to do with nviz:
nviz_cmd -> G7:m.nviz.image
* TODO: CHECK next how really implemented:
Global module changes
interpolation methods 'bilinear', 'bicubic' renamed to 'linear', 'cubic' <<---????

View File

@ -0,0 +1,15 @@
i.atcorr
i.atcorr - Performs atmospheric correction using the 6S algorithm.
Imagery (i.*)
ParameterRaster|input|Name of input raster map|False
ParameterBoolean|-a|Input from ETM+ image taken after July 1, 2000|False
ParameterBoolean|-b|Input from ETM+ image taken before July 1, 2000|False
ParameterRaster|elevation|Input altitude raster map in m (optional)|True
ParameterRaster|visibility|Input visibility raster map in km (optional)|True
ParameterFile|parameters|Name of input text file|False
ParameterRange|range|Input imagery range [0,255]|0,255
ParameterBoolean|-o|Try to increase computation speed when altitude and/or visibility map is used|True
OutputRaster|output|Name for output raster map
ParameterBoolean|-f|Output raster is floating point|False
ParameterRange|rescale|Rescale output raster map [0,255]|0,255

View File

@ -0,0 +1,7 @@
i.fft
i.fft - Fast Fourier Transform (FFT) for image processing.
Imagery (i.*)
ParameterRaster|input_image|Name of input raster map|False
OutputRaster|real_image|Name for output real part arrays stored as raster map
OutputRaster|imaginary_image|Name for output imaginary part arrays stored as raster map

View File

@ -0,0 +1,10 @@
i.his.rgb
i.his.rgb - Transforms raster maps from HIS (Hue-Intensity-Saturation) color space to RGB (Red-Green-Blue) color space.
Imagery (i.*)
ParameterRaster|hue_input|Name of input raster map (hue)|False
ParameterRaster|intensity_input|Name of input raster map (intensity)|False
ParameterRaster|saturation_input|Name of input raster map (saturation)|False
OutputRaster|red_output|Name for output raster map (red)
OutputRaster|green_output|Name for output raster map (green)
OutputRaster|blue_output|Name for output raster map (blue)

View File

@ -0,0 +1,7 @@
i.ifft
i.ifft - Inverse Fast Fourier Transform (IFFT) for image processing.
Imagery (i.*)
ParameterRaster|real_image|Name of input raster map (image fft, real part)|False
ParameterRaster|imaginary_image|Name of input raster map (image fft, imaginary part)|False
OutputRaster|output_image|Name for output raster map

View File

@ -0,0 +1,9 @@
i.rgb.his
i.rgb.his - Transforms raster maps from RGB (Red-Green-Blue) color space to HIS (Hue-Intensity-Saturation) color space.
Imagery (i.*)
ParameterRaster|red_output|Name for input raster map (red)|True
ParameterRaster|green_output|Name for input raster map (green)|True
ParameterRaster|blue_output|Name for input raster map (blue)|True
OutputRaster|hue_input|Name of output raster map (hue)|False
OutputRaster|intensity_input|Name of output raster map (intensity)|False
OutputRaster|saturation_input|Name of output raster map (saturation)|False

View File

@ -0,0 +1,9 @@
i.zc
i.zc - Zero-crossing "edge detection" raster function for image processing.
Imagery (i.*)
ParameterRaster|input|Name of input raster map|False
ParameterNumber|width|x-y extent of the Gaussian filter|1|None|9
ParameterNumber|threshold|Sensitivity of Gaussian filter|0|None|10.0
ParameterNumber|orientations|Number of azimuth directions categorized|0|None|1
OutputRaster|output|Zero crossing raster map

View File

@ -0,0 +1,10 @@
m.cogo
m.cogo - A simple utility for converting bearing and distance measurements to coordinates and vice versa. It assumes a cartesian coordinate system
Miscellaneous (m.*)
ParameterFile|input|Name of input file|False
OutputFile|output|Output text file
ParameterString|coord|Starting coordinate pair (default 0.0, 0.0)|0.0,0.0
*ParameterBoolean|-l|Lines are labelled|False
*ParameterBoolean|-q|Suppress warnings|False
*ParameterBoolean|-r|Convert from coordinates to bearing and distance|False
*ParameterBoolean|-c|Repeat the starting coordinate at the end to close a loop|False

View File

@ -0,0 +1,8 @@
nviz
nviz - Visualization and animation tool for GRASS data.
Visualization(NVIZ)
ParameterMultipleInput|elevation|Name of elevation raster map|3|False
ParameterMultipleInput|color|Name of raster map(s) for Color|3|False
ParameterMultipleInput|vector|Name of vector lines/areas overlay map(s)|-1|False
ParameterMultipleInput|point|Name of vector points overlay file(s)|0|True
ParameterMultipleInput|volume|Name of existing 3d raster map|3|True

View File

@ -0,0 +1,8 @@
r.slope.aspect
r.aspect - Generates raster maps of aspect from a elevation raster map.
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterSelection|prec|Data type|float;double;int
ParameterNumber|zfactor|Multiplicative factor to convert elevation units to meters|None|None|1.0
ParameterNumber|min_slp_allowed|Minimum slope val. (in percent) for which aspect is computed|None|None|0.0
OutputRaster|aspect|Output aspect layer

View File

@ -0,0 +1,7 @@
r.average
r.average - Finds the average of values in a cover raster layer within areas assigned the same category value in a user-specified base layer.
Raster (r.*)
ParameterRaster|base|Base raster layer|False
ParameterRaster|cover|Cover raster layer|False
ParameterBoolean|-c|Cover values extracted from the category labels of the cover map|False
OutputRaster|output|Average values

View File

@ -0,0 +1,7 @@
r.basins.fill
r.basins.fill - Generates watershed subbasins raster map.
Raster (r.*)
ParameterRaster|cnetwork|Input coded stream network raster layer|False
ParameterRaster|tnetwork|Input thinned ridge network raster layer|False
ParameterNumber|number|Number of passes through the dataset|None|None|1
OutputRaster|output|Watersheds

View File

@ -0,0 +1,7 @@
r.bilinear
r.bilinear - Bilinear interpolation utility for raster map layers.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterNumber|north|Specific input value to be assigned to the north and/or south poles for longitude-latitude grids|None|None|0
ParameterNumber|east|Specific input value to be assigned to the north and/or south poles for longitude-latitude grids|None|None|0
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.bitpattern
r.bitpattern - Compares bit patterns with a raster map.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterString|pattern|Bit pattern position(s)|
ParameterString|patval|Bit pattern value|
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,8 @@
r.buffer
r.buffer - Creates a raster map layer showing buffer zones surrounding cells that contain non-NULL category values.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterString|distances|Distance zone(s) (e.g. 100,200,300)|
ParameterSelection|units|Units of distance|meters;kilometers;feet;miles;nautmiles
ParameterBoolean|-z|Ignore zero (0) data cells instead of NULL cells|False
OutputRaster|output|Buffer

View File

@ -0,0 +1,10 @@
r.carve
r.carve - Takes vector stream data, transforms it to raster and subtracts depth from the output DEM.
Raster (r.*)
ParameterRaster|rast|Elevation|False
ParameterVector|vect|Vector layer containing stream(s)|1|False
ParameterNumber|width|Stream width (in meters). Default is raster cell width|None|None|1
ParameterNumber|depth|Additional stream depth (in meters)|None|None|1
ParameterBoolean|-n|No flat areas allowed in flow direction|False
OutputRaster|output|Modified elevation
OutputVector|points|Adjusted stream points

View File

@ -0,0 +1,9 @@
r.circle
r.circle - Creates a raster map containing concentric rings around a given point.
Raster (r.*)
ParameterString|coordinate|The coordinate of the center (east,north)|0,0
ParameterNumber|min|Minimum radius for ring/circle map (in meters)|None|None|10
ParameterNumber|max|Maximum radius for ring/circle map (in meters)|None|None|20
ParameterString|mult|Data value multiplier|1
ParameterBoolean|-b|Generate binary raster map|False
OutputRaster|output|Name for output raster map

View File

@ -0,0 +1,6 @@
r.clump
r.clump - Recategorizes data in a raster map by grouping cells that form physically discrete areas into unique categories.
Raster (r.*)
ParameterRaster|input|Input layer|False
ParameterString|title|Title for output raster map|
OutputRaster|output|Recategorized layer

View File

@ -0,0 +1,8 @@
r.coin
r.coin - Tabulates the mutual occurrence (coincidence) of categories for two raster map layers.
Raster (r.*)
ParameterRaster|map1|Name of first raster map|False
ParameterRaster|map2|Name of second raster map|False
ParameterSelection|units|Unit of measure|c;p;x;y;a;h;k;m
ParameterBoolean|-w|Wide report, 132 columns (default: 80)|False
OutputHTML|html|Output report

View File

@ -0,0 +1,12 @@
r.composite
r.composite - Combines red, green and blue raster maps into a single composite raster map.
Raster (r.*)
ParameterRaster|red|Red|False
ParameterRaster|green|Green|False
ParameterRaster|blue|Blue|False
ParameterNumber|lev_red|Number of levels to be used for <red>|1|256|32
ParameterNumber|lev_green|Number of levels to be used for <green>|1|256|32
ParameterNumber|lev_blue|Number of levels to be used for <blue>|1|256|32
ParameterBoolean|-d|Dither|False
ParameterBoolean|-c|Use closest color|False
OutputRaster|output|Output RGB image

View File

@ -0,0 +1,7 @@
r.contour
r.contour.level - Create vector contour from raster at specified levels
Raster (r.*)
ParameterRaster|input|Input raster|False
ParameterString|levels|List of contour levels|
ParameterString|cut|Minimum number of points for a contour line (0 -> no limit)|0
OutputVector|output|Contours

View File

@ -0,0 +1,9 @@
r.contour
r.contour.step - Create vector contours from raster at specified steps
Raster (r.*)
ParameterRaster|input|Input raster|False
ParameterString|minlevel|Minimum contour level|0
ParameterString|maxlevel|Maximum contour level|10000
ParameterString|step|Increment between contour levels|100
ParameterString|cut|Minimum number of points for a contour line (0 -> no limit)|0
OutputVector|output|contours

View File

@ -0,0 +1,9 @@
r.cost
r.cost - Creates a raster layer of cumulative cost of moving across a raster layer whose cell values represent cost.
Raster (r.*)
ParameterRaster|input|Unit cost layer|False
ParameterVector|start_points|Start points|0|False
ParameterVector|stop_points|Stop points|0|False
ParameterBoolean|-k|Use the 'Knight's move'; slower, but more accurate|False
ParameterBoolean|-n|Keep null values in output raster layer|False
OutputRaster|output|Cumulative cost

View File

@ -0,0 +1,6 @@
r.covar
r.covar - Outputs a covariance/correlation matrix for user-specified raster layer(s).
Raster (r.*)
ParameterMultipleInput|map|Input layers|3.0|False
ParameterBoolean|-r|Print correlation matrix|True
OutputHTML|html|Covariance report

View File

@ -0,0 +1,6 @@
r.cross
r.cross - Creates a cross product of the category values from multiple raster map layers.
Raster (r.*)
ParameterMultipleInput|input|Input raster layers|3.0|False
ParameterBoolean|-z|Non-zero data only|False
OutputRaster|output|Output layer

View File

@ -0,0 +1,11 @@
r.describe
r.describe - Prints terse list of category values found in a raster layer.
Raster (r.*)
ParameterRaster|map|input raster layer|False
ParameterNumber|nv|No-data cell value|None|None|0
ParameterNumber|nsteps|Number of quantization steps|1.0|None|255
ParameterBoolean|-r|Only print the range of the data|False
ParameterBoolean|-n|Suppress reporting of any NULLs|False
ParameterBoolean|-d|Use the current region|False
ParameterBoolean|-i|Read fp map as integer|False
OutputHTML|html|Output report

View File

@ -0,0 +1,10 @@
r.drain
r.drain - Traces a flow through an elevation model on a raster map.
Raster (r.*)
ParameterRaster|input|Elevation|False
ParameterString|start_coordinates|Map coordinates of starting point(s) (E,N)|(0,0)
ParameterMultipleInput|start_points|Vector layer(s) containing starting point(s)|0|False
ParameterBoolean|-c|Copy input cell values on output|False
ParameterBoolean|-a|Accumulate input values along the path|False
ParameterBoolean|-n|Count cell numbers along the path|False
OutputRaster|output|Result

View File

@ -0,0 +1,8 @@
r.fill.dir
r.fill.dir - Filters and generates a depressionless elevation layer and a flow direction layer from a given elevation raster layer.
Raster (r.*)
ParameterRaster|input|Elevation|False
ParameterSelection|type|Output aspect direction format|grass;agnps;answers
OutputRaster|elevation|Depressionless DEM
OutputRaster|direction|Flow direction
OutputRaster|areas|Problem areas

View File

@ -0,0 +1,7 @@
r.fillnulls
r.fillnulls - Fills no-data areas in a raster layer using v.surf.rst splines interpolation or v.surf.bspline interpolation
Raster (r.*)
ParameterRaster|input|Input raster layer to fill|False
ParameterNumber|tension|Spline tension parameter|None|None|40.0
ParameterNumber|smooth|Spline smoothing parameter|None|None|0.1
OutputRaster|output|Filled layer

View File

@ -0,0 +1,14 @@
r.flow
r.flow - Construction of slope curves (flowlines), flowpath lengths, and flowline densities (upslope areas) from a raster digital elevation model (DEM).
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterRaster|aspect|Aspect|False
ParameterRaster|barrier|Barriers|False
ParameterNumber|skip|Number of cells between flowlines|None|None|1.0
ParameterNumber|bound|Maximum number of segments per flowline|None|None|5.0
ParameterBoolean|-u|Compute upslope flowlines instead of default downhill flowlines|False
ParameterBoolean|-3|3-D lengths instead of 2-D|False
*ParameterBoolean|-m|Use less memory, at a performance penalty|False
OutputRaster|flowline|Output flowline vector layer
OutputRaster|flowpath|Output flowpath length raster layer
OutputRaster|density|Output flowline density raster layer

View File

@ -0,0 +1,7 @@
r.grow.distance
r.grow.distance - Generates a raster layer of distance to features in input layer.
Raster (r.*)
ParameterRaster|input|Input input raster layer|False
ParameterSelection|metric|Metric|euclidean;squared;maximum;manhattan
OutputRaster|distance|Distance layer
OutputRaster|value|Output value

View File

@ -0,0 +1,9 @@
r.grow
r.grow - Generates a raster layer with contiguous areas grown by one cell.
Raster (r.*)
ParameterRaster|input|input raster layer|False
ParameterNumber|radius|Radius of buffer in raster cells|None|None|1.01
ParameterSelection|metric|Metric|euclidean;maximum;manhattan
ParameterNumber|old|Value to write for input cells which are non-NULL (-1 => NULL)|None|None|0
ParameterNumber|new|Value to write for "grown" cells|None|None|1
OutputRaster|output|Output layer

View File

@ -0,0 +1,25 @@
r.gwflow
r.gwflow - Numerical calculation program for transient, confined and unconfined groundwater flow in two dimensions.
Raster (r.*)
ParameterString|phead|The initial piezometric head in [m]|
ParameterString|status|Boundary condition status, 0-inactive, 1-active, 2-dirichlet|
ParameterString|hc_x|X-part of the hydraulic conductivity tensor in [m/s]|
ParameterString|hc_y|Y-part of the hydraulic conductivity tensor in [m/s]|
ParameterString|q|Water sources and sinks in [m^3/s]|
ParameterString|s|Specific yield in [1/m]|
ParameterString|r|Recharge map e.g: 6*10^-9 per cell in [m^3/s*m^2]|
ParameterString|top|Top surface of the aquifer in [m]|
ParameterString|bottom|Bottom surface of the aquifer in [m]|
ParameterSelection|type|The type of groundwater flow|confined;unconfined
ParameterString|river_bed|The height of the river bed in [m]|
ParameterString|river_head|Water level (head) of the river with leakage connection in [m]|
ParameterString|river_leak|The leakage coefficient of the river bed in [1/s]|
ParameterString|drain_bed|The height of the drainage bed in [m]|
ParameterString|drain_leak|The leakage coefficient of the drainage bed in [1/s]|
ParameterNumber|dt|The calculation time in seconds|None|None|86400.0
ParameterNumber|maxit|Maximum number of iteration used to solver the linear equation system|None|None|100000.0
ParameterNumber|error|Error break criteria for iterative solvers (jacobi, sor, cg or bicgstab)|None|None|1e-10
ParameterSelection|solver|The type of solver which should solve the symmetric linear equation system|gauss;lu;cholesky;jacobi;sor;cg;bicgstab;pcg
ParameterString|relax|The relaxation parameter used by the jacobi and sor solver for speedup or stabilizing|1
ParameterBoolean|-s|Use a sparse matrix, only available with iterative solvers|False
OutputRaster|output|The map storing the numerical result [m]

View File

@ -0,0 +1,10 @@
r.his
r.his - Generates red, green and blue raster layers combining hue, intensity and saturation (HIS) values from user-specified input raster layers.
Raster (r.*)
ParameterRaster|h_map|Hue|False
ParameterRaster|i_map|Intensity|False
ParameterRaster|s_map|Saturation|False
ParameterBoolean|-n|Respect NULL values while drawing|False
OutputRaster|r_map|Red
OutputRaster|g_map|Green
OutputRaster|b_map|Blue

View File

@ -0,0 +1,9 @@
r.horizon
r.horizon.height - Horizon angle computation from a digital elevation model.
Raster (r.*)
ParameterRaster|elev_in|Elevation layer [meters]|False
ParameterString|coordinate|Coordinate for which you want to calculate the horizon|0,0
ParameterNumber|horizon_step|Angle step size for multidirectional horizon [degrees]|0|360|0.0
ParameterNumber|maxdistance|The maximum distance to consider when finding the horizon height|0|None|10000
ParameterString|dist|Sampling distance step coefficient (0.5-1.5)|1.0
ParameterBoolean|-d|Write output in degrees (default is radians)|False

View File

@ -0,0 +1,9 @@
r.horizon
r.horizon - Horizon angle computation from a digital elevation model.
Raster (r.*)
ParameterRaster|elev_in|Elevation layer [meters]|False
ParameterNumber|direction|Direction in which you want to calculate the horizon height|0|360|0.0
ParameterNumber|maxdistance|The maximum distance to consider when finding the horizon height|0|None|10000
ParameterString|dist|Sampling distance step coefficient (0.5-1.5)|1.0
ParameterBoolean|-d|Write output in degrees (default is radians)|False
OutputRaster|horizon|Prefix of the horizon raster output maps

View File

@ -0,0 +1,14 @@
r.info
r.info - Output basic information about a raster layer.
Raster (r.*)
ParameterRaster|map|Raster layer|False
ParameterBoolean|-r|Print range only|False
ParameterBoolean|-s|Print raster map resolution (NS-res, EW-res) only|False
ParameterBoolean|-t|Print raster map type only|False
ParameterBoolean|-g|Print map region only|False
ParameterBoolean|-h|Print raster history instead of info|False
ParameterBoolean|-u|Print raster map data units only|False
ParameterBoolean|-d|Print raster map vertical datum only|False
ParameterBoolean|-m|Print map title only|False
ParameterBoolean|-p|Print raster map timestamp (day.month.year hour:minute:seconds) only|False
OutputHTML|html|Layer info

View File

@ -0,0 +1,9 @@
r.kappa
r.kappa - Calculate error matrix and kappa parameter for accuracy assessment of classification result.
Raster (r.*)
ParameterRaster|classification|Raster layer containing classification result|False
ParameterRaster|reference|Raster layer containing reference classes|False
ParameterString|title|Title for error matrix and kappa|ACCURACY ASSESSMENT
ParameterBoolean|-h|No header in the report|False
ParameterBoolean|-w|Wide report (132 columns)|False
OutputFile|output|Output file containing error matrix and kappa

View File

@ -0,0 +1,8 @@
r.lake
r.lake.coords - Fills lake at given point to given level.
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterNumber|water_level|Water level|None|None|1000.0
ParameterString|coordinates|Seed point coordinates|0,0
ParameterBoolean|-n|Use negative depth values for lake raster layer|False
OutputRaster|lake|Output raster map with lake

View File

@ -0,0 +1,8 @@
r.lake
r.lake.layer - Fills lake at given point to given level.
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterNumber|water_level|Water level|None|None|1000.0
ParameterRaster|seed|Raster layer with starting point(s) (at least 1 cell > 0)|False
ParameterBoolean|-n|Use negative depth values for lake raster layer|False
OutputRaster|lake|Output raster map with lake

View File

@ -0,0 +1,11 @@
r.mapcalculator
r.mapcalculator - Calculate new raster map from a r.mapcalc expression.
Raster (r.*)
ParameterRaster|amap|Raster layer A|False
ParameterRaster|bmap|Raster layer B|True
ParameterRaster|cmap|Raster layer C|True
ParameterRaster|dmap|Raster layer D|True
ParameterRaster|emap|Raster layer E|True
ParameterRaster|fmap|Raster layer F|True
ParameterString|formula|Formula| A*C+B
OutputRaster|outfile|Output raster layer

View File

@ -0,0 +1,6 @@
r.median
r.median - Finds the median of values in a cover layer within areas assigned the same category value in a user-specified base layer.
Raster (r.*)
ParameterRaster|base|Base raster layer|False
ParameterRaster|cover|Cover layer|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,8 @@
r.mfilter.fp
r.mfilter.fp - Raster map matrix filter.
Raster (r.*)
ParameterRaster|input|input layer|False
ParameterFile|filter|Filter file|False
ParameterNumber|repeat|Number of times to repeat the filter|1|None|1
ParameterBoolean|-z|Apply filter only to zero data values|False
OutputRaster|output|Output layer

View File

@ -0,0 +1,8 @@
r.mfilter
r.mfilter - Performs raster map matrix filter.
Raster (r.*)
ParameterRaster|input|Input layer|False
ParameterFile|filter|Filter file|False
ParameterNumber|repeat|Number of times to repeat the filter|1|None|1
ParameterBoolean|-z|Apply filter only to zero data values|False
OutputRaster|output|Output layer

View File

@ -0,0 +1,6 @@
r.mode
r.mode - Finds the mode of values in a cover layer within areas assigned the same category value in a user-specified base layer.
Raster (r.*)
ParameterRaster|base|Base layer to be reclassified|False
ParameterRaster|cover|Categories layer|False
OutputRaster|output|Output layer

View File

@ -0,0 +1,10 @@
r.neighbors
r.neighbors - Makes each cell category value a function of the category values assigned to the cells around it
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterSelection|method|Neighborhood operation|average;median;mode;minimum;maximum;stddev;sum;variance;diversity;interspersion
ParameterNumber|size|Neighborhood size|1|None|3
ParameterBoolean|-c|Use circular neighborhood|False
*ParameterBoolean|-a|Do not align output with the input|False
*ParameterFile|weight|File containing weights|False
OutputRaster|output|Output layer

View File

@ -0,0 +1,5 @@
r.out.gridatb
r.out.gridatb - Exports GRASS raster map to GRIDATB.FOR map file (TOPMODEL)
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
OutputFile|output|GRIDATB i/o map file

View File

@ -0,0 +1,6 @@
r.out.ppm
r.out.ppm - Converts a raster layer to a PPM image file at the pixel resolution of the currently defined region.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterBoolean|-g|Output greyscale instead of color|True
OutputFile|output|Output PPM file

View File

@ -0,0 +1,7 @@
r.out.vrml
r.out.vrml - Export a raster layer to the Virtual Reality Modeling Language (VRML)
Raster (r.*)
ParameterRaster|elev|Elevation layer|False
ParameterRaster|color|Color layer|False
ParameterNumber|exag|Vertical exaggeration|None|None|1.0
OutputFile|output|Output VRML file

View File

@ -0,0 +1,12 @@
r.param.scale
r.param.scale - Extracts terrain parameters from a DEM.
Raster (r.*)
ParameterRaster|input|Name of input raster map|False
ParameterNumber|s_tol|Slope tolerance that defines a 'flat' surface (degrees)|None|None|1.0
ParameterNumber|c_tol|Curvature tolerance that defines 'planar' surface|None|None|0.0001
ParameterNumber|size|Size of processing window (odd number only, max: 69)|None|None|15
ParameterSelection|param|Morphometric parameter in 'size' window to calculate|elev;slope;aspect;profc;planc;longc;crosc;minic;maxic;feature
ParameterNumber|exp|Exponent for distance weighting (0.0-4.0)|None|None|0.0
ParameterNumber|zscale|Vertical scaling factor|None|None|1.0
ParameterBoolean|-c|Constrain model through central window cell|False
OutputRaster|output|Output raster layer containing morphometric parameter

View File

@ -0,0 +1,6 @@
r.patch
r.patch - Creates a composite raster layer by using one (or more) layer(s) to fill in areas of "no data" in another map layer.
Raster (r.*)
ParameterMultipleInput|input|Raster layers to be patched together|3|False
ParameterBoolean|-z|Use zero (0) for transparency instead of NULL|False
OutputRaster|output|Result

View File

@ -0,0 +1,10 @@
r.plane
r.plane - Creates raster plane layer given dip (inclination), aspect (azimuth) and one point.
Raster (r.*)
ParameterNumber|dip|Dip of plane. Value must be between -90 and 90 degrees|None|None|0.0
ParameterNumber|azimuth|Azimuth of the plane. Value must be between 0 and 360 degrees|None|None|0.0
ParameterNumber|easting|Easting coordinate of a point on the plane|None|None|0.0
ParameterNumber|northing|Northing coordinate of a point on the plane|None|None|0.0
ParameterNumber|elevation|Elevation coordinate of a point on the plane|None|None|0.0
ParameterSelection|type|Data type of resulting layer|int;float;double
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,10 @@
r.profile
r.profile - Outputs the raster layer values lying on user-defined line(s).
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterString|profile|Profile coordinate pairs|0,0,1,1
ParameterNumber|res|Resolution along profile|0|None|1.0
ParameterString|null|Character to represent no data cell|*
ParameterBoolean|-g|Output easting and northing in first two columns of four column output|False
ParameterBoolean|-c|Output RRR:GGG:BBB color values for each profile point|False
OutputFile|output|Output filename

View File

@ -0,0 +1,9 @@
r.quant
r.quant - Produces the quantization file for a floating-point map.
Raster (r.*)
ParameterMultipleInput|input|Raster layer(s) to be quantized|1.0|False
ParameterRaster|basemap|Base layer to take quant rules from|False
ParameterRange|fprange|Floating point range: dmin,dmax|0,1
ParameterRange|range|Integer range: min,max|1,255
ParameterBoolean|-t|Truncate floating point data|False
ParameterBoolean|-r|Round floating point data|False

View File

@ -0,0 +1,8 @@
r.quantile
r.quantile - Compute quantiles using two passes.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterNumber|quantiles|Number of quantiles|2|None|4
*ParameterBoolean|-r|Generate recode rules based on quantile-defined intervals|False
OutputHTML|html|Output report
OutputFile|outputtext|Output text file

View File

@ -0,0 +1,6 @@
r.random.cells
r.random.cells - Generates random cell values with spatial dependence.
Raster (r.*)
ParameterNumber|distance|Maximum distance of spatial correlation (value(s) >= 0.0)|0.0|None|0.0
*ParameterNumber|seed|Random seed (SEED_MIN >= value >= SEED_MAX) (default [random])|None|None|0.0
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,6 @@
r.randon.raster
r.random.raster - Create random raster
Raster (r.*)
ParameterRaster|raster|Name of input raster map|False
ParameterNumericalValue|value|The number of points to allocate |None|None|1
OutputRaster|output|Output layer

View File

@ -0,0 +1,8 @@
r.random
r.random - Creates a raster layer and vector point map containing randomly located points.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterRaster|cover|Input cover raster layer|False
ParameterNumber|n|The number of points to allocate|0|None|10
OutputRaster|raster_output|Output raster layer
OutputVector|vector_output|Output vector layer

View File

@ -0,0 +1,6 @@
r.reclass.area
r.reclass.area.greater - Reclassifies a raster layer, selecting areas larger than a user specified size
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterNumber|greater|Area threshold [hectares]|0|None|1.0
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,6 @@
r.reclass.area
r.reclass.area.lesser - Reclassifies a raster layer, selecting areas lower than a user specified size
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterNumber|lesser|Area threshold [hectares]|0|None|1.0
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,6 @@
r.reclass
r.reclass - Creates a new map layer whose category values are based upon a reclassification of the categories in an existing raster map layer.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterFile|rules|File containing reclass rules|-
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.recode
r.recode - Recodes categorical raster maps.
Raster (r.*)
ParameterRaster|input|Input layer|False
ParameterFile|rules|File containing recode rules|False
*ParameterBoolean|-d|Force output to 'double' raster map type (DCELL)|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.regression.line
r.regression.line - Calculates linear regression from two raster layers : y = a + b*x.
Raster (r.*)
ParameterRaster|map1|Layer for x coefficient|False
ParameterRaster|map2|Layer for y coefficient|False
ParameterBoolean|-s|Slower but accurate|False
OutputHTML|html|Regression data

View File

@ -0,0 +1,13 @@
r.report
r.report - Reports statistics for raster layers.
Raster (r.*)
ParameterMultipleInput|map|Raster layer(s) to report on|3.0|False
ParameterSelection|units|Units|mi;me;k;a;h;c;p
ParameterString|null|Character representing no data cell value|*
ParameterNumber|nsteps|Number of fp subranges to collect stats from|1|None|255
ParameterBoolean|-h|Suppress page headers|True
ParameterBoolean|-f|Use formfeeds between pages|True
ParameterBoolean|-e|Scientific format|True
ParameterBoolean|-n|Filter out all no data cells|True
ParameterBoolean|-N|Filter out cells where all layers have no data|True
OutputHTML|html|Output report file

View File

@ -0,0 +1,7 @@
r.resamp.interp
r.resamp.interp - Resamples a raster map layer to a finer grid using interpolation.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterSelection|method|Interpolation method|nearest;bilinear;bicubic
ParameterBoolean|-a_r.region|Align region to resolution (default = align to bounds) in r.region|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,9 @@
r.resamp.rst
r.resamp.rst - Reinterpolates using regularized spline with tension and smoothing.
Raster (r.*)
ParameterRaster|input|Raster layer|False
ParameterNumber|ew_res|Desired east-west resolution|0.0|None|1
ParameterNumber|ns_res|Desired north-south resolution|0.0|None|1
ParameterBoolean|-t|Use dnorm independent tension|False
ParameterBoolean|-a_r.region|Align region to resolution (default = align to bounds) in r.region|False
OutputRaster|elev|Output layer

View File

@ -0,0 +1,9 @@
r.resamp.stats
r.resamp.stats - Resamples raster layers to a coarser grid using aggregation.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterSelection|method|Aggregation method|average;median;mode;minimum;maximum;quart1;quart3;perc90;sum;variance;stddev
ParameterBoolean|-n|Propagate NULLs|False
ParameterBoolean|-w|Weight according to area (slower)|False
ParameterBoolean|-a_r.region|Align region to resolution (default = align to bounds) in r.region|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,5 @@
r.resample
r.resample - GRASS raster map layer data resampling capability using nearest neighbors.
Raster (r.*)
ParameterRaster|input|Input raster layer |False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.rescale.eq
r.rescale.eq - Rescales histogram equalized the range of category values in a raster layer.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterRange|from|The input data range to be rescaled
ParameterRange|to|The output data range
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.rescale
r.rescale - Rescales the range of category values in a raster layer.
Raster (r.*)
ParameterRaster|input|Input raster layer|False
ParameterRange|from|The input data range to be rescaled|0,1
ParameterRange|to|The output data range|0,1
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,8 @@
r.series
r.series - Makes each output cell value a function of the values assigned to the corresponding cells in the input raster layers.
Raster (r.*)
ParameterMultipleInput|input|Input raster layer(s)|3.0|False
ParameterBoolean|-n|Propagate NULLs|True
ParameterSelection|method|Aggregate operation|average;count;median;mode;minimum;min_raster;maximum;max_raster;stddev;range;sum;variance;diversity;slope;offset;detcoeff;quart1;quart3;perc90;skewness;kurtosis
*ParameterString|range|Ignore values outside this range (lo,hi)|-10000000000,10000000000
OutputRaster|output|Ouptut raster layer

View File

@ -0,0 +1,10 @@
r.shaded.relief
r.shaded.relief - Creates shaded relief from an elevation layer (DEM).
Raster (r.*)
ParameterRaster|map|Input elevation layer|False
ParameterNumber|altitude|Altitude of the sun in degrees above the horizon|None|None|30.0
ParameterNumber|azimuth|Azimuth of the sun in degrees to the east of north|None|None|270.0
ParameterNumber|zmult|Factor for exaggerating relief|None|None|1.0
ParameterNumber|scale|Scale factor for converting horizontal units to elevation units|None|None|1.0
ParameterSelection|units|et scaling factor (applies to lat./long. locations only, none: scale=1)|none;meters;feet
OutputRaster|shadedmap|Output shaded relief layer

View File

@ -0,0 +1,21 @@
r.sim.sediment
r.sim.sediment - Sediment transport and erosion/deposition simulation using path sampling method (SIMWE).
Raster (r.*)
ParameterRaster|elevation|Name of the elevation raster map [m]|False
ParameterRaster|wdepth|Name of the water depth raster map [m]|False
ParameterRaster|dx|Name of the x-derivatives raster map [m/m]|False
ParameterRaster|dy|Name of the y-derivatives raster map [m/m]|False
ParameterRaster|det|Name of the detachment capacity coefficient raster map [s/m]|False
ParameterRaster|tran|Name of the transport capacity coefficient raster map [s]|False
ParameterRaster|tau|Name of the critical shear stress raster map [Pa]|False
ParameterRaster|man|Name of the Mannings n raster map|False
ParameterNumber|man_value|Name of the Mannings n value|None|None|0.1
ParameterNumber|nwalk|Number of walkers|None|None|1
ParameterNumber|niter|Time used for iterations [minutes]|None|None|10
ParameterNumber|outiter|Time interval for creating output maps [minutes]|None|None|2
ParameterNumber|diffc|Water diffusion constant|None|None|0.8
OutputRaster|tc|Output transport capacity raster map [kg/ms]
OutputRaster|et|Output transp.limited erosion-deposition raster map [kg/m2s]
OutputRaster|conc|Output sediment concentration raster map [particle/m3]
OutputRaster|flux|Output sediment flux raster map [kg/ms]
OutputRaster|erdep|Output erosion-deposition raster map [kg/m2s]

View File

@ -0,0 +1,24 @@
r.sim.water
r.sim.water - Overland flow hydrologic simulation using path sampling method (SIMWE).
Raster (r.*)
ParameterRaster|elevation|Name of the elevation raster map [m]|False
ParameterRaster|dx|Name of the x-derivatives raster map [m/m]|False
ParameterRaster|dy|Name of the y-derivatives raster map [m/m]|False
ParameterRaster|rain|Name of the rainfall excess rate (rain-infilt) raster map [mm/hr]|False
ParameterString|rain_value|Rainfall excess rate unique value [mm/hr]|50
ParameterRaster|infil|Name of the runoff infiltration rate raster map [mm/hr]|False
ParameterString|infil_value|Runoff infiltration rate unique value [mm/hr]|0.0
ParameterRaster|man|Name of the Mannings n raster map|False
ParameterString|man_value|Mannings n unique value|0.1
ParameterRaster|traps|Name of the flow controls raster map (permeability ratio 0-1)|False
ParameterString|nwalk|Number of walkers, default is twice the no. of cells|
ParameterString|niter|Time used for iterations [minutes]|10
ParameterString|outiter|Time interval for creating output maps [minutes]|2
ParameterString|diffc|Water diffusion constant|0.8
ParameterString|hmax|Threshold water depth [m] (diffusion increases after this water depth is reached)|0.3
ParameterString|halpha|Diffusion increase constant|4.0
ParameterString|hbeta|Weighting factor for water flow velocity vector|0.5
ParameterBoolean|-t|Time-series output|True
OutputRaster|depth|Output water depth raster map [m]
OutputRaster|disch|Output water discharge raster map [m3/s]
OutputRaster|err|Output simulation error raster map [m]

View File

@ -0,0 +1,17 @@
r.slope.aspect
r.slope.aspect - Generates raster layers of slope, aspect, curvatures and partial derivatives from a elevation raster layer.
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterSelection|format|Format for reporting the slope|degrees;percent
ParameterSelection|prec|Type of output aspect and slope layer|float;double;int
ParameterNumber|zfactor|Multiplicative factor to convert elevation units to meters|None|None|1.0
ParameterNumber|min_slp_allowed|Minimum slope val. (in percent) for which aspect is computed|None|None|0.0
OutputRaster|slope|Output slope layer
OutputRaster|aspect|Output aspect layer
OutputRaster|pcurv|Output profile curvature layer
OutputRaster|tcurv|Output tangential curvature layer
OutputRaster|dx|Output first order partial derivative dx (E-W slope) layer
OutputRaster|dy|Output first order partial derivative dy (N-S slope) layer
OutputRaster|dxx|Output second order partial derivative dxx layer
OutputRaster|dyy|Output second order partial derivative dyy layer
OutputRaster|dxy|Output second order partial derivative dxy layer

View File

@ -0,0 +1,7 @@
r.spreadpath
r.spreadpath - Recursively traces the least cost path backwards to cells from which the cumulative cost was determined.
Raster (r.*)
ParameterRaster|x_input|x_input|False
ParameterRaster|y_input|y_input|False
ParameterString|coordinate|coordinate|0,0
OutputRaster|output|Output layer

View File

@ -0,0 +1,8 @@
r.statistics
r.statistics - Calculates category or object oriented statistics.
Raster (r.*)
ParameterRaster|base|Base raster layer|False
ParameterRaster|cover|Cover raster layer|False
ParameterSelection|method|method|diversity;average;mode;median;avedev;stddev;variance;skewness;kurtosis;min;max;sum
ParameterBoolean|-c|Cover values extracted from the category labels of the cover map|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,21 @@
r.stats
r.stats - Generates area statistics for raster layers.
Raster (r.*)
ParameterMultipleInput|input|Name of input raster map|3.0|False
ParameterString|separator|Output field separator|space
ParameterString|nv|String representing no data cell value|*
ParameterString|nsteps|Number of fp subranges to collect stats from|255
ParameterBoolean|-1|One cell (range) per line|True
ParameterBoolean|-A|Print averaged values instead of intervals|False
ParameterBoolean|-a|Print area totals|False
ParameterBoolean|-c|Print cell counts|False
ParameterBoolean|-p|Print APPROXIMATE percents (total percent may not be 100%)|False
ParameterBoolean|-l|Print category labels|False
ParameterBoolean|-g|Print grid coordinates (east and north)|False
ParameterBoolean|-x|Print x and y (column and row)|False
ParameterBoolean|-r|Print raw indexes of fp ranges (fp maps only)|False
ParameterBoolean|-n|Suppress reporting of any NULLs|False
ParameterBoolean|-N|Suppress reporting of NULLs when all values are NULL|False
ParameterBoolean|-C|Report for cats fp ranges (fp maps only)|False
ParameterBoolean|-i|Read fp map as integer (use map's quant rules)|False
OutputHTML|html|Output stats file

View File

@ -0,0 +1,13 @@
r.stream.angle
r.stream.angle - Route azimuth, direction and relation to streams of higher order.
Raster (r.*)
ParameterRaster|stream_rast|Input map: stream mask|False
ParameterRaster|directions|Input map: direction map|False
ParameterRaster|elevation|Input map: elevation map|True
ParameterSelection|order|Stream ordering method|none;hack;horton;strahler|0
ParameterNumber|length|Search length to calculat direction|1|None|15
ParameterNumber|skip|Skip segments shorter than|1|None|5
ParameterNumber|treshold|Max angle (degrees) beetwen stream segments to|1.0|360.0|150.0
ParameterBoolean|-r|Output angles in radians|False
ParameterBoolean|-e|Extended topology|False
OutputVector|seg_vector|Vector to store new network with segments

View File

@ -0,0 +1,10 @@
r.stream.basins
r.stream.basins - Calculate basins according user input
Raster (r.*)
ParameterRaster|direction|Input map: flow direction|False
ParameterRaster|stream_rast|Input map: stream network|True
ParameterVector|points|Basins outlets|0|True
ParameterBoolean|-z|Create zero-value background|False
ParameterBoolean|-c|Use unique category sequence|False
ParameterBoolean|-l|Create basins only for last stream links|False
OutputRaster|basins|Output basin map

View File

@ -0,0 +1,8 @@
r.stream.del
r.stream.del - Calculate basins according user input
Raster (r.*)
ParameterRaster|stream_rast|Input map: stream mask|False
ParameterRaster|direction|Input map: flow direction|False
ParameterNumber|threshold|Minimum number of cell in stream_rast|1|None|1
ParameterBoolean|-z|Create zero-value background|False
OutputRaster|reduced|Output reduced stream map

View File

@ -0,0 +1,12 @@
r.stream.distance
r.stream.distance - Calculate distance to and elevation above streams and outlets
Raster (r.*)
ParameterRaster|stream_rast|Input map: streams (outlets) mask|False
ParameterRaster|direction|Input map: flow direction|False
ParameterRaster|elevation|Input map: elevation map|True
ParameterSelection|method|Calculation method|upstream,downstream|1
ParameterBoolean|-o|Calculate parameters for outlets|False
ParameterBoolean|-s|Calculate parameters for subbasins|False
ParameterBoolean|-n|Calculate nearest local maximum|False
OutputRaster|difference|Output elevation difference map
OutputRaster|distance|Output distance map

View File

@ -0,0 +1,13 @@
r.stream.extract
r.stream.extract - Stream network extraction
Raster (r.*)
ParameterRaster|elevation|Input map: elevation map|False
ParameterRaster|accumulation|Input map: accumulation map|True
ParameterRaster|depression|Input map: map with real depressions|True
ParameterNumber|threshold|Minimum flow accumulation for streams|1.0|None|0.1
ParameterNumber|mexp|Montgomery exponent for slope|0|None|0
ParameterNumber|stream_length|Delete stream segments shorter than cells|0|None|0
ParameterNumber|d8cut|Use SFD above this threshold|0|None|0
OutputRaster|stream_rast|Output raster map with unique stream ids
OutputVector|stream_vect|Output vector with unique stream ids
OutputRaster|direction|Output raster map with flow direction

View File

@ -0,0 +1,12 @@
r.stream.order
r.stream.order - Calculate Strahler's and Horton's stream order Hack's main streams and Shreeve's stream magnitude
Raster (r.*)
ParameterRaster|stream_rast|Input map: stream mask|False
ParameterRaster|direction|Input map: direction map|False
ParameterBoolean|-a|Use flow accumulation to trace horton and hack models|False
ParameterBoolean|-z|Create zero-value background|False
OutputRaster|strahler|Output basin map (Strahler)
OutputRaster|shreve|Output basin map (Shreve)
OutputRaster|horton|Output basin map (Horton)
OutputRaster|hack|Output basin map (Hack)
OutputRaster|topo|Output basin map (Topo)

View File

@ -0,0 +1,9 @@
r.stream.pos
r.stream.pos - Route azimuth, direction and relation to streams of higher order
Raster (r.*)
ParameterRaster|stream_rast|Input map: stream mask|False
ParameterRaster|direction|Input map: flow direction|False
ParameterNumber|multiplier|Multipier to store stream index value|1|None|1000
ParameterBoolean|-s|Create new stream category sequence|False
OutputFile|cells|File to store pixel's position
OutputFile|lengths|File to store current stream length

View File

@ -0,0 +1,7 @@
r.stream.stats
r.stream.stats - Calculate Horton's and optionally Hack's statistics
Raster (r.*)
ParameterRaster|stream_rast|Input map: stream mask|False
ParameterRaster|direction|Input map: flow direction|False
ParameterRaster|elevation|Input map: elevation|False
OutputFile|output|Output stats

View File

@ -0,0 +1,4 @@
r.sum
r.sum - Sums up the raster cell values.
Raster (r.*)
ParameterRaster|rast|Name of incidence or density file|False

View File

@ -0,0 +1,23 @@
r.sun
r.sun - Solar irradiance and irradiation model.
Raster (r.*)
ParameterRaster|elev_in|Elevation layer [meters]|False
ParameterRaster|asp_in|Aspect layer [decimal degrees]|False
ParameterRaster|slope_in|Name of the input slope raster map (terrain slope or solar panel inclination) [decimal degrees]|False
ParameterRaster|linke_in|Name of the Linke atmospheric turbidity coefficient input raster map|True
ParameterRaster|albedo|Name of the ground albedo coefficient input raster map|True
ParameterRaster|lat_in|Name of input raster map containing latitudes [decimal degrees]|True
ParameterRaster|long_in|Name of input raster map containing longitudes [decimal degrees]|True
ParameterRaster|coef_bh|Name of real-sky beam radiation coefficient input raster map|True
ParameterRaster|coef_dh|Name of real-sky diffuse radiation coefficient input raster map|True
ParameterNumber|day|No. of day of the year (1-365)|1|365|1
*ParameterNumber|step|Time step when computing all-day radiation sums [decimal hours]|0|None|0.5
*ParameterNumber|declination|Declination value (overriding the internally computed value) [radians]|None|None|0.0
*ParameterNumber|distance_step|Sampling distance step coefficient (0.5-1.5)|0.5|1.5|1.0
ParameterBoolean|-p|Do not iIncorporate the shadowing effect of terrain|False
*ParameterBoolean|-m|Use the low-memory version of the program|False
OutputRaster|beam_rad|Output irradiation layer [Wh.m-2.day-1]
OutputRaster|insol_time|Output insolation time layer [h]
OutputRaster|diff_rad|Outpu diffuse irradiation layer [Wh.m-2.day-1]
OutputRaster|refl_rad|Output ground reflected irradiation layer [Wh.m-2.day-1]
OutputRaster|glob_rad|Output global (total) irradiance/irradiation layer [Wh.m-2.day-1]

View File

@ -0,0 +1,17 @@
r.sunmask
r.sunmask - Calculates cast shadow areas from sun position and elevation raster map.
Raster (r.*)
ParameterRaster|elev|elev|False
ParameterNumber|altitude|altitude|0|90|0.0
ParameterNumber|azimuth|azimuth|0|360|0.0
ParameterNumber|year|year|1950|2050|2000
ParameterNumber|month|month|0|12|1
ParameterNumber|day|day|0|31|1
ParameterNumber|hour|hour|0|24|1
ParameterNumber|minute|minute|0|60|0
ParameterNumber|second|second|0|60|0
ParameterNumber|timezone|East positive, offset from GMT|0|None|0.0
ParameterNumber|east|Easting coordinate (point of interest)|None|None|0.0
ParameterNumber|north|Northing coordinate (point of interest)|None|None|0.0
ParameterBoolean|-z|Don't ignore zero elevation|True
OutputRaster|output|Output layer

View File

@ -0,0 +1,5 @@
r.surf.area
r.surf.area - Surface area estimation for rasters.
Raster (r.*)
ParameterRaster|map|Input layer|False
ParameterNumber|vscale|Vertical scale|None|None|1

View File

@ -0,0 +1,5 @@
r.surf.contour
r.surf.contour - Surface generation program from rasterized contours.
Raster (r.*)
ParameterRaster|input|Raster layer with rasterized contours|False
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,6 @@
r.surf.gauss
r.surf.gauss - Creates a raster layer of Gaussian deviates.
Raster (r.*)
ParameterString|mean|Distribution mean|0.0
ParameterString|sigma|Standard deviation|1.0
OutputRaster|output|Output raster layer

View File

@ -0,0 +1,7 @@
r.surf.idw
r.surf.idw - Surface interpolation utility for raster layers.
Raster (r.*)
ParameterRaster|input|Name of input raster layer|False
ParameterNumber|npoints|Number of interpolation points|1|None|12
ParameterBoolean|-e|Output is the interpolation error|False
OutputRaster|output|Output raster layer

Some files were not shown because too many files have changed in this diff Show More