[GRASSLIST:5791] R.reclass and floating point values
Aldo Clerici
alcl01 at ipruniv.cce.unipr.it
Mon Mar 17 06:07:08 EST 2003
Hi to everybody.
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?
Many thanks to anybody.
Aldo Clerici
Dip. Scienze della Terra
Università di Parma
Italy
More information about the grass-user
mailing list