Skip to content

Commit d40c763

Browse files
committed
Merge branch 'processing-r.stat'
2 parents c729a75 + 596b126 commit d40c763

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

python/plugins/processing/algs/grass7/Grass7Algorithm.py

+19-2
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,24 @@ def processAlgorithm(self, progress):
361361
commands.append('g.region raster=' + out.name + uniqueSufix)
362362
outputCommands.append('g.region raster=' + out.name
363363
+ uniqueSufix)
364-
if self.grass7Name == 'r.composite':
364+
365+
if self.grassName == 'r.statistics':
366+
# r.statistics saves its results in a non-qgis compatible
367+
# way. Post-process them with r.mapcalc.
368+
calcExpression = 'correctedoutput' + uniqueSufix
369+
calcExpression += '=@' + out.name + uniqueSufix
370+
command = 'r.mapcalc expression="' + calcExpression + '"'
371+
commands.append(command)
372+
outputCommands.append(command)
373+
365374
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
366375
command += ' input='
367-
command += out.name + uniqueSufix
376+
command += 'correctedoutput' + uniqueSufix
377+
command += ' output="' + filename + '"'
378+
elif self.grass7Name == 'r.composite':
379+
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
380+
command += ' input='
381+
command += 'correctedoutput' + uniqueSufix
368382
command += ' output="' + filename + '"'
369383
else:
370384
command = 'r.out.gdal -c createopt="TFW=YES,COMPRESS=LZW"'
@@ -375,6 +389,9 @@ def processAlgorithm(self, progress):
375389
elif self.grass7Name == 'r.composite':
376390
commands.append(command)
377391
outputCommands.append(command)
392+
elif self.grass7Name == 'r.statistics':
393+
commands.append(command)
394+
outputCommands.append(command)
378395
else:
379396
command += out.name + uniqueSufix
380397
command += ' output="' + filename + '"'

0 commit comments

Comments
 (0)