[GRASSLIST:8473] Re: converting raster value of 0 (black) to null

Ian MacMillan ian_macmillan at umail.ucsb.edu
Mon Oct 3 18:33:22 EDT 2005


Ed, you can try this.  First, I think you need to put quotes around 
your if statement.  The command line is probably choking on the 
parentheses.  So instead of

> radarnew=if(radar=0,null(),radar)
try
r.mapcalc radarnew = 'if(radar=0, null(),radar)'

Or you could just use r.null (designed specifically for your purpose).

Cheers,
-Ian

On Oct 3, 2005, at 2:42 PM, Ed Davison wrote:

> I have a radar map that has a 0 value for black.  This came from a
> grayscale GeoTIFF.
>
> I need to convert the 0 value to null so that I can overlay it onto a
> base map.
>
> I have tried using mapcalc with the following:
>
> radarnew=if(radar=0,null(),radar)
>
> but this produces a magenta raster map with no other data in it.
>
> r.mapcalc is very new to me and I cannot seem to make heads of tails of
> how to do this from reading the man page.  Any pointers would be great.
>
>
> -- 
>
> --------------------------
> Ed Davison
>
>
 >
 >
What happens if a big asteroid hits Earth? Judging from realistic 
simulations involving a sledge hammer and a common laboratory frog, we 
can assume it will be pretty bad.
  - Dave Barry


-------------------------------------------------------------
This message has been scanned by Postini anti-virus software.




More information about the grass-user mailing list