Bug report #12573
QGIS console: 'saga:rastercalc' giving bogus values compared to other algorithms
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Processing/SAGA | ||
Affected QGIS version: | 2.8.1 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | up/downstream |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 20701 |
Description
A note the issue reported under #12450, but mine seems different.
From QGIS python console, saga:rastercalculator gives bogus values compared to QGIS GUI raster calculator(same input rasters and formulas, obviously).
out = processing.runalg('saga:rastercalculator',A,[B,C],'a*b/c','false',8,None)
Just a double check, I changed algorithm:
out = processing.runalg('grass:r.mapcalculator',A,B,C,None,None,None,'A*B/C','-180,180,-90,90',0.5,None)
and got the very same results as in the QGIS GUI raster calculator.
I'm on Windows (tried both 7 and 8.1) with QGIS 2.8.1 Wien (from OSGEO4W).
I'm attaching the input rasters.
History
#1 Updated by Giovanni Manghi over 9 years ago
- Status changed from Open to Feedback
- Category set to Processing/SAGA
If is SAGA that makes the wrong calculations then qgis/processing cannot do anything about it. Can you test run the same operation using the SAGA command line/gui? Thanks.
#2 Updated by paolo prosperi over 9 years ago
- File out_QGISSAGA.tif added
- File out_SAGAGUI.tif added
- File out_QGISGUI.tif added
- File out_QGISGRASS.tif added
I am indeed having the same strange results from SAGA GUI (Grid Calculus command) as I did earlier from saga:rastercalculator in QGIS console. I don't know how to do the same with SAGA command line, sorry.
I am attaching all the results from the different algorithms used.
P
#3 Updated by Giovanni Manghi over 9 years ago
- Resolution set to up/downstream
- Status changed from Feedback to Closed
paolo prosperi wrote:
I am indeed having the same strange results from SAGA GUI (Grid Calculus command) as I did earlier from saga:rastercalculator in QGIS console. I don't know how to do the same with SAGA command line, sorry.
I am attaching all the results from the different algorithms used.
SAGA gui or cli does not make difference, but if this is a SAGA issue than we cannot do anything in QGIS/Processing.
#4 Updated by paolo prosperi over 9 years ago
Following Giovanni's response, I filed a bug in the SAGA system and, very surprisingly, this is the outcome from Olaf Conrad (http://sourceforge.net/p/saga-gis/bugs/204/):
"This is not a bug but a feature. If using grids with different grid systems, values are interpolated automatically with a spline function to meet the target grid system.
For convenience I just added an option that allows you to choose another interpolation type. Now you can choose 'nearest neighbour', if you want to reproduce the exact grass map calculator results. Alternatively resample your grids to one single grid system without interpolation (i.e. nearest neighbour) and use these with SAGA's grid calculator. Thank you for pointing at this inflexibility."
Good to know for anyone working with saga:rastercalculator tool in QGIS.