Skip to content

Commit

Permalink
added special case for r.statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
scubbx committed May 19, 2015
1 parent 824a395 commit a3454e7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,25 @@ def processAlgorithm(self, progress):
commands.append('g.region raster=' + out.name + uniqueSufix)
outputCommands.append('g.region raster=' + out.name
+ uniqueSufix)
if self.grassName == 'r.statistics':
# r.statistics saves its results in a non-qgis compatible way.
# Post-Process with r.mapcalc.
calcExpression = 'correctedoutput' + uniqueSufix
calcExpression += '=@' + out.name + uniqueSufix
command = 'r.mapcalc expression="' + calcExpression + '"'
commands.append(command)
outputCommands.append(command)

if self.grassName == 'r.composite':
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='
command += out.name + uniqueSufix
command += ' output="' + filename + '"'
elif self.grassName == 'r.statistics':
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='
command += 'correctedoutput' + uniqueSufix
command += ' output="' + filename + '"'
else:
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
command += ' input='
Expand All @@ -375,6 +389,9 @@ def processAlgorithm(self, progress):
elif self.grassName == 'r.composite':
commands.append(command)
outputCommands.append(command)
elif self.grassName == 'r.statistics':
commands.append(command)
outputCommands.append(command)
else:
command += out.name + uniqueSufix
command += ' output="' + filename + '"'
Expand Down

0 comments on commit a3454e7

Please sign in to comment.