[GRASS-user] Get non-NULL cells over multiple rasters
Glynn Clements
glynn at gclements.plus.com
Fri Mar 2 12:02:55 EST 2012
Moritz Lennert wrote:
> Any reason why the solution using splitlines() is not acceptable:
>
> maps=grass.read_command('g.mlist',
> pattern='rast_*|crast_*|Treene_raster', type='rast').splitlines()
No, but it shouldn't be necessary; such fundamental operations should
have dedicated library functions. Ideally, any "query" module should
have a corresponding Python function which returns the information
using appropriate Python data types.
In fact, grass.script.core used to have a function mlist() which would
do this, but for some reason it was removed in r47427.
In r50971 I've added mlist_pairs and mlist_strings (analogous to
list_pairs and list_strings), and added a flag= option to all three;
'r' for basic regexps, 'e' for extended regexps, '' (the default) for
glob patterns.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-user
mailing list