<div dir="ltr"><div>Thanks, I did take a look, but obviously not hard enough (btw, clever trick to use grep.. will download the source code so I can use that too).<br><br></div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Jan 31, 2013 at 5:12 PM, Moritz Lennert <span dir="ltr"><<a href="mailto:mlennert@club.worldonline.be" target="_blank">mlennert@club.worldonline.be</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On 31/01/13 16:48, Paulo van Breugel wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  Does anybody has an example grass python script that deals with<br>
multiple layer input? For example with the input option below with #%<br>
multiple set to yes, I would like to create multiple variables, one for<br>
each map.<br>
<br>
#%option<br>
#% key: input<br>
#% type: string<br>
#% gisprompt: old,cell,raster<br>
#% required: yes<br>
#% multiple: yes<br>
#%end<br>
<br>
I am completely new to python, and besides python scripting tutorials<br>
and text books, for me using examples is a great way to accelerate the<br>
learning process. I have looked into the addon repository and scripts in<br>
the GRASS 7 SVN, but haven't found what I was looking for.<br>
<br>
More in general, does anybody have (simple) shell scripts that have now<br>
been converted in python scripts? I thought I had seen a page on the<br>
grass wiki where code snippets in shell and python were compared, but I<br>
can't find it.<br>
</blockquote>
<br></div></div>
You can always look at the scripts in grass7. A quick grep through the directory shows:<br>
<br>
i.spectral/<a href="http://i.spectral.py" target="_blank">i.spectral.py</a><br>
r.buffer.lowmem/<a href="http://r.buffer.lowmem.py" target="_blank">r.buffer.<u></u>lowmem.py</a><br>
r.in.wms/<a href="http://r.in.wms.py" target="_blank">r.in.wms.py</a><br>
v.db.addtable/<a href="http://v.db.addtable.py" target="_blank">v.db.addtable.py</a><br>
v.db.univar/<a href="http://v.db.univar.py" target="_blank">v.db.univar.py</a><br>
v.in.wfs/<a href="http://v.in.wfs.py" target="_blank">v.in.wfs.py</a><br>
v.krige/<a href="http://v.krige.py" target="_blank">v.krige.py</a><br>
<br>
Generally, you should be able to do something like this:<br>
<br>
rastermaps = input.split(',')<br>
<br>
and the access each maps like this:<br>
<br>
my_map1 = rastermaps[0]<br>
<br>
etc<span class="HOEnZb"><font color="#888888"><br>
<br>
Moritz<br>
</font></span></blockquote></div><br></div>