TUFLOW QGIS Plugin
Introduction
This page describes the process of running the TUFLOW QGIS plugin. At this stage it is still a beta and once we have tested it further it will be made available for the official QGIS repository... Please report any issues or feedback to support@tuflow.com.
The plugin is available for version 2.x, a previous version was available for QGIS 1.8, however, this is no longer being actively developed.
Prerequisites
The plugin uses the following python modules which may need to be separately installed. These may have been installed with other software, to check if they are installed on your machine, you can install the plugin (see instructions below) and check that the required dependencies are installed. To do this run TUFLOW > About > Check Python Dependencies Installed from the menu. All going well you will get a notification to tell you that the required modules are installed. If not, you will be notified if you need to install either of the the python modules below:
Please ensure QGIS / python is installed before installing the below.
- numpy (see http://sourceforge.net/projects/numpy/files/NumPy/1.6.1/numpy-1.6.1-win32-superpack-python2.7.exe/download)
- matplotlib (see http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.1.0/matplotlib-1.1.0.win32-py2.7.exe/download)
A number of other python modules are required, however, these should be installed with QGIS / python.
Installation of Plugin
-
To enable the plugin please follow the instructions below:
- Make sure you have QGIS installed and the prerequisites installed (see above).
- Download the plugin, from the GitHub repository a direct link to the zip file is: https://github.com/TUFLOW-Support/QGIS-TUFLOW-Plugin/archive/master.zip
- Extract the zip file and then copy or move the "TUFLOW" folder into your QGIS plugin directory. This should be "C:\Users\<username>\.qgis2\python\plugins"
- Open QGIS and from the menu select Plugins >> Manage and Install Plugins.... In the manager, find the plugin "TUFLOW" and select the check box to enable the plugin. 300px
- Once enabled the plugin should be accessible from the Plugin >> TUFLOW menu item: File:QgisTuflow Menu.jpg
Usage
- Step 1 is to check that the required dependencies are installed. To do this run TUFLOW > About > Check Python Dependencies Installed from the menu. All going well you will get a notification to tell you that the required modules are installed.
- The next step is to configure a TUFLOW project. This is project dependent and stores the location of the TUFLOW executable, working directory and projection. This can be accessed from TUFLOW > Editing > Configure TUFLOW Project.
This saves the information in the QGIS project. This information is used later, for example when you use the Run TUFLOW, the utility defaults to running the most recent .tcf file in the specified TUFLOW directory, defined at this step.
Note: The location specified, should be the folder that contains (or will contain) the TUFLOW folder. For example if the TUFLOW directory is "L:\Projects\Dummy\Modelling\TUFLOW\" then "L:\Projects\Dummy\Modelling\" should be defined in this dialogue. - After configuring the project ensure you save your project.
Create TUFLOW directory
The first step in creating a TUFLOW model is typically to create a TUFLOW directory structure, define a projection file and run TUFLOW to create the empty (template) TUFLOW files. This can be done in a single step using the TUFLOW > Editing > Create TUFLOW directory tool.
400px
The TUFLOW folder will be created under this location. If the "Run TUFLOW to create empties" is checked, after creating the folder structure, a TUFLOW simulation will be started which creates the empty (template) files under the "TUFLOW\model\gis\empty\" folder.
Import Empty File
This tool will grab a default TUFLOW type (e.g. 1d_bc or 2d_zsh) copy this from TUFLOW\model\gis\empty\ into TUFLOW\model\gis and rename the file. The output name is "file type"+"Run ID"+Geometry.shp. For example 2d_zsh_run01_L.shp for a line, 2d_zsh_run01_P.shp for a point or 2d_zsh_run01_R.shp for region. The file will be opened and added to the layers.
Multiple empty types and geometries can be imported at the same time.
File:QgisTuflow ImportEmpty01.JPG
Note: Not all geometry types exist for all TUFLOW types. For example 1d_bc, points and regions are valid, however lines are not. For more information on the TUFLOW empty types, please refer to the tables in the TUFLOW manual.
Increment Selected
As the name implies, this tool, takes the active layer (selected in the layer control) and saves a new copy of this. The current copy will be closed and the new version opened. There is an option to keep the existing source formatting, if this is selected a .qml file is saved based on the styling of the current layer.
File:QgisTuflow Increment01.JPG
View 1D Results
This allows the user to view 1D results as time-series or long profiles. This requires that the results are from a 2013-12-AA simulation or newer. Once the utility is started the results can be loaded using the "Add Results" button. The .info file (TUFLOW\results\1d\csv\) is the file to load, this tells the utility which .csv files need to be loaded.
When using the utility the ID of the selected GIS objects is used to find the results in the .csv files. This can either be an input file (1d_nwk) or the check files. The _nwk_N_check (contains all nodes) and and _nwk_C_check (contains all channels) are very useful for this purpose.
If a file containing lines is selected in the layer control, the utility allows viewing of channel data (time-series of flow, velocity and upstream and downstream water levels or long profiles). If a point geometry is selected, the utility will plot the node data (time-series of water level).
Multiple locations can be selected in the map window and these will be plotted. If viewing long profiles, the following logic applies:
- If a single channel is selected, all channels downstream will be plotted;
- If two channels are selected, a long section will be plotted between these;
- If more than two channels are selected an error will be issued.
View 1D Sections
This allows the user to plot 1D sections, in the 1d_xs or 1d_tab format. The active layer in the table of contents should be the layer contain the cross sections. Select a section or sections in the map window will plot the sections. 400px
Run TUFLOW Simulation
Start a TUFLOW simulation. The default control file is the most recent file in the TUFLOW\runs\ folder, the default executable is defined in the "Configure TUFLOW project". If the "Configure TUFLOW project" tool has not been run, no default values exist.