[GRASS-user] How to rescale

Moritz Lennert mlennert at club.worldonline.be
Wed Jan 11 07:51:58 EST 2012


On 09/01/12 20:42, leonidas wrote:
> I created a raster using *r.grow.distance*
> I need to rescale that file to a scale 0-255 but in reverse order where high
> values in distance file will be converted in low values to the rescaled
> file.
> I'm using the following command:

 >r.recode input=dist_file output=recoded_file <<EOF
 >0:133000:255:0
 >EOF

[BTW: I don't know how you formatted your mail, but for me the above 
three lines showed as:

> *
> *


> But the output file has a range 60-255
> What's going wrong?
> Is there any better way to do that?

Are you sure that 133000 is the max of your map in the region you are 
using ? Be aware that r.info gives the info for the whole map, ignoring 
region settings and a possible mask. You can use r.univar or r.stats to 
see the max in the current region/mask.

Moritz


More information about the grass-user mailing list