[GRASSLIST:808] Re: Eliminating negative values on raster image

Matthew Perry perrygeo at gmail.com
Fri Apr 21 15:39:03 EDT 2006


On 4/21/06, Tim De Chant <dechant at nature.berkeley.edu> wrote:
> I have a raster map with negative values in it that I'd like to
> eliminate.  I know the values should not be negative, and I'd like to
> change any negative value to zero.  I have looked through the map
> calculator (r.mapcalc) to see if I could create an expression that
> would create such a map but haven't had any luck.  Could anyone help
> me out with writing one?  Thanks.


Here's the mapcalc that worked for me for this exact task:

r.mapcalc "new = if(old < 0, 0, old)"



--
Matt Perry
perrygeo at gmail.com
http://www.perrygeo.net




More information about the grass-user mailing list