Bug report #11967

r.statistics needs to be implemented as a special case in Processing (or removed)

Added by Markus Mayr over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:Victor Olaya
Category:Processing/GRASS
Affected QGIS version:2.6.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:20174

Description

When using the "r.statistics" GRASS algorithm via the processing toolbox, the output always corresponds to the layer selected as "Base raster layer". There is no calculation performed.
A more specialized algorithm like "r.average" seems to perform the calculation.

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Operating System deleted (Linux Mint)
  • OS version deleted (17.1)

as it is implemented now in Processing, r.statistics cannot work.

The reason is that the result of r.statistic (in native GRASS) is a raster layer that has the same pixel values of the base layer, where the computed statistics are stored into the (GRASS) raster labels.

The computed values can be "extracted" by doing a simple r.mapcalc operation.

So the options are:

1) remove r.statistics from Processing

2) modify GrassAlgorithm.py and add a special case (it has already be done for r.horizon and r.composite) to cope with this special module

#2 Updated by Giovanni Manghi over 5 years ago

2) modify GrassAlgorithm.py and add a special case (it has already be done for r.horizon and r.composite) to cope with this special module

note:
the map outputted by r.statistics must be processed this way

r.mapcalc "[email protected]_output"

before outputting (newoutput) with r.out.gdal

#3 Updated by Giovanni Manghi over 5 years ago

  • Subject changed from r.statistics broken? to r.statistics needs to be implemented as a special case in Processing (or removed)

#4 Updated by Markus Mayr over 5 years ago

I added the proposed step to the processing code: https://github.com/qgis/QGIS/pull/2043
For me, this produces valid results now.

#5 Updated by Giovanni Manghi over 5 years ago

  • Pull Request or Patch supplied changed from No to Yes

#6 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to fixed/implemented
  • Status changed from Open to Closed

Also available in: Atom PDF