[GRASS-user] Mapcalc for rounding float values

Glynn Clements glynn at gclements.plus.com
Fri Feb 15 05:09:14 PST 2013


Hamish wrote:

> there are a couple ways to do it, here's one:
>   r.mapcalc "map.2dp = int(0.5 + (map.15g * 100))/100.0"
> 
> the 0.5 is added because int() truncates instead of rounding.

Note that r.mapcalc has a round() function.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list