[QGIS-Developer] [Qgis-user] Wrong result with Saga Raster calculator

Eugenio Trumpy frippe12573 at hotmail.com
Wed May 31 23:26:23 PDT 2017

Hi Pedro,

thank you again.

If it helps, yesterday I tested the two operation in separate process,

I mean I performed Formula 1 and I saved the result as tif, the I run

the formula 2. I saw that there wasn't errors.

So I guess the problem is when I concatenate the computations in a single process.

Let me know if the developers find out a solution.



Da: Pedro Venâncio <pedrongvenancio at gmail.com>
Inviato: mercoledì 31 maggio 2017 22:16
A: Eugenio Trumpy
Cc: qgis-user; qgis-developer
Oggetto: Re: [Qgis-user] Wrong result with Saga Raster calculator

Hi Eugenio,

I've created a sample processing model (attached), that works ok, except a small error in the result (decimals).

For instance:

Raster  ID      Pixel value

Z_top_res       a       1202,03510276

t_top_res       b       53,6123428345

topo    c1      -182,584899902

SAGA Result 1   c       15,1783676147

SAGA Result 2   d       31,9437332153   Diff
Expected Result 1
        15,1783679504   0,000000335741
Expected Result 2
        31,9740872222   0,0303540069

1       ifelse(c1>0,-(0.0065*c1-16),(0.0045*c1+16))
2       ifelse(a<500,0,((b-c)/a)*1000)

Using SAGA GUI there is no error.

Could this be because of some roundings in the input / output? (I'm sending for the developer's list also).


Best regards,
Pedro Venâncio

2017-05-31 10:56 GMT+01:00 Eugenio Trumpy <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:

Hi Pedro,

thank you very much to have tested the computation with my test data!
You are right, I checked again the computation and actually it works.

However, I was using Saga raster calculation in a processing modeler, and one of the layer I share with you
is the resulting from a previous computation.

In other word the raster layer c=temp_recal.tif comes from a previous computation (raster calculator):
where a is the layer attached, and hence c of the previous  formula is the resulting of this first computation.


Da: Pedro Venâncio <pedrongvenancio at gmail.com<mailto:pedrongvenancio at gmail.com>>
Inviato: mercoledì 31 maggio 2017 11:37
A: frippe12573; qgis-user
Oggetto: Re: [Qgis-user] Wrong result with Saga Raster calculator

Hi Eugenio,

The result with SAGA Raster Calculator seems ok here, on QGIS 2.18.9, SAGA 2.3.2, both from OSGeo4W64 (result attached).

Z_top_res.tif have values from 724.403 to 1423.553, and so, the first condition is never true. Then, it always make ((b-c)/a)*1000, and the result seems ok to me.


2017-05-31 10:19 GMT+01:00 frippe12573 <frippe12573 at hotmail.com<mailto:frippe12573 at hotmail.com>>:
Hi Paolo,

the raster have the same size and origin.
The pixels are precisely overlapped.

I tried also r.mapcalc, but I got a worst result.
Here the output of the log:


View this message in context: http://osgeo-org.1560.x6.nabble.com/Wrong-result-with-Saga-Raster-calculator-tp5322429p5322442.html
Sent from the QGIS - User mailing list archive at Nabble.com.
Qgis-user mailing list
Qgis-user at lists.osgeo.org<mailto:Qgis-user at lists.osgeo.org>
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170601/68b6a9c1/attachment.html>

More information about the QGIS-Developer mailing list