[GRASS-user] Mapcalc for rounding float values

Margherita Di Leo diregola at gmail.com
Fri Feb 15 05:55:35 PST 2013


Hi,

On Fri, Feb 15, 2013 at 2:09 PM, Glynn Clements <glynn at gclements.plus.com>wrote:

>
> 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.
>

Also, note that if you want non integer reclassified output you might want
to use r.recode instead of r.reclass.

cheers, madi

>
>

-- 
Margherita DI LEO
Postdoctoral Researcher

European Commission - DG JRC
Institute for Environment and Sustainability (IES). Unit H03 – FRC
Via Fermi, 2749
I-21027 Ispra (VA) - Italy - TP 261

Tel. +39 0332 78 3600
margherita.di-leo at jrc.ec.europa.eu

Disclaimer: The views expressed are purely those of the writer and may not
in any circumstance be regarded as stating an official position of the
European Commission.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130215/b2a15e32/attachment.html>


More information about the grass-user mailing list