How to create a GRASS GIS in Bash?

How to create a GRASS GIS in Bash?

1. Creating multiple watershed boundaries of different sizes with GRASS and using a basic loop in BASH for the process. 2. Clipping the original raster by the watershed boundaries using GDAL and SQL with a basic loop in BASH. This section will modify the script created in the last post.

How to create a shell script for grass?

Assume you want to create a shell script for GRASS that has two parameters (x and y coordinates) in order to calculate the watershed related to this outlet point ( r.water.outlet ). In shell, the variables $1 $2 and so on are the parameters you pass on to the script.

How to execute GRASS module in GRASS GIS?

Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non-interactive session. Run using a temporary location which is created based on the given coordinate reference system and deleted at the end of the execution (use with the –exec flag). The active mapset will be the PERMANENT mapset.

How to start grass in a non interactive way?

If the GRASS_BATCH_JOB environment variable is set to the full path and filename of a shell script then GRASS will be launched in a non-interactive way and the script will be run. The script itself can be interactive if that is what the user requires.

How to do a loop with grass watersheds?

Loop with GRASS watershed commands: Your outputs this time will be a collection of shapefile watersheds constructed by your threshold value. The watersheds layers are full of nice watersheds, however you cannot simply clip the elevation raster by the full vector file.

How to clip raster by watershed in Bash?

Clipping the original raster by the watershed boundaries using GDAL and SQL with a basic loop in BASH. This section will modify the script created in the last post. Notice in the previous script, when I used r.watershed, I set the threshold value to 100000. You can use this value to set the minimum size of your watershed based on cell units.