[GRASS-user] r.mapcalc and us of max value

Markus Neteler neteler at osgeo.org
Fri Apr 26 01:29:02 PDT 2013


On Thu, Apr 25, 2013 at 6:27 PM, Micha Silver <micha at arava.co.il> wrote:
> MAX=`r.univar -g map=<your raster> | grep max | cut -d '=' -f 2`
> r.mapcalc "newrast = myrast*100/$MAX"

Even easier:

GRASS 6.4.3svn (nc_spm_08):~ > eval `r.univar -g elevation`
GRASS 6.4.3svn (nc_spm_08):~ > echo $max
156.329864501953
GRASS 6.4.3svn (nc_spm_08):~ > r.mapcalc "newrast = myrast * 100.0 / $max"

Note that I wrote 100.0 for floating point arithmetics.

If you really want r.info, then likewise with:

GRASS 6.4.3svn (nc_spm_08):~ > eval `r.info -gr elevation`

markusN


More information about the grass-user mailing list