[GRASS-user] MASK does not do it's work (?) with r.mapcalc

Salut!

I can't explain why the MASK does not affect any
"r.mapcalc" operations any more!

Whatever I do, with a MASK present, the results look like
there is no MASK.

Any "secret" options... (?).

Thank you in advance,

Nikos

OK... I am confused!

(An example) With r.mapcalc I create:

(a) NDVIDIFF0 based on "if(NDVIDIFF > 0, StudyArea_Raster,
null())"

{ Data type and r.describe of NDVIDIFF0: CELL, * 1-23 25-30
32-42 }

(b) and NDVIDIFF0_fromNDVI based on "if(NDVIDIFF > 0,
NDVIDIFF, null())"

{ Data type and r.descrive of NDVIDIFF0_fromNDVI: DCELL, *
0.000000-0.636731 0.642682-0.702189 0.714091-0.743845
0.749795-0.755746
[...]
1.309167-1.315117 1.315117-1.321068 1.451985-1.457936
1.511492-1.517443 }

Creating the MASK with r.mask or with r.mapcalc=MASK based
on (a) is always successful. Creating the MASK with (b) is
not what I expect and, in addition, it gives different
results when using r.mapcalc MASK=... instead of r.mask.

Do the DCELL values of (b) affect the process... ?

Thank you,

Nikos.

I still can't explain why I can't create a mask with the following raster:

+----------------------------------------------------------------------------+
| Layer: NDVI20060.35 Date: Tue Jan 22 13:53:02 2008
|
| Mapset: nik Login of Creator: nik
|
| Location: Peloponnese_HGRS87
|
| DataBase: /home/nik/grassWorks/Peloponnese_DamageAssessment2007
|
| Title: ( NDVI20060.35 )
|
| Timestamp: none
|

|----------------------------------------------------------------------------|
|
|
| Type of Map: raster Number of Categories: 255
|
| Data Type: DCELL
|
| Rows: 1048
|
| Columns: 972
|
| Total Cells: 1018656
|
| Projection: Transverse Mercator
|
| N: 4255830 S: 3993750 Res: 250.07633588
|
| E: 468810 W: 225720 Res: 250.09259259
|
| Range of data: min = 0.001304 max = 0.349991
|
|
|
| Data Description:
|
| generated by r.mapcalc
|
|
|
| Comments:
|
| if((NDVI2006 > 0 && NDVI2006 < 0.350000), NDVI2006, null())
|
|
|

+----------------------------------------------------------------------------+

Whenever I "r.mask input=NDVI20060.35" or with "rmapcalc MASK=NDVI20060.35",
I get nothing when I try to view or to use r.mapcalc on others rasters.

Any ideas about this?

Thank you,

Nikos
--
View this message in context: http://www.nabble.com/MASK-does-not-do-it's-work-(-)-with-r.mapcalc-tp14407246p15018501.html
Sent from the Grass - Users mailing list archive at Nabble.com.

On 22/01/08 14:22, Nikos Alexandris wrote:

I still can't explain why I can't create a mask with the following raster:

+----------------------------------------------------------------------------+
| Layer: NDVI20060.35 Date: Tue Jan 22 13:53:02 2008 |
| Mapset: nik Login of Creator: nik |
| Location: Peloponnese_HGRS87 |
| DataBase: /home/nik/grassWorks/Peloponnese_DamageAssessment2007 |
| Title: ( NDVI20060.35 ) |
| Timestamp: none |

|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 255 |
| Data Type: DCELL |
| Rows: 1048 |
| Columns: 972 |
| Total Cells: 1018656 |
| Projection: Transverse Mercator |
| N: 4255830 S: 3993750 Res: 250.07633588 |
| E: 468810 W: 225720 Res: 250.09259259 |
| Range of data: min = 0.001304 max = 0.349991 |
| |
| Data Description: |
| generated by r.mapcalc |
| |
| Comments: |
| if((NDVI2006 > 0 && NDVI2006 < 0.350000), NDVI2006, null()) |
| |

+----------------------------------------------------------------------------+

Whenever I "r.mask input=NDVI20060.35" or with "rmapcalc MASK=NDVI20060.35",
I get nothing when I try to view or to use r.mapcalc on others rasters.

Any ideas about this?

Maybe the value of the MASK map has to be 1 ? I see that your MASK varies from 0.001304 to 0.349991.

Moritz

Thank you for the attention Moritz.

I understand MASK as a boolean map with (let's say) "1"
(for true) and "0" (for false).

The r.info (the one I provided in my previous e-mail) is
about the raster data I want to use to create a MASK and
not the MASK itself.

Should I understand that only "integer" raster data are
suitable to create a MASK?

I understand (reading the r.mapcalc functionality) that one
can use any kind of raster data (floating point) and create
a MASK which contains a "1" for the pixels that have any
value besides "NULL".

So I expected to have a "1" wherever there was a value in
my NDVI2006 file.

Maybe I use it wrong(?)

Should I specify to assign a value of "1" for all non-NULL
source pixels?

I'll try with "mask = a != 0" as described in the r.mapcalc
manual.

Thanks,

Nikos

nikos.alexandris@felis.uni-freiburg.de wrote:

Thank you for the attention Moritz.

I understand MASK as a boolean map with (let's say) "1"
(for true) and "0" (for false).

The r.info (the one I provided in my previous e-mail) is
about the raster data I want to use to create a MASK and
not the MASK itself.

Should I understand that only "integer" raster data are
suitable to create a MASK?

The mask is read as an integer map. If MASK is actually a
floating-point map, the values will be converted to integers using the
map's quantisation rules (this defaults to round-to-nearest, but can
be changed with r.quant).

Your NDVI20060.35 map has a range of 0.001304 to 0.349991, so all of
those values will be rounded to zero.

I understand (reading the r.mapcalc functionality) that one
can use any kind of raster data (floating point) and create
a MASK which contains a "1" for the pixels that have any
value besides "NULL".

So I expected to have a "1" wherever there was a value in
my NDVI2006 file.

Maybe I use it wrong(?)

Should I specify to assign a value of "1" for all non-NULL
source pixels?

I'll try with "mask = a != 0" as described in the r.mapcalc
manual.

If you want to create a mask based upon null/non-null, use e.g.:

  r.mapcalc "MASK = !isnull(inmap)"

--
Glynn Clements <glynn@gclements.plus.com>

Thanks for the important clarification.

Do you think it would be useful to add this information in the manual of
r.mask?

On Wed, 2008-01-23 at 04:18 +0000, Glynn Clements wrote:

nikos.alexandris@felis.uni-freiburg.de wrote:

> Thank you for the attention Moritz.
>
> I understand MASK as a boolean map with (let's say) "1"
> (for true) and "0" (for false).
>
> The r.info (the one I provided in my previous e-mail) is
> about the raster data I want to use to create a MASK and
> not the MASK itself.
>
> Should I understand that only "integer" raster data are
> suitable to create a MASK?

The mask is read as an integer map. If MASK is actually a
floating-point map, the values will be converted to integers using the
map's quantisation rules (this defaults to round-to-nearest, but can
be changed with r.quant).

Your NDVI20060.35 map has a range of 0.001304 to 0.349991, so all of
those values will be rounded to zero.

> I understand (reading the r.mapcalc functionality) that one
> can use any kind of raster data (floating point) and create
> a MASK which contains a "1" for the pixels that have any
> value besides "NULL".
>
> So I expected to have a "1" wherever there was a value in
> my NDVI2006 file.
>
> Maybe I use it wrong(?)
>
> Should I specify to assign a value of "1" for all non-NULL
> source pixels?
>
> I'll try with "mask = a != 0" as described in the r.mapcalc
> manual.

If you want to create a mask based upon null/non-null, use e.g.:

  r.mapcalc "MASK = !isnull(inmap)"

--
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany

Glynn:

> The mask is read as an integer map. If MASK is actually a
> floating-point map, the values will be converted to integers using
> the map's quantisation rules (this defaults to round-to-nearest,
> but can be changed with r.quant).

Nikos Alexandris wrote:

Thanks for the important clarification.

Do you think it would be useful to add this information in the manual
of r.mask?

already added to the MASK section of the 2D-raster intro help page in
6.3svn. It makes some sense to add it to the r.mask help page too.

H

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Nikos Alexandris wrote:

Thanks for the important clarification.

Do you think it would be useful to add this information in the manual
of r.mask?

already added to the MASK section of the 2D-raster intro help page in
6.3svn. It makes some sense to add it to the r.mask help page too.
H

r.mask help page updated in svn trunk and grass63_release branch.

~ Eric.

Folks,

(with all the respect) the GRASS community is a phenomenon!

Cheers,

Nikos.

On Wed, 2008-01-23 at 09:24 -0500, Patton, Eric wrote:

Nikos Alexandris wrote:
>> Thanks for the important clarification.
>>
>> Do you think it would be useful to add this information in the manual
>> of r.mask?

>already added to the MASK section of the 2D-raster intro help page in
>6.3svn. It makes some sense to add it to the r.mask help page too.
>H

r.mask help page updated in svn trunk and grass63_release branch.

~ Eric.

--
Nikos Alexandris
.
Department of Remote Sensing & Landscape Information Systems
Faculty of Forestry & Environmental Sciences, Albert-Ludwigs-University Freiburg
.
Tel. +49 (0) 761 203 3697 / Fax. +49 (0) 761 203 3701 / Skype: Nikos.Alexandris
.
Address: Tennenbacher str. 4, D-79106 Freiburg i. Br., Germany