Unit 08 - Modeler

The Graphical Modeler allows creating, editing, and managing complex models in an easy-to-use graphical user interface. Using the Graphical Modeler, a chain of tools (ie. GRASS modules) can be wrapped into one process (a model). A model can be executed repeatedly with slightly different inputs or parameters.

Our first model will be based on Unit 05 - Raster processing. Actually the model will perform two operations:

  1. set mask based on vector cloud mask file (r.mask) and
  2. compute NDVI (i.vi)

Graphical Modeler can be launched from menu File ‣ Graphical modeler or by grass-modeler-main Graphical Modeler from the main toolbar (or alternatively as g.gui.gmodeler module from console).

../_images/gmodeler.png

Fig. 54 Graphical Modeler.

GRASS tools can be added to the model from menu Model ‣ Add command or by grass-module-add Add GRASS tool (module) to model from the main toolbar.

../_images/add-module.png

Fig. 55 Add GRASS tool (module) to model, in this case r.mask.

After adding r.mask module to the model let’s open its properties dialog by double-click and enter vector map to be used as a mask. Don’t forget to enable inverse mask by -i flag in Create tab.

../_images/module-props.png

Fig. 56 Define parameters for r.mask, a vector map used for creating a mask.

In similar way will be added to model i.vi tool. Properties dialog for this command is open automatically because there are required options which must be set.

../_images/model-v1.png

Fig. 57 NDVI model version 1.

It’s a good idea to set metadata for the model and enable overwriting data produced by model (Model ‣ Model properties).

../_images/model-v1-props.png

Fig. 58 Define model properties and enable overwriting data produced by model.

../_images/model-v1-req-display.png

Fig. 59 Set the output raster map to be automatically displayed in the map window.

Now let’s run our model by grass-execute Run model. Progress is printed into Command output.

../_images/model-v1-output.png

Fig. 60 Model computation progress.

../_images/model-v1-display.png

Fig. 61 NDVI raster map computed by the modeler.

Task

Run the model repeatedly using different computation regions.

Tip

Current computation region can be changed easily by Set computation region extent interactively from grass-zoom-more Various zoom options in Map Display.

../_images/model-v1-region.png

Fig. 62 Change computation region before running the modeler.

Important

Before changing the region it’s a good idea to remove mask if exists.

r.mask -r

Sample model to download: ndvi-v1.gxm