3. QGIS Plugin

3.1. Introduction

The 3Di Toolbox is a QGIS plugin for working with 3Di models and netCDF results. The newest plugin (release of March 4th) is only supported by QGIS 3.4.5. An older version of the plugin will remain available for QGIS 2.18. For more information on installing the plugin see 3Di Toolbox plug-in. For more information on viewing and editing 3Di models in QGIS see Adjusting the 3Di model database in QGIS). The section below explains the use of the water balance tool and the raster checker. More subjects will be added soon, as these are only a few of the features of the 3Di Toolbox.

3.2. Water Balance Tool

The water balance tool computes the water balance in a sub-domain of your model. It uses the incoming and outgoing flows in that domain and visualizes the various contributions of the flow in graphs. The development was an initiative of Deltares and jointly developed with Nelen & Schuurmans. The water balance tool is co-funded by the Top Sector Water (Ministry of Economic Affairs)

3.2.1. Activating the water balance tool

The water balance tool is activated by clicking the balance icon in the 3Di-Toolbox bar.

3Di Toolbox Bar

To be able to use the water balance tool, aggregated results are required for a range of variables. This to ensure, that the shown water balance is consistent and complete. In case, the aggregated results are missing or incomplete the following error pops up:

Error no aggregation settings

The aggregation settings can be found and configured in the splt-table v2_aggregation_settings. For more information on the aggregation settings, see Aggregated output. The default settings for the water balance tool are listed below.

Aggregation settings for water balance tool
id timestep var_name aggregation_in_space aggregation_method flow_variable
1 300 pump_discharge_cum FALSE cum pump_discharge
2 300 lateral_discharge_cum FALSE cum lateral_discharge
3 300 simple_infiltration_cum FALSE cum simple_infiltration
4 300 rain_cum FALSE cum rain
5 300 leakage_cum FALSE cum leakage
6 300 interception_current FALSE current interception
7 300 discharge_cum FALSE cum discharge
8 300 discharge_cum_neg FALSE cum_negative discharge
9 300 discharge_cum_pos FALSE cum_positive discharge
10 300 volume_current FALSE current volume
11 300 qsss_cum_neg FALSE cum_negative surface_source_sink_discharge
12 300 qsss_cum_pos FALSE cum_positive surface_source_sink_discharge

Of course, the time step, cq, the period over which is aggregated, is adjustable. For new models, these settings are included in the empty spatialite database (Empty database). For existing models, these settings must be added to the v2_aggregation_settings -table. These SQL queries will help you in doing so:

Empty v2_aggregation_settings table:

DELETE FROM v2_aggregation_settings;

Add aggregation settings one by one:

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (1, 9999, 'pump_discharge_cum', 'pump_discharge', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (2, 9999, 'lateral_discharge_cum', 'lateral_discharge', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (3, 9999, 'simple_infiltration_cum', 'simple_infiltration', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (4, 9999, 'rain_cum', 'rain', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (5, 9999, 'leakage_cum', 'leakage', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (6, 9999, 'interception_current', 'interception', 'current',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (7, 9999, 'discharge_cum', 'discharge', 'cum',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (8, 9999, 'discharge_cum_neg', 'discharge', 'cum_negative',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (9, 9999, 'discharge_cum_pos', 'discharge', 'cum_positive',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (10, 9999, 'volume_current', 'volume', 'current',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (10, 9999, 'qsss_cum_pos', 'surface_source_sink_discharge', 'cum_positive',
                        'FALSE', 300);

INSERT INTO v2_aggregation_settings(
                        id, global_settings_id, var_name, flow_variable, aggregation_method,
                        aggregation_in_space, timestep)
        VALUES (10, 9999, 'qsss_cum_neg', 'surface_source_sink_discharge', 'cum_negative',
                        'FALSE', 300);

Note, that in both cases, in case of a new model or an existing model, you must update the global settings id to the id of the scenario for which you wish to generate aggregated results. For multiple scenarios, you must add these settings multiple times (and update row id’s). Also, you may choose to change the aggregation time step, but make sure to use the same time step for all aggregation variables in case one wants to use the water balance tool.

3.2.2. Using the water balance tool

In a few steps, one can get insight in the water balance of their own system.

  1. Define a splt and the results that are to be analysed.
  2. Draw a polygon to define the domain of the model for the area of interest. This can be done by clicking at multiple locations within the model domain. Click Finalize polygon to finish the polygon. The graph shows the water balance over time for the selected area.
  3. By right-clicking the graph, a menu appears in which the range of the x-axis and y-axis can be adjusted. The visible x-axis determines the period over which the water balance is calculated.

4 ) The button Hide on map the polygon over which the water balance is calculated is hidden.

Draw polygon to define water balance area

3.2.3. Display settings

The different colours show the different flow types, explained in the legend on the right. By hovering over a flow type in the legend, the corresponding plane lights up in the graph and the corresponding flow lines will be marked with red dotted lines in the map of the model. The different flow types can be activated and deactivated in the graph by clicking the box next to the flow type name. All flow types can be activated or deactivated using the buttons activate all and deactivate all.

Marked flow types

In the water balance menu different display options can be chosen. In the first drop-down menu (default = ‘1d and 2d’) you can choose to display only 1D-flow (‘1d’) or 2D-flow (‘2d’) or both (‘1d and 2d’). In the second drop-down menu (default = ‘everything’) you can choose to display all flows (‘everything’) or only the main flows (‘main flows’). In the last drop-down menu (default = ‘m3/s’) you can choose to display flow (‘m3/s’) or cumulative volume (‘m3’).

Note: the different flow types are ‘stacked’ in the graph. This means the flow volumes are added to each other when activating multiple flow types.

Volume change is shown in the graph as well. In this case, the volume change is the result of the total positive and negative flow (inflow and outflow of the area). The volume change is not stacked but shown as a separate line in the graph.

3.2.4. Total balance

By clicking the button Show total balance a new screen will pop-up, showing the total volume balance over the period set on the x-axis of the graph (shown in title). To adjust this period, close the screen with the bar diagrams, right click on the water balance graph, open the option x-axis, activate the option manual and set the minimum and maximum time. Then, click again on Show total balance to create the water balance diagrams for the new time range. The diagrams can be edited by clicking the graph button at the top. A menu pops-up in which you can choose which diagram you want to edit. Click OK to proceed to the Figure options-menu. Under the tab Axes the ranges and labels for the axes can be set. Under the tab Curves the layout of the lines in the graph can be changed. The diagrams can be saved as image by clicking the save-button at the top.

The top diagram shows the net water balance from all domains. The bottom diagrams show the water balance per domain.

Total balance

3.2.5. Explanation of flow types

In the overviews the flow is split in several domains. These distinguish themselves based on how the flow is computed. Therefore, you will find the 2D flow, groundwater and the 1D flow domain. Below a more detailed doscription of the various components.

2D Surface water domain

  • 2D Boundary flow: Inflow and outflow through 2D boundaries
  • 2D Flow: Inflow and outflow in the surface domain crossing the borders of the polygon
  • Lateral flow to 2D: Sources or sinks based on 2D laterals
  • 2D: 2D flow to 1D: Flow exchange between the 2D surface domain and the 1D network elements within your polygon (for example, surface run-off from rain into a 1D-channel or water that overflows the banks in your channel).
  • 2D: 2D flow to 1D (domain exchange): Flow exchange between the 2D surface domain and the 1D network elements crossing the borders of your polygon
  • In/exfiltration (domain exchange): Flow exchange between the 2D surface domain and the 2D groundwater domain
  • Rain: Incoming water from rain
  • Constant infiltration: Flow out of the 2D domain based on simple infiltration
  • interception: Intercepted volume

2D Groundwater domain

  • Groundwater flow: Inflow and outflow through the 2D groundwater domain crossing the borders of your polygon
  • In/exfiltration (domain exchange): Flow exchange between the 2D surface domain and the 2D groundwater domain (generally inflowing water through infiltration).
  • leakage: sources or sinks based on leakage

1D Network domain

  • 0D rainfall runoff on 1D: Inflow volume from 0D module
  • 1D Boundary flow: Inflow and outflow over a 1D boundary
  • 1D Flow: Inflow and outflow in 1D network elements crossing the borders of your polygon
  • 1D Laterals: Sources and sinks based on 1D laterals
  • 1D: 2D flow to 1D: Flow exchange between the 2D surface domain and the 1D network elements (e.g. surface runoff from rain into a 1D-channel) within your polygon
  • 1D: 2D flow to 1D (domain exchange) Flow exchange between the 2D surface domain and the 1D network elements crossing the borders of your polygon
  • Pump: pumped volume

3.3. Toolbox for working with 3Di models

The 3Di toolbox is actived by clicking the toolbox icon in the 3Di-Toolbox bar.

3Di Toolbox Bar

After clicking the toolbox icon, a new window in QGIS is opened. Click the arrow next to the Tools icon to open the toolbox and view the different tools that are available. In time, the descriptions of the various tools will be explained.

Toolbox Window

3.3.1. Rasterchecker

The Rasterchecker is launched with the QGIS 3.4.5 version of the Plugin. It is a tool to check the rasters that are used in your 3Di model for consistency. The tool verifies for example

  • The correct nodata value
  • Consistent projection
  • That all rasters are aligned

There are up to 18 checks performed. They are listed below. It is strongly recommended to run this tool before updating the model repository. It will model as it will crash when it encounters any errors in your rasters. It will prevent a failed input generation.

Before the Rasterchecker can be used, you first need to make a connection with the SQlite of your model. This can be done by opening the Data Source Manager under the drop down menu Layer on top of the screen. Go to SpatiaLite and click New. Browse to the location of your model Sqlite and open it. Now you can close the Data Source Manager window.

Data Source Manager

The Rasterchecker can be accessed by opening the Toolbox. The Rasterchecker can be found under Step 1 - Check data. By double clicking raster_checker.py the Rasterchecker is opened in a seperate window. Under Model schematisation database you can choose the spatialite of your model. Under Options you can choose for 2. Compare pixel alignment as an additional check. The Compare pixel alignment-check verifies whether the pixels of the used rasters are exactly on top of each other. This is necessary to run a 3Di model. Click OK to start the rasterchecker. When the tool is finished the following message pops up:

Rasterchecker Done

The log-file of the rasterchecker can be found at the same location as the location of the SQlite. The log-file can be opened with a text editor such as Notepad. The log-file looks similar to:

Rasterchecker Done

The various raster characteristics that are verified are numbered 1 to 18. When we refer to this number, it is called check_id.

Under subheading ‘Found following raster references’ the rasters used in your model are stated.

Further down in the log-file, the information for each raster is listed. The first column (level) shows the importance of the notification (info, warning or error). The second column (setting_id) shows the id of the row in the v2_global_settings table of the SPLT, where the raster reference can be found. The third column contains the check_id. The fourth column (feedback) shows the outcome of the check.

Rasterchecker Feedback

If one of your rasters is not aligned with the DEM, check_id 18 will give an error. Make sure all your rasters have the same extent and and have nodata pixels at the same location.