<div dir="ltr"><div><div>Hi,</div><div><br></div><div>I have two r.mapcalc problems to think about.</div><div><br></div><div>You probably remember Glynn's example of `eval` function usage in r.mapcalc expression. The example is now in the manual and says:</div>
<div><br></div><div><div><div>r.mapcalc << EOF</div><div>eval(elev_200 = elevation - 200, \</div><div> elev_5 = 5 * elevation, \</div><div> elev_p = pow(elev_5, 2))</div><div>elevation_result_1 = (0.5 * elev_200) + 0.8 * elev_p</div>
<div>EOF</div></div></div><div><br></div><div>However, the function descriptions says that:<br><br> eval([x,y,...,]z) evaluate values of listed expr, pass results to z<br><br>And the section NULL support (btw, why this one?) says that:</div>
<div><br></div><div> The eval() function always returns its last argument<br></div></div><div><div><br></div><div>So, as a consequence I tried this:</div><div><br></div><div>r.mapcalc << EOF</div><div>elevation_result_2 = eval(elev_200 = elevation - 200, \</div>
<div> elev_5 = 5 * elevation, \</div><div> aspect = pow(elev_5, 2), \</div><div> (0.5 * elev_200) + 0.8 * aspect)</div><div>EOF</div><div><br></div><div>And it works.</div><div><br></div><div>The questions are now: Are both versions valid? And if yes, is one of them best practice? And should both be in the manual?</div>
<div><br></div><div>The site note is that manual perhaps defines how the function/syntax behaves but does not provide examples nor conclusion about what is allowed and possible. In my opinion, manual should not require user to infer how to use the module, it should show how to do it.<br>
</div><div><br></div><div>The second think to discuss is the behavior when you use name `aspect` in the `eval` function, although the `aspect` map exists. I described the behavior in r58765. Please review.</div><div><br>
</div>
<div>Vaclav</div><div><br></div><div><br></div><div>[r58765] <a href="https://trac.osgeo.org/grass/changeset/58765">https://trac.osgeo.org/grass/changeset/58765</a><br></div><div><br></div><div>[r.mapcalc] <a href="http://grass.osgeo.org/grass70/manuals/r.mapcalc.html">http://grass.osgeo.org/grass70/manuals/r.mapcalc.</a></div>
<div><div><div><br></div><div>[GRASS-user] Trying to reclassify raster using non-linear functions in GRASS<div><a href="http://lists.osgeo.org/pipermail/grass-user/2013-November/069225.html">http://lists.osgeo.org/pipermail/grass-user/2013-November/069225.html</a><br>
</div></div></div></div><div><br></div></div></div>