[GRASS-user] Re: Command to summarize the frequency distribution
table
Glynn Clements
glynn at gclements.plus.com
Sun Dec 21 12:54:56 EST 2008
SGW00412 at nifty.com wrote:
> Thank you useful and kind advice.
> Sorry, please give advice to me a little more.
>
> I tried the re-classification by using r.reclass method in the raster map of the
> probability distribution.
> I want to classify it at 0.1 intervals. So I wrote text files as follows:
> -----------
> 0.0 thru 0.1=0 A
> 0.1 thru 0.2=2 B
> 0.3 thru 0.4=3 C
> 0.4 thru 0.5=4 D
> ....
> 0.9 thru 1.0=10 J
> end
> -----------
>
> then, I saved as probability_class.txt
>
> r.reclass input=old_rast_map output=new_rast_map < probability_class.txt
>
> then, following massage printed out on display:
> -----
> 0.500000 rounded up to 0
> 0.600000 rounded up to 0
> Why ? What's happened ?
> I do not understand the cause not appropriately classified.
Reclass maps only work for integers (they are implemented by looking
up the original cell values in an array, and you can't use
floating-point values as array indices).
You can use r.recode to generate a new map using a piecewise-linear
mapping. The category labels need to be set separately using
r.category.
Alternatively, if the intervals are equally spaced, you could generate
an integer version by scaling, e.g.:
r.mapcalc 'newmap = int(oldmap * 10)'
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list