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

Johannes Radinger JRadinger at gmx.at
Fri Mar 2 09:09:47 EST 2012


Hi,

I'd like to replace all values/categories "0" by real NULL values.
Furthermore I want to do that in a Python script. I tried to do it
with mapcalc in the script but then I loose the category labels:


grass.mapcalc("$out= if($in==0,null(),$in)",
				out = "in",
				in = "in")

I am not sure if r.reclass or r.recode can be the right module here?
Anyway if yes, how can they be used with a rule supplied
in the python script (sstdin?). The desired approach should keep the other categories and their labels.

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

Best regards,

/Johannes
-- 
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