Tute M01 Inspect Zpts SAGA

From Tuflow
Jump to navigation Jump to search


    In this page we look at the process on assigning elevations to the TUFLOW Zpts that define the elevations in the model using SAGA GIS. Ensure that SAGA is open, and open the DEM, which is provided as part of the Module Data and is named DEM_M01.sgrd.


  1. Open the blank Zpt layer 2d_zpt_M01_5m_002_P.shp, this was written in the TUFLOW\Model\saga\ directory. The Zpts will appear as a mass of points when zoomed to the full extent.
  2. All Zpts in SAGA GIS
  3. In the Workspace section of the interface (this can be toggled by using Window >> Show Workspace), navigate to the Data tab (tab located at the bottom of the window). Right click on the 2d_zpt_M01_5m_002_P.shp and select Save As. Save a copy of the table as 2d_zpt_M01_5m_003_P.shp. This is done for version control, we will edit the version 003 of the table as the input will be used in model run 003.
  4. Open the newly created layer 2d_zpt_M01_5m_003_P.shp and close the previous version 2d_zpt_M01_5m_002_P.shp.
  5. Ensure the Object Properties (Windows >> Show Object Properties) windows is visible, navigate to the Attributes tab. Select the Action cursor, and select a 2d_zpt. The attributes for the selected zpt will be shown, the SAGA window should look like the below:
  6. All Zpts in SAGA GIS, with attributes selected

    As can be seen the elevation for all zpts is a nuyll value of 99,999. The next step is to assign values based on the DEM.

  7. Navigate to the Modules tab in the Workspace Window, expand the Shapes - Grid entry and right click on the Add Grid Values to Points and select Execute.
  8. Shape-Grid Module: Add Grid Values to Points
  9. In the Add Grid Values to Points dialogue, set:
    • Points to 2d_zpt_M01_5m_003_P
    • Result to 2d_zpt_M01_5m_003_P
    • Grids to DEM_M01
    Select Okay. See the image below.
    Add Grid Values to Points Dialogue

    In the map window, if you select a point with the Action cursor and navigate to the Attributes tab in the Objects Properties window, a new data attribute DEM_M01. This field should have an elevation assigned:

    Attributes after DEM value added to points

    If you select a Zpt outside the DEM area the value that has been assigned to this attribute is -99,999. We will remove any Zpts that have this elevation.

  10. In the Modules option select Shapes - Tools >> Select by Attributes... (Numerical Expression)
  11. Set the following:
    • Shapes to 2d_zpt_M01_5m_003_P
    • Attribute to DEM_M01
    • Expression to "eq(a,-99999)" (without the quotes)
    Select Okay.
    Select by Attribute
  12. Navigate to the Data tab in the Workspace window. The Zpts outside of the DEM should be highlighted. To delete these, right click on the 2d_zpt_M01_5m_003_P item and select Edit >> Delete Selected Shapes. The map window should look like the below:
  13. Map View with null Zpts Removed

    TUFLOW requires the elevation data to be in the fourth column and the inspection has added a fifth column with the DEM values. There are two ways of overcoming this:

    • Updating the fourth (elevation) attribute column to have the values of the newly created (RASTERVALU) attribute.
    • Remove the elevation column, so that the RASTERVALU column becomes the fourth column.

    We will demonstrate the second option, the first option will results in the same data being stored twice in the shapefile, which will mean bigger file sizes.

  14. In the Data tab, right-click on the 2d_zpt_M01_5m_003_P item and select Attributes >> Show. This should bring up a tabular view of the data:
  15. 2d_zpt_M01_5m_003 Attributes
  16. Select the Delete Field icon (highlighted above)
  17. In the dialogue, check the elevation check box and select Okay
  18. Delete Fields Dialogue

    By deleting the Elevation field we have promoted the DEM_M01 field to the fourth position and will be used by TUFLOW. In the map window, if you select a point with the Action cursor and navigate to the Attributes tab in the Objects Properties window, the output should look like this:
    Attributes After Removal of Elevation Field

  19. In the Data tab, right click on the 2d_zpt_M01_5m_003_P item and select Save
  20. We have now updated the GIS layer, the next step is to modify the TUFLOW geometry control file to read the new shapefile.
  21. Save the current TGC file as M01_5m_003.tgc. Comment out or delete the Write MI and Stop lines entered previously (these are no longer needed).
  22. Add the following lines to the TGC file and save.
  23. Set Zpts == 75
    Read RowCol Zpts == ..\model\saga\2d_zpt_M01_5m_003_P.shp


    The Zpts have been inspected from the DEM, the geometry control file (.tgc) updated to use the inspected Zpts. Please return to the tutorial model module 1 page where the next step is to define the active areas.