{ "cells": [ { "cell_type": "markdown", "id": "1d42833e", "metadata": {}, "source": [ "# Post-processing with QGIS\n", "During a hydraulic study, we want to visualize simulations results directly over the study area. This tutorial presents a method for visualizing Watlab simulation results using **QGIS**. \n", "## Importing Watlab result files into QGIS\n", "For each simulated time step, Watlab generates a `pic_XX_XX.txt` file containing the results, typically stored in a folder named `Output`. These files can be imported into QGIS as point layers.\n", "\n", "Open QGIS and go to: `Layer` → `Add Layer` → `Add Delimited Text Layer...`\n", "\n", "
\n", "\"Add\n", "
\n", "\n", "**Parameters:**\n", " - **File name**: Click the three dots to browse to your `Output` folder and select the `pic_XX_XX.txt` file corresponding to the desired time step.\n", " - **File format**: Choose “Custom delimiter” and select **Tab**.\n", " - **Sample Data**: Make sure the columns are correctly detected (e.g., `x`, `y`, `zb`, `h`, etc.).\n", " - **Geometry definition**: \n", " - Type: `Point` \n", " - X field: `x` \n", " - Y field: `y` \n", " - Coordinate reference system: `Lambert 72` (EPSG:31370)\n", "\n", "Once the layer is added, you should see a cloud of points representing the model mesh, one point per cell.\n", "\n", "\n", "## Interpolating results into a raster (TIF File)\n", "To visualize the results as a continuous surface, interpolate the point data into a raster.\n", "\n", "Open the **Processing Toolbox**: \n", "`Processing Toolbox` → `TIN Interpolation`\n", "\n", "**Parameters:**\n", "- **Vector layer**: Select the `pic` layer imported earlier.\n", "- **Interpolation attribute**: Choose `h_zb`, click the `+` to add it.\n", "- **Interpolation method**: `Linear`\n", "- **Extent**: Use the extent of the `pic` layer.\n", "- **Pixel size**: Set according to the desired resolution.\n", "\n", "Give the TIF file a clear name to identify the time step and variable. In the layer properties, adjust the symbology for optimal readability.\n", "\n", "💡 *To produce high-quality visual outputs, QGIS also allows you to design map layouts with legends, titles, and scale bars using `Project` → `New Print Layout`. This is ideal for exporting clean figures for reports or presentations.*\n", "\n", "## Elevation profile\n", "To represent water surface elevation relative to terrain, you need to combine the water depth `h` with the terrain elevation `zb` from the model. This allows you to create **elevation profiles**.\n", "\n", "First, add a new column `h_zb` to the attribute table of your result file.\n", "\n", "1. Open the **attribute table** of the `pic_XX_XX.txt` layer (right-click on the layer → Open Attribute Table).\n", "2. Open the **Field Calculator**:\n", " - Create a new field\n", " - Name: `h_zb`\n", " - Output file type: `Decimal (double)`\n", " - Expression:\n", " ```\n", " \"h\" + \"zb\"\n", " ```\n", "3. Apply the calculation.\n", "\n", "\n", "
\n", " \"Attribut\n", "
\n", "\n", "Next, re-interpolate the results using `TIN interpolation`, this time using the `h_zb` attribute.\n", "\n", "To generate a terrain profile, you can use the `Profile Tool` plugin. This allows you to draw a temporary line directly on the map or use a predefined shapefile if you want to consistently apply the same cross-section across different datasets.\n", "\n", "Once the raster is generated, you can compare the interpolated water level with your DEM to produce elevation profiles at a specific time step.\n", "\n", "
\n", "\"Terrain\n", "
\n", "\n", "The picture below illustrates a typical elevation profile:\n", "\n", "- **Red curve**: Digital Elevation Model (DEM), representing the terrain.\n", "- **Blue curve**: Water surface elevation (`h + zb`), showing the simulated water level.\n", "\n", "💡 *You can export the data (right-click → Export) and make beautiful plots using Python libraries.*\n", "\n", "
\n", "\"elevation_profile\"\n", "
\n", "\n" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }