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

Moritz Lennert mlennert at club.worldonline.be
Thu Mar 1 07:18:30 EST 2012


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.

Moritz



More information about the grass-user mailing list