# Graphical Modeler¶

Graphic Modeler (g.gui.gmodeler) allows the user to create, edit, and manage complex models using easy-to-use interface. Using Graphical Modeler, that chain of processes (ie. GRASS modules) can be wrapped into one process (ie. model). So it's easier to execute the model later with slightly different inputs or parameters.

## Flooding Model Example¶

In our example will be created a model to simulate flooding using r.lake (see Lesson 2). The model will also print flooded area in hectares (r.report) and output a new vector map containing flooded roads (v.overlay). This step requires to create vector map of flooded area using r.recode and r.to.vect. The length of flooded roads can be printed using v.to.db.

### Version 1¶

Figure 1: First version of the flooding model.

Figure 2: Example of output (water level: 990).

### Version 2¶

Our model uses hardcoded values. In the second version we will show how to parametrize water_level option.

Figure 3: Module options can be parametrized directly in GUI dialogs.

The modified model will ask user before launching for parametrized options, in our case for water_level, see figure below.

Figure 4: Dialog of parametrized options.

For example increasing water level from 990 to 995 leads to flooded area 1.43 ha and road length 169 m.

### Version 3¶

The model overwrites output data. We will modify the model to create output raster lake map and clipped roads map for each value separately. Eg. for water level 990 will create modified model lake_990 and roads_lake_990 maps, for level 995 lake_995 and roads_lake_995, etc. This modification will be implemented in the modeler using variables. Firstly we disable parametrization of water_level and then we will add a new variable water_level, see figure below.

Figure 5: Adding new variable to the model.

Afterwards we must modify all modules which should use this variable. In our case:

Figure 6: Modification of lake option (r.lake).

Figure 7: Modification of expression option (r.mapcalc).