[GRASS-user] Replace 0 by NULL in categorial raster map

Johannes Radinger JRadinger at gmx.at
Mon Mar 5 09:56:04 EST 2012


Hi,

-------- Original-Nachricht --------
> Datum: Fri, 02 Mar 2012 20:22:30 +0100
> Von: Moritz Lennert <mlennert at club.worldonline.be>
> An: Johannes Radinger <JRadinger at gmx.at>
> CC: grass-user at lists.osgeo.org
> Betreff: Re: [GRASS-user] Replace 0 by NULL in categorial raster map

> On 02/03/12 15:56, Johannes Radinger wrote:
> > Just for my personal interest two questions: 1) What if I want to
> > replace the category "0" with NULL (not the values 0)
> 
> Category 0 = value 0.
sorry I meant the category named (with label) "0".

> 
> Raster values in GRASS are called categorie values.
> 
> Or maybe I don't understand what you mean ?
> 
> > 2) What would be the correct module if I want to assign another
> > category than NULL to certain values? Is hat module r.category? And
> > how can that be used in pyhton (how are the rules supplied)? Eg.
> > assign all values greater than 0 to 1 all other values NULL.
> 
> If you have a integer values (CELL), then r.reclass.

As I have a CELL raster I'd like to use r.reclass. In my special
case I want to assign a Category labeled "1" to all values 1 and want to replace all 0 by NULL. (No other values present only 0 an 1). For the NULL-task I use r.null, and for the 1-task r.reclass.
But how can I simply use a rule in when calling r.reclass in  a python script???

		grass.run_command("r.reclass",
					input = "in",
					output = "out",
					rules = ???)


/Johannes


> 
> If you have floating point values, generally r.recode is more 
> appropriate (or just multiply your floating point map by the appropriate 
> number to make it integer).
> 
> Moritz

-- 
NEU: FreePhone 3-fach-Flat mit kostenlosem Smartphone!                                  
Jetzt informieren: http://mobile.1und1.de/?ac=OM.PW.PW003K20328T7073a


More information about the grass-user mailing list