undocumented functions in r.mapcalc (GRASS5) !!

Markus Neteler neteler at geog.uni-hannover.de
Thu Nov 18 06:38:24 EST 1999

Dear GRASS community,

maybe I am the last who realizes some undocumented functions
in GRASS 5 - r.mapcalc tool, but I wanted to tell you about:

New function:
 mode(x,y[,z...])         mode value of those listed
 isnull(x)                check if NULL

Coding of NULL (no data):

New internal variables:
 row()   current row of moving window
 col()   current col of moving window
 x()     current x-coordinate of moving window
 y()     current y-coordinate of moving window
 ewres() current east-west resolution
 nsres() current north-south resolution

Now really powerful applications can be programmed
using r.mapcalc.

Example for checking coordinates (German system here):

 newmap = if((x() < 3770000) && y() < 5770000), map, null())

 -> keep value of map if smaller than specified coordinates,
    else set "no data"

Check for NULL and replace it:
  newmap = if(isnull(map),55,map)"

 -> if NULL then 55 else keep value

I am grateful to the programmers of r.mapcalc for including
these features in GRASS 5!

Best regards

 Markus Neteler

More information about the grass-user mailing list