[GRASS-user] Get non-NULL cells over multiple rasters

Johannes Radinger JRadinger at gmx.at
Thu Mar 1 08:55:31 EST 2012


Hi,

-------- Original-Nachricht --------
> Datum: Thu, 01 Mar 2012 13:18:30 +0100
> Von: Moritz Lennert <mlennert at club.worldonline.be>
> An: Johannes Radinger <JRadinger at gmx.at>
> CC: GRASS user list <grass-user at lists.osgeo.org>
> Betreff: Re: [GRASS-user] Get non-NULL cells over multiple rasters

> Johannes Radinger wrote:
> > Hi,
> >
> > I have a bunch of raster maps (~50 are named crast_* and 50 are named
> > rast_*). Is there a simple way (eg. using regular expressions) to
> > process them with the mapcalculator to get one resulting map which
> > shows only those cells (value 1) which are non-NULL cell in ALL maps?
> > Like I'd like the cells which all rasters have commonly populated.
> > Maybe there is a simple way to do this in the mapcalculator (or any
> > other modul) resp. in a python script?? Suggestions are mostly
> > welcome. Thanks,
> 
> r.series with the -n flag ? From the man page:
> 
> "With -n flag, any cell for which any of the corresponding input cells 
> are NULL is automatically set to NULL (NULL propagation). The aggregate 
> function is not called, so all methods behave this way with respect to 
> the -n flag."
> 
> See the man page for examples of how to use r.series in conjunction with 
> g.mlist to work with a series of maps.


Thank you very  much, r.series is the right tool for my task. I tried to
use it in combination with g.mlist but somehow I don't manage it. I tried different methods e.g.:

1) in the GRASS command console I typed:
r.series -n input="'g.mlist pattern='rast_*|crast_*' sep=,'" output=Treene_tmp_mask method=count

2) and I tried it in a python script with:
	grass.run_command("r.series",
			input = "'g.mlist pattern='rast_*|crast_*|Treene_raster' sep=,'",
			overwrite=True,
			flags = "n",
			output = "Treene_tmp_mask",
			method = "count")


Probably it has just something to do with the quotation marks but I haven't figured out how to set them correctly.

cheers,
johannes

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