View Results in QGIS

From Tuflow
Jump to: navigation, search

Introduction

In this section we will look at post-processing the TUFLOW results so they can be imported and viewed in QGIS. We will bring 3D surfaces (as gridded datasets) as well as point and vector data (as region objects).

TUFLOW to GIS

In order to bring the 2D results written by TUFLOW (for example a water level surface) into QGIS it is necessary to utilise a TUFLOW utility called TUFLOW_to_GIS.exe this utility can be downloaded from the TUFLOW website (TUFLOW Downloads).

There is separate wiki page on how to use the TUFLOW_to_GIS utility. This page can be found here TUFLOW to GIS.

  1. Download the TUFLOW_to_GIS utility and unzip. Take note of where this utility is located.
  2. Create an empty text file in the TUFLOW\results\M01\2d\ directory and name the file Process_Results.bat
  3. Open the text file in a text editor
  4. Add the following lines to the Process_Results.bat (these can be copied and pasted from below) and then save the batch file:
    REM Any text following "REM" is treated as a remark or comment.
    REM Process the maximums for water level, depth and velocity.
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -max M01_5m_002_h.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -max M01_5m_002_V.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -max M01_5m_002_d.dat
    REM Process the depths at times 1, 2 and 3 hours.
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -t1 M01_5m_002_d.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -t2 M01_5m_002_d.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -asc -t3 M01_5m_002_d.dat
    REM Process the velocity vectors at times 1, 2 and 3 hours.
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -shp -vector -t1 M01_5m_002_V.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -shp -vector -t2 M01_5m_002_V.dat
    C:\TUFLOW\Utilities\TUFLOW_to_GIS.exe -b -shp -vector -t3 M01_5m_002_V.dat
    Pause REM this keeps the Command Window open after processing
  5. Update the path to TUFLOW_to_GIS.exe if necessary.

  6. In Windows Explorer navigate to the TUFLOW\results\M01\2d\ directory and double click on the newly created batch file Process_Results.bat.
  7. A console window should appear and the batch file may process for a minute or so. When finished the output screen should look like screen image below:

    T2G M01 FinishedArc.png


    In windows explorer there should be 18 new files created, 6 .asc files and 12 files (3 conversions with 4 file created) for each of the vector sets.

    TIP: If there are not 18 files created remove the -b switches from the batch file and re-run the batch file. The TUFLOW_to_GIS utility will prompt for an input after each command line. This can be useful in determining why the process has stopped.

    T2G M01 OutputsArc.png


Viewing in QGIS

Gridded Surfaces

  1. If it is not already open, start QGIS and load the aerial photo (Module_Data\Aerials\QGIS\).
  2. Firstly we will open the gridded (raster) datasets, to do this select Layers >>> Add Raster Layer. Navigate to the TUFLOW\Results\M01\2d\ folder and select all of the .asc files.

  3. Tip: An easy way to do this is to type *.asc into the filename dialogue.
    The map window should now show the grids over the aerial photo, as per the image below.

    Tute M01 QGIS results 01.png


  4. As can be seen the results are showing up as grey. We will give these a colour shading to make the results more meaningful. We will use the M01_5m_002_d_g002.50_Max to demonstrate how this is done. Turn of the other results layer so that only the M01_5m_002_d_g002.50_Max and Aerial_Photo_M01 are visible.
  5. Right click on the M01_5m_002_d_g002.50_Max layer and select properties.
  6. Tute M01 QGIS results 02.png


  7. In the style tab, change the Colour Map' to from Greyscale to Colour
  8. Tute M01 QGIS results 03.png


  9. Navigate to the Colourmap tab. Set the Colour Interpolation to Linear. A colour ramp can be created by adding values with the Add Entry button. In the example below, three entries have been added, with a value (depth) of 0 showing as white, 2 as blue and 6 as black.
  10. Tute M01 QGIS results 04.png


  11. Alternatively this colour scheme can be loaded from the Module_Data\Module_01\QGIS\colourmap_depth.txt
  12. Select OK and Apply. The map window should now show a shaded depth grid, as per the image below.
  13. Tute M01 QGIS results 05.png


  14. We will now look at the water level results. Turn off the M01_5m_002_d_g002.50_Max and turn on the M01_5m_002_h_g002.50_Max. Following a similar process as above, enter the properties, set the style to colourmap and navigate to the colourmap tab. Set the Colour interpolation to Linear. Instead of adding the entries as we did previously in the generate colourmap section enter 10 into the Number of Entries section and click on Classify button. A colour ramp will be automatically generated. Select Apply and then OK. The results should appear as per the 2nd image below.
  15. Tute M01 QGIS results 06.png
    Tute M01 QGIS results 07.png


Contouring Results

  1. To contour the results to discrete values, for example to contour the water level at 1m increments. Select Raster >>> Contour'.
  2. In the Contour dialogue, set the following:
    • Input file (raster) to the water level results - M01_5m_002_h_g002.50_Max;
    • Set an appropriate output file name (in the example this is Cont_M01_5m_002_h_Max);
    • Interval between contour lines to 1.0 (metres);
    • Tick the Attribute name (this includes the elevation on each contour); and
    • Tick the load into canvas when finished.
    The dialogue is shown below, when completed select OK.
  3. Tute M01 QGIS results 08.png


  4. The contour lines should now be displayed on the map as per the image below.
  5. Tute M01 QGIS results 09.png


Vector Results

  1. The vector outputs from the TUFLOW_to_GIS conversion can be directly loaded into QGIS. Select Layer >>> Add Vector Layer.
  2. Select the three velocity vector results, from the TUFLOW\results\M01\2d\ directory.
    • M01_5m_002_V____1.00(v)_R
    • M01_5m_002_V____2.00(v)_R
    • M01_5m_002_V____3.00(v)_R
  3. Turn all layers except the aerial photo, M01_5m_002_d_g002.50____1.00 (the depth at time 1 hour) and the M01_5m_002_V____1.00(v)_R (velocity vector at time 1 hour).
  4. Colour the depth grid, using the method above.
    Tip: Use the colourmap provided in the module data directory, or save the colour profile created earlier. The depth and velocity results at time 1 hour should now be visible.
  5. Tute M01 QGIS results 10.png


  6. Repeat the process above to view the results at 2 and 3 hours into the simulation.


Conclusion

We have covered the basics of viewing 2D TUFLOW results in QGIS. Please return to the tutorial model, module 1. In the next step we review the performance of the TUFLOW model (warnings, checks and mass balance), to return please click here