<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi Pedro,</p>
<p><br>
</p>
<p>thank you again.</p>
<p>If it helps, yesterday I tested the two operation in separate process, </p>
<p>I mean I performed Formula 1 and I saved the result as tif, the I run</p>
<p>the formula 2. I saw that there wasn't errors.</p>
<p>So I guess the problem is when I concatenate the computations in a single process.</p>
<p><br>
</p>
<p>Let me know if the developers find out a solution.</p>
<p>Best,</p>
<p><br>
Eugenio </p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Da:</b> Pedro Venâncio <pedrongvenancio@gmail.com><br>
<b>Inviato:</b> mercoledì 31 maggio 2017 22:16<br>
<b>A:</b> Eugenio Trumpy<br>
<b>Cc:</b> qgis-user; qgis-developer<br>
<b>Oggetto:</b> Re: [Qgis-user] Wrong result with Saga Raster calculator</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>Hi Eugenio,<br>
<br>
</div>
I've created a sample processing model (attached), that works ok, except a small error in the result (decimals).<br>
<br>
</div>
For instance:<br>
<br>
<table cellspacing="0" border="0">
<colgroup width="122"></colgroup><colgroup width="85"></colgroup><colgroup width="122">
</colgroup><colgroup width="116"></colgroup>
<tbody>
<tr>
<td align="center" height="17" bgcolor="#DDDDDD" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<b>Raster</b></td>
<td align="center" bgcolor="#DDDDDD" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<b>ID</b></td>
<td align="center" bgcolor="#DDDDDD" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<b>Pixel value</b></td>
<td align="left"><br>
</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
Z_top_res</td>
<td align="center" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
a</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
1202,03510276</td>
<td align="left"><br>
</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
t_top_res</td>
<td align="center" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
b</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
53,6123428345</td>
<td align="left"><br>
</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
topo</td>
<td align="center" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
c1</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
-182,584899902</td>
<td align="left"><br>
</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
SAGA Result 1</td>
<td align="center" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
c</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
15,1783676147</td>
<td align="left"><br>
</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
SAGA Result 2</td>
<td align="center" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
d</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
31,9437332153</td>
<td align="center" bgcolor="#DDDDDD" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<b>Diff</b></td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
Expected Result 1</td>
<td align="left" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<br>
</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
15,1783679504</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
0,000000335741</td>
</tr>
<tr>
<td align="left" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
Expected Result 2</td>
<td align="left" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<br>
</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
31,9740872222</td>
<td align="right" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
0,0303540069</td>
</tr>
</tbody>
</table>
<br>
<table cellspacing="0" border="0">
<colgroup width="85"></colgroup><colgroup width="282"></colgroup>
<tbody>
<tr>
<td colspan="2" align="center" valign="middle" height="17" bgcolor="#DDDDDD" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
<b>Formula</b></td>
</tr>
<tr>
<td align="right" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
1</td>
<td align="left" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
ifelse(c1>0,-(0.0065*c1-16),(0.0045*c1+16))</td>
</tr>
<tr>
<td align="right" height="17" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
2</td>
<td align="left" style="border-width:1px; border-style:solid; border-color:rgb(0,0,0)">
ifelse(a<500,0,((b-c)/a)*1000)</td>
</tr>
</tbody>
</table>
<br>
</div>
Using SAGA GUI there is no error. <br>
<br>
</div>
Could this be because of some roundings in the input / output? (I'm sending for the developer's list also).<br>
<br>
</div>
Thanks!<br>
<br>
</div>
Best regards,<br>
</div>
Pedro Venâncio<br>
<div>
<div>
<div><br>
<div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2017-05-31 10:56 GMT+01:00 Eugenio Trumpy <span dir="ltr">
<<a href="mailto:frippe12573@hotmail.com" target="_blank">frippe12573@hotmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="m_82990895616978099divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Arial,Helvetica,sans-serif">
<p><br>
</p>
Hi Pedro,
<div><br>
</div>
<div>thank you very much to have tested the computation with my test data!</div>
<div>You are right, I checked again the computation and actually it works.</div>
<div><br>
</div>
<div>However, I was using Saga raster calculation in a processing modeler, and one of the layer I share with you</div>
<div>is the resulting from a previous computation. </div>
<div><br>
</div>
<div>In other word the raster layer c=temp_recal.tif comes from a previous computation (raster calculator):</div>
<div><span>ifelse(a>0,-(0.0065*a-16),(0.<wbr>0045*a+16))</span></div>
<div>where a is the layer attached, and hence c of the previous formula is the resulting of this first computation.</div>
<div><br>
</div>
<div>E.<br>
<br>
<div style="color:rgb(0,0,0)">
<hr style="display:inline-block; width:98%">
<div id="m_82990895616978099divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Da:</b> Pedro Venâncio <<a href="mailto:pedrongvenancio@gmail.com" target="_blank">pedrongvenancio@gmail.com</a>><br>
<b>Inviato:</b> mercoledì 31 maggio 2017 11:37<span class=""><br>
<b>A:</b> frippe12573; qgis-user<br>
<b>Oggetto:</b> Re: [Qgis-user] Wrong result with Saga Raster calculator</span></font>
<div> </div>
</div>
<div>
<div class="h5">
<div>
<div dir="ltr">
<div>
<div>Hi Eugenio,<br>
<br>
</div>
The result with SAGA Raster Calculator seems ok here, on QGIS 2.18.9, SAGA 2.3.2, both from OSGeo4W64 (result attached).<br>
<br>
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.<br>
<br>
<br>
</div>
Pedro<br>
<div><br>
<br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2017-05-31 10:19 GMT+01:00 frippe12573 <span dir="ltr"><<a href="mailto:frippe12573@hotmail.com" target="_blank">frippe12573@hotmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Hi Paolo,<br>
<br>
the raster have the same size and origin.<br>
The pixels are precisely overlapped.<br>
<br>
I tried also r.mapcalc, but I got a worst result.<br>
Here the output of the log:<br>
<a href="https://pastebin.com/jNyyzHgf" rel="noreferrer" target="_blank">https://pastebin.com/jNyyzHgf</a><br>
<br>
E.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://osgeo-org.1560.x6.nabble.com/Wrong-result-with-Saga-Raster-calculator-tp5322429p5322442.html" rel="noreferrer" target="_blank">
http://osgeo-org.1560.x6.nabbl<wbr>e.com/Wrong-result-with-Saga-<wbr>Raster-calculator-tp5322429p53<wbr>22442.html</a><br>
<span class="m_82990895616978099im m_82990895616978099HOEnZb">Sent from the QGIS - User mailing list archive at Nabble.com.<br>
</span>
<div class="m_82990895616978099HOEnZb">
<div class="m_82990895616978099h5">______________________________<wbr>_________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">
https://lists.osgeo.org/mailma<wbr>n/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">
https://lists.osgeo.org/mailma<wbr>n/listinfo/qgis-user</a></div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>