[GRASSLIST:5794] Re: R.reclass and floating point values
Glynn Clements
glynn.clements at virgin.net
Mon Mar 17 09:28:24 EST 2003
Aldo Clerici wrote:
> I reclassed the spearfish slope map with the command:
> r.reclass input=slope output=slope.rec1
> > 0 thru 10 = 1
> > end
>
> and with:
> r.mapcalc slope.rec2="if(slope >=0 && slope <= 10,1,null())"
>
> The two resulting maps are different.
> This seems due to the r.reclass command that performs some sort of rounding
> of the floating point values as results clear by inserting floating point
> classes in the reclassing rules, as follows:
> r.reclass input=slope output=slope.rec1
> > 0.0 thru 10.0 = 1
> the answer is:
> 0.500000 rounded up to 0
> 10.500000 rounded up to 10
>
> In this way the original values between 10 and 10.5 are assigned the new
> class 1.
> Is there a way to avoid the rounding or r.mapcalc is the only solution?
Reclassing a floating-point map is probably a bad idea; it would be
better to use r.mapcalc.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list