[GRASS-user] mapcalc NULL issue

Wolfgang wollez at gmx.net
Thu Jun 8 08:12:06 EDT 2006


out of the manual from r.mapcalc

Example: The users wants the NULL-valued cells to be treated like zeros. 
To add maps A and B (where B contains NULLs) to get a map C the user can 
use a construction like:

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

Cheers
Wolfgang

Carlos "Guâno" Grohmann schrieb:
> Hello all.
> 
> I have two rasters (SRTM_V2), one has data on the continental area,
> with zero values in the ocean. The other (SRTM_30 PLUS) has values for
> all region. I'd like to patch them, using r.mapcalc, like this:
> if srtmv2==0 OR srtmv2==NULL, then use value from srtm30plus, else srtmv2.
> 
> I tried this in mapcalc:
> 
> test=if(A==0||isnull(A), B,A)
> 
> but it didn't work. the result was the same as test=if(A==0, B,A).
> 
> So how can I manage to get the condition for zero and null at the same
> time? I mean, I can do this in a single operation, right? Or do I need
> to make two operations?
> 
> cheers
> 




More information about the grass-user mailing list