[GRASS-user] Error while applying r.mapcalc to an output from GROW

Greetings

I have created a raster with the r.grow function where I attributted value 1 to the original+growned areas.
From the r.info I obtain the following:
| |
| Type of Map: raster Number of Categories: 9 |
| Data Type: CELL |
| Rows: 6991 |
| Columns: 8171 |
| Total Cells: 57123461 |
| Projection: UTM (zone -24) |
| N: 9305500.00000001 S: 9095770.00000001 Res: 30 |
| E: 689130 W: 444000 Res: 30 |
| Range of data: min = 1 max = 1 |

| Comments: |
| r.grow input="myscript.tmpcloud@National" output="grow02" radius=1 m\ |
| etric="euclidean" old=1 new=1 |

Where I obtain this:

506505.949964|9267207.442575||1|grown cells
or
506782.475461|9265066.600014||*| for the non-grown values

Then I applied this expression:
if( grow02@National ==null(),1,0)

but from this output I obtain only NULLS. Maybe this is a problem related with the output of r.grow. can anyone give me a clue?
Thanks
Antonio

__________ Information from ESET NOD32 Antivirus, version of virus signature database 5567 (20101027) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

António Rocha:

I applied this expression:
if( grow02@National ==null(),1,0)

but from this output I obtain only NULLS.

NULL-values in any arithmetic or logical operation result in NULL [1].
The null() function represents the NULL value, thus a NULL value is
always present in the logical operation "grow02@National == null()"
and the result will always be NULL.

try
if(isnull(grow02@National),1,0)

Markus M

[1] http://grass.osgeo.org/grass64/manuals/html64_user/r.mapcalc.html

Hi
THanks Markus
I sent an email directly to you instead of the mailing list. And I made a mistake in the previous email.
Here goes:

But I still have one question.
In this case I want to transform all pixels that are not myscript.tmpvalid@National ==1 and myscript.tmpcloud@National !=1 to NULL and the rest to the values that exists in raster B1. So I built this function in r.mapcalc

if(( myscript.tmpvalid@National ==1 && myscript.tmpcloud@National !=1),B.1,null())

The thing is:
I gett all NULLS
And If I do:
If I do if(( myscript.tmpvalid@National ==1 && myscript.tmpcloud@National !=1),B.1,1000)
I get 1000 where I don't meet those conditions and, nulls where I suppose to have my B.1. values. B.1 ranges from 0.03 til 0.67
WHat am I doing wrong?

Antonio

and I get all nulls which is wrong
But if I substitute null() by 1000 it goes ok but I need to have these pixels as Nulls
What am I wrong?

__________ Information from ESET NOD32 Antivirus, version of virus signature database 5567 (20101027) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com