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
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@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@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
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Sorry for being diffuse, but I haven no experience with the i.group
command and how to parse a list to it.
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@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@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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQEcBAEBAgAGBQJUWOoLAAoJEB5GAbKcg+D8XMYH/iG1XXqbta123MoHQC+PEM/0
0SZ+POWiYxz3AXAno89OT62fNp3WRJ0FJBSKkDO3KsBySxqlc5tvLoHpdCM9E52S
e4j7MVi+azCAK00p5r5qkdlC2ShH1Cs9OQHONrhsojisvmGCAEtfrpYAhnsF80Vk
2kIdxkzvW///KTZ/jer2NIKRqDO2t2nKw7PSTCzMt3L/r9J88jpQSNef2svwIdW6
MT58ZxsnvceIrIc9zT8f6evYUJgF+vTO1Eh4IYkOd+ieYLIdEc8D/P/FevgpivCx
QmaL01F9Hgh/8mQ7gA99e8nRd996sFcJqxC6bcegRdxYWkVsaWbqWZO3uM9mzS4=
=Zi8C
-----END PGP SIGNATURE-----