[GRASS-user] Mapcalc to replace a range of values

Michael Barton michael.barton at asu.edu
Wed Jul 13 12:41:20 EDT 2011


r.mapcalc 'newmap=if(oldmap>=-0.01 & oldmap<=0.01, 0, oldmap)

You can also use r.recode.

Michael
______________________________
C. Michael Barton 
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ  85287-2402
USA

voice: 	480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)
www: 	http://csdc.asu.edu, http://shesc.asu.edu
		http://www.public.asu.edu/~cmbarton

On Jul 13, 2011, at 9:43 PM, grass-user-request at lists.osgeo.org wrote:

> Date: Wed, 13 Jul 2011 14:10:38 +0100 (BST)
> From: Rebecca Bennett <rabennett at ymail.com>
> Subject: [GRASS-user] Mapcalc to replace a range of values
> To: grass-user at lists.osgeo.org
> Message-ID: <1310562638.15878.YahooMailRC at web28412.mail.ukl.yahoo.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Hello Grass users,
> 
> I have a (hopefully) quick question - I would like to replace all values in a 
> raster that fall in the range -0.01 to 0.01 (i.e. 0.01><-0.01) with 0 but can't 
> quite work out how to express this in mapcalc. 
> 
> 
> Can anyone set me on the right track?
> 
> Thanks for reading,
> Rebecca



More information about the grass-user mailing list