On 05/20/2013 01:46 PM, Glynn Clements wrote:
Markus Metz wrote:

Happy to see this exchange of ideas. It would be great if this could be
implemented. Do you think it is useful I make a feature request on the bug
tracker (with link to this email thread) so the idea doesn't get lost?
Instead of

r.mapcalc "A = if(B==0,
(round(C/0.0001)-1175699902)/(3007966667-1175699902) *100.0, 1)"
--overwrite

try

r.mapcalc "A = if(B==0,
(round(C/0.0001)-1175699902.0)/(3007966667.0-1175699902.0) *100.0, 1)"
--overwrite

or better with whitespaces

r.mapcalc "A = if(B == 0, (round(C / 0.0001) - 1175699902.0) /
(3007966667.0 - 1175699902.0) * 100.0, 1)" --overwrite

adding .0 to numbers forces all calculations to be done with  floating
point double precision
That won't help; the problem is that round() returns an integer.

It wouldn't be particularly hard to change it so that the return type
is the same as the argument type, but that might break existing
scripts.

Hi Glynn,

In case you haven't seen it, Markus Metz has implemented in trunk r56313 <http://trac.osgeo.org/grass/changeset/56313> the option to have the same raster type as output of round() as the input type, see ticket 1976 (http://trac.osgeo.org/grass/ticket/).

I sure hope it does not brake existing scripts, as this is a very useful enhancement I think.

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to