Hello Ricardo<div>Thanks for your feedback but the problem is that mapset cannot be used as input.</div><div>Because I got this error:</div><div><div>p=grass.mlist_grouped ('rast', pattern=pattern,</div><div>mapset='PERMANENT')</div>
<div>TypeError: mlist_grouped() got an unexpected keyword</div><div>argument 'mapset'.</div><div>If I avoid using mapset I get a dictionary variable in which, each entry is the list of rasters for each MAPSET.</div>
<div><br></div><div>Am I doing something wrong?</div><div>Thanks</div><div>Jenny</div><br><div class="gmail_quote">On Fri, Mar 11, 2011 at 2:29 PM, Ricardo Filipe Soares Garcia da <span dir="ltr"><<a href="mailto:ricardo.garcia.silva@gmail.com">ricardo.garcia.silva@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Jenny<br>
<br>
Long story short: use your command like this (note the asterisk on the<br>
'pattern' variable):<br>
<br>
# python code<br>
<div class="im">p=grass.mlist_grouped ('rast', pattern='output*', mapset='Mapping')<br>
<br>
<br>
</div>I am using the Ipython shell to script grass. It has a cool feature,<br>
that if you type the name of a function followed by two question<br>
marks, you can see the source code of the function (as long as it is<br>
coded in python itself).<br>
So, in doing:<br>
<br>
grass.mlist_grouped??<br>
<br>
It is possible to see that the mlist_grouped function is internally<br>
calling the 'g.mlist' command with only the 'm' flag.<br>
<br>
Reading the documentation for the g.mlist command [1], I realize that,<br>
without using the -r or -e flags, this command accepts wildcards[2] as<br>
the 'pattern' string. The asterisk (*) is the wildcard character for<br>
substituting for any zero or more characters. So, in order to get a<br>
string that starts with 'output' and after that can have anything, you<br>
just type 'output*'<br>
<br>
<br>
[1] - <a href="http://grass.fbk.eu/grass64/manuals/html64_user/g.mlist.html" target="_blank">http://grass.fbk.eu/grass64/manuals/html64_user/g.mlist.html</a><br>
[2] - <a href="http://en.wikipedia.org/wiki/Wildcard_character#Computing" target="_blank">http://en.wikipedia.org/wiki/Wildcard_character#Computing</a><br>
<div><div></div><div class="h5"><br>
<br>
On Fri, Mar 11, 2011 at 12:10 PM, Jenny Turner<br>
<<a href="mailto:jennyturner1980@gmail.com">jennyturner1980@gmail.com</a>> wrote:<br>
> Greetings<br>
> I'm doing a GRASS Python Script where I need to list a set of raster maps<br>
> but I'm not using its exact name but a basic regular expression (r flag in<br>
> g.mlist function).<br>
> So I want to find a list of rasters with output on its name:<br>
> p=grass.mlist_grouped ('rast', pattern='output', mapset='Mapping')<br>
> But I get null entries because no raster map is named output only output01<br>
> output02 output03 ...<br>
> I want to list all raster maps with output on itsd name. How can I do this<br>
> using grass.mlist_grouped?<br>
> Thanks<br>
> Jenny<br>
</div></div>> _______________________________________________<br>
> grass-user mailing list<br>
> <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
___________________________ ___ __<br>
Ricardo Garcia Silva<br>
</font></blockquote></div><br></div>