[GRASS-user] mapcalc NULL issue

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

--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

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

OK, i did with:

test=if(A==0|||isnull(A), B,A)

instead of

test=if(A==0|||isnull(A), B,A)

Note the "III" operator

Carlos

On 6/8/06, Wolfgang <wollez@gmx.net> wrote:

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
>

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke