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

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

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.

Do you have 2 equal signs in your logic statment?

David

On 10/3/05, Ed Davison <bfdi533@cbacc-security3.mccombs.utexas.edu> 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

--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA 98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays

On Mon, 2005-10-03 at 15:33 -0700, Ian MacMillan wrote:

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).

That did the trick exactly. I had no idea this one existed and it
worked perfectly.

Per another post, I also determined that the radar=0 should have been
radar==0 which is why I got the all pink result.

Thanks to all for the pointers.

--

--------------------------
Ed Davison