[GRASS-user] how to add a loop in the graphical modeler

Javier Garcia Prieto fjgarciaprieto at hotmail.com
Sat Jan 6 04:12:22 PST 2024


Hello.
I'm Javier García Prieto from México.

I do exactly the same as you intend to do years ago.

There are 2 ways to do what you want frim my perspective.

1 If you are working in Linux do a bash script to import every raster to grass, then execute your model from that script.

https://thedbadmin.com/how-to-loop-in-bash-linux-shell-script-automation/

https://grasswiki.osgeo.org/wiki/Importing_data#:~:text=Create%20a%20new%20location%20for,raster%20data%20(internally%20using%20GDAL)



2 Use Python to do the same in a way that the script is system agnostic. Once you have aquired your maps in grass use your model as described above.


Greetings from Mexico.


Enviado desde mi LG de Telcel.

------ Mensaje original------
Desde: Victor Lundström via grass-user
Fecha: sáb., 6 ene. 2024 4:17
Para: grass-user;
Cc:
Asunto:[GRASS-user] how to add a loop in the graphical modeler

Hi everyone,

I'm trying the start getting familiar with the graphical modeler as I have a lot of raster operations that I need to automate.
I have 456 raster layers that I (1) want to interpolate using v.surf.bspline, and then (2) export to six different folders, 76 rasters for each.

I have designed the workflow in the graphical modeler using just one layer to see that everything works the way that it should, and it does!
However, I can't for the life of me figure out how to set up a loop so that it can iterate through all the remaining layers. I'm trying my best to
read the manual, but since all of this is new to me, I can't figure out (1) how to add several raster layers. Whenever I use the "add data to model" I can
only add one layer from the drop down list. I also don't know if I need two loops, one for interpolation and then one for the raster export.

I have attached a screenshot that outlines my model. I hope you'll be able to guide me in the right direction!

Best,
Victor
[cid:50d4456d-7068-4914-87ef-b733b6be741a]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20240106/ba3d128b/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 42688 bytes
Desc: image.png
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20240106/ba3d128b/attachment-0001.png>


More information about the grass-user mailing list