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

Glynn Clements glynn at gclements.plus.com
Thu Mar 1 11:59:30 EST 2012


Moritz Lennert wrote:

> If you want to work in a python script, you have to first run 
> read_command(g.mlist),

You can use mlist_grouped(), but it currently only works with glob
patterns, not regexps. Alternatively, you can use list_grouped,
list_pairs or list_strings and manually filter the result. E.g.:

	import grass.script as grass

	maps = [map
	        for map in grass.list_strings('rast')
	        if map.startswith('rast_') or map.startswith('crast_')]
	maps = ','.join(maps)

	grass.run_command("r.series", input = maps, ...)

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list