Review XPSWMM 2D grid using QGIS

Mel Meng
4 min readDec 6, 2023

source: github

Introduction

For XPSWMM 2D models with a lot of manual terrain modifications, it is important to review the engine processed 2D grid to make sure all the modifications are correctly applied.

With the help of the Tuflow plugin, QGIS is a great tool for the task. In this article we will go through a few examples to learn,

  • Setup the XPSWMM model to generate check files as shapefiles
  • Install QGIS and the Tuflow plugin
  • Compare the 2D grid and the DEM

Setup the XPSWMM model to generate check files as shapefiles

In this exercise, you’ll use QGIS to compare the input DEM, and the 2D engine created 2D surface.

  1. Open the “./data/model/starter_model.xp”
  2. Add background, “./data/gis/Aerial_Photo_M02.jpg”
  1. Add DTM, “./data/gis/DEM.asc”
  1. Change the 2D settings to generate check files.
  1. Change the GIS output files to shapefiles.
  1. Save the model as run1.xp
  2. Run the model, ignore the initialization error.
  1. Go to the model folder “./2D/Check”, you should see a long list of files. Next, we will review these files in QGIS.

Install QGIS and the Tuflow plugin

Follow the instruction links to install QGIS and Tuflow QGIS plugin.

Load the 2D grid and the DEM into QGIS

  1. Start QGIS, and load the DTM file, “./data/gis/DES.asc”.
  2. Load the check files using the Tuflow plugin

Compare the 2D grid and DEM profile

  1. Keep only the DEM and “run1_grd_check_R” turned on, and open the “Elevation Profile”
  1. Double click on DEM layer to turn on “Represents elevation surface”
  1. Double click the “run1_grd_check_R” layer to set the elevation
  1. Now you can use the elevation profile tool to cut cross sections.
  1. Change the DEM style to hill shade to highlight steep slopes.
  1. Study how the 2D grid is representing the culvert area. The highlighted cell represents the average elevation mostly of the bank, therefore, it is much higher than the DEM. Let’s try using a finer grid.

Comparing 1m vs 6m grid

Using a finer grid should help capture the DEM, you will create a new model with 1m grid size, then compare the 2D check files for the grid.

  1. Save the XPSWMM model as run2.xp
  2. Change the 2D grid size from 5m to 1m
  1. Save the model, then run the model
  2. The check grid file for this model will be named in the same folder with a prefix of “run2”.
  3. Drag the grid file for run2 to QGIS, and setup the elevation with the same settings as the run1 grid, now we can compare the profiles. As you can see the green lines (1m) are tracking the DEM much better than the red lines (5m)

--

--