[GRASS5] r.mapcalc and NULL question

Roger S. Miller rgrmill at rt66.com
Mon Jan 15 14:41:58 EST 2001


On Mon, 15 Jan 2001, Markus Neteler wrote:

> Hi there,
>
> maybe a r.mapcalc/NULL FAQ, but I don't get it...
>
> Assume you have a streams map (streams contain values,
> other cells=NULL).
>
> Now I want to add some values *everywhere* using r.mapcalc, but
> it is only added in those cells not containing a NULL value.

Markus,

I guess you probably want the NULL-valued cells to be treated like zeros.
To add maps A and B (where B contains NULLs) to get a map C you can use a
construction like

C=A+if(isnull(B),0,B)

I found a need for this when I used Grass 5 to run the Leicestershire
tutorial, which was written for Grass 4.x.

There's another NULL-related behavior that I find rather annoying.  I
guess that the numerical value of NULL is actually -129.  I constructed a
raster map of water-level changes from a ground water model and found a
band of nulls scattered across the map, wherever the surface passed -129
feet.


Roger Miller
Lee Wilson and Associates


---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list