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 (&#39;rast&#39;, pattern=pattern,</div><div>mapset=&#39;PERMANENT&#39;)</div>
<div>TypeError: mlist_grouped() got an unexpected keyword</div><div>argument &#39;mapset&#39;.</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">&lt;<a href="mailto:ricardo.garcia.silva@gmail.com">ricardo.garcia.silva@gmail.com</a>&gt;</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>
&#39;pattern&#39; variable):<br>
<br>
# python code<br>
<div class="im">p=grass.mlist_grouped (&#39;rast&#39;, pattern=&#39;output*&#39;, mapset=&#39;Mapping&#39;)<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 &#39;g.mlist&#39; command with only the &#39;m&#39; 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 &#39;pattern&#39; 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 &#39;output&#39; and after that can have anything, you<br>
just type &#39;output*&#39;<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>
&lt;<a href="mailto:jennyturner1980@gmail.com">jennyturner1980@gmail.com</a>&gt; wrote:<br>
&gt; Greetings<br>
&gt; I&#39;m doing a GRASS Python Script where I need to list a set of raster maps<br>
&gt; but I&#39;m not using its exact name but a basic regular expression (r flag in<br>
&gt; g.mlist function).<br>
&gt; So I want to find a list of rasters with output on its name:<br>
&gt; p=grass.mlist_grouped (&#39;rast&#39;, pattern=&#39;output&#39;, mapset=&#39;Mapping&#39;)<br>
&gt; But I get null entries because no raster map is named output only output01<br>
&gt; output02 output03 ...<br>
&gt; I want to list all raster maps with output on itsd name. How can I do this<br>
&gt; using grass.mlist_grouped?<br>
&gt; Thanks<br>
&gt; Jenny<br>
</div></div>&gt; _______________________________________________<br>
&gt; grass-user mailing list<br>
&gt; <a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
&gt;<br>
&gt;<br>
<font color="#888888"><br>
<br>
<br>
--<br>
___________________________ ___ __<br>
Ricardo Garcia Silva<br>
</font></blockquote></div><br></div>