[GRASSLIST:2487] Re: r.mapcalc question

Andrea Aime aaime at comune.modena.it
Wed Sep 26 08:50:51 EDT 2001


Kevin Slover wrote:
> 
> hello everyone, just a quick question about r.mapcalc to understand
> what is going on right now...
>     I am using the example in the man pages for the command to set map
> values below a certain point to null, and trying to create a mask
> layer.  What I am using is:
> depth2.5 = if(sheetcomb.dem<2.5,null(),2.5)
> 
> when trying to using depth2.5 as a mask, there are 255
> categories...which is not true of course, since I am working with
> elevation/depth data...where are these 255 categories coming from??

Dunno, but you can try to see them with r.report before using
it as a mask. If I remember correctly, however, a mask file
is composed only of 1 and 0...

>  Thanks...
> also, is it possible to use the following command:
> depth2.5 = if(0>sheetcomb.dem<2.5,null(),2.5) ??
> 
> I am trying to basically eliminate heights greater than 0 and less
> than 2.5...

You can try this:
depth2.5 = if(sheetcomb.dem < 2.5 && sheetcomb.dem > 0, null(), 2.5)

and it will eliminate everything between 0 and 2.5. But if you need to
output a mask maybe you may want to to the following:

depth2.5 = if(sheetcomb.dem < 2.5 && sheetcomb.dem > 0, 0, 1)

Hope this helps... best regards
Andrea Aime



More information about the grass-user mailing list