[GRASS-user] listing raster maps as input for "i.group"

Stefan Lüdtke sluedtke at gfz-potsdam.de
Tue Nov 4 06:52:27 PST 2014


Hi Umberto,

I used to use it by extending the function with ".keys()", what does
return a list. But there might be smarter way than that.

code:

data_list=grass.parse_command('g.mlist', typ="rast").keys()

type(data_list)


HTH,

Stefan

On 11/04/2014 03:38 PM, umbertofilippo wrote:
> How do I use the output of "g.mlist" as input for another function in
> GRASS 6.4.4 and Python console?
> Here is my specific case: I have to group the list of raster maps that
> begin with "globrad" using "i.group".
> Anyway, my code seems not working, as "i.group" returns an empty dict (
> i.e "{ }").
> Here is my code, any suggestion would be very appreciated:
> 
>     map_list = grass.read_command("g.mlist", type="rast",
> pattern="globrad*",separator=",")
>     group = grass.run_command("i.group", group = "glob_rad", subgroup =
> "glob_rad", input = map_list)
> 
> The first line returns
> 
>     globrad1,globrad2
> 
> which is "string" type, the second line returns { } (empty dictionary).
> 
> Thanks in advance!
>     umberto
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

-- 
Stefan Lüdtke

Section 5.4-  Hydrology
Tel.: +49 331 288 2821
Fax: +49 331 288 1570
Email: sluedtke at gfz-potsdam.de

Helmholtz-Zentrum Potsdam
Deutsches GeoForschungsZentrum GFZ
(GFZ German Research Centre for Geoscience)
Stiftung des öff. Rechts Land Brandenburg
Telegrafenberg, 14473 Potsdam
-------------------

PGP Public Key: http://bit.ly/13d9Sca


More information about the grass-user mailing list