Skip to content

Commit

Permalink
Add functionalites to sub-basins preprocessing
Browse files Browse the repository at this point in the history
- Add ASCII-Export
- Add calculation of max/min height, area and average impervious area
- Update docs
-- Add features from above
  • Loading branch information
lorenz3tla committed Aug 23, 2024
1 parent 555ffb4 commit 0cf82cd
Show file tree
Hide file tree
Showing 9 changed files with 398 additions and 114 deletions.
5 changes: 3 additions & 2 deletions QTalsim/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Changelog

##PLANNED:
## [1.5.0]
## [1.5.0] - 2024-08-23
- Add third functionality: Sub-basin preprocessing
- Enable calculation of the longest flowpath for every sub-basin in input layer
- Enable calculation of area, max/min height and average impervious areas for each sub-basin
- ASCII-Export for .EZG-file

## [1.4.3] - 2024-08-09
- Enhancements
Expand Down
4 changes: 2 additions & 2 deletions QTalsim/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
name=QTalsim
qgisMinimumVersion=3.34
description=This plugin creates hydrological response units (HRUs) suitable for Talsim (http://www.talsim.de/) and allows users to connect to a Talsim DB.
version=1.4.3
version=1.5.0
author=SYDRO Consult GmbH
email=l.treitler@sydro.de

about=QTalsim is a QGIS plugin with two principal functionalities that enable the processing of spatial data suitable for Talsim. Firstly, it enables users to calculate Hydrological Response Units (HRUs). Secondly, the plugin faciliates a direct connection to a Talsim database, enabling users to edit system elements, sub-basins and transport reaches.
about=QTalsim is a QGIS plugin with two principal functionalities that enable the processing of spatial data suitable for Talsim. Firstly, it enables users to calculate Hydrological Response Units (HRUs). Secondly, the plugin faciliates a direct connection to a Talsim database, enabling users to edit system elements, sub-basins and transport reaches. The third functionality allows the user to preprocess sub-basins and calculate the longest flowpaths for each sub-basin.

tracker=https://github.com/sydroconsult/QTalsim/issues
repository=https://github.com/sydroconsult/QTalsim
Expand Down
1 change: 0 additions & 1 deletion QTalsim/qtalsim.py
Original file line number Diff line number Diff line change
Expand Up @@ -2613,7 +2613,6 @@ def performIntersect(self):
#evtl umstellen auf make_geometries_valid
#Split the intersected areas and create own layer for each catchment area
# --> necessary for eliminating: deleted areas (e.g. area too small) should only take the attributes of features in the same catchment area
#QgsProject.instance().addMapLayer(intersectedDissolvedLayer)
resultSplit = processing.run("native:splitvectorlayer", {
'INPUT': intersectedDissolvedLayer,
'FIELD': self.ezgUniqueIdentifier,
Expand Down
25 changes: 23 additions & 2 deletions QTalsim/qtalsim_subbasin.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>285</height>
<width>514</width>
<height>329</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -177,6 +177,20 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QLabel" name="labelImpervious">
<property name="text">
<string>Optional: Select Imperviousness Layer</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboboxImperviousness"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
Expand All @@ -202,6 +216,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="onAsciiOutput">
<property name="text">
<string>ASCII-Output</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
Expand Down
420 changes: 331 additions & 89 deletions QTalsim/qtalsim_subbasin_dialog.py

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions QTalsim/talsim_parameter/template.EZG
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
*Einzugsgebiete (*.EZG)
*======================
[SETTINGS]
VERSION=1.6
*|------|-----|------------------------------|--------|-----------------------|------------------------|---------|-----|----------|-----|-------------------------------------|--------|--------------|-------------------------|-------------------------------|------------------|----------------------|------|
*| Bez | KNG | Gebietskenngroessen | N | Verdunstung | Temperatur | QBASIS | PSI | SCS (2) | BF0 | Retentionskonstanten |SCS | Aufteilung | Optionen | Ablaufzuordnung | Grundwasser-Tief | Schnee (3=1&2) |Scale |
*| | | A VG Ho Hu L | Datei |Kng Sum Datei HYO |Kng Tem JGG TGG Datei | qB JGG | (1) | CN VorRg| (3) | R K(VG) K1 K2 Int Bas |con Expo| Beta1 Beta2 | Muld SCS SCH Int2 Int2 | Gibt nach Objekt | Bas2 Bas2 Beta | Kng Datei Datei |Precip|
*|------|-----|------------------------------|--------|----(1)-----(2)----(3)-|------------------------|---------|-----|----------|-----|-------------------------------------|--------|--------------|-------------------------|-------------------------------|------------------|--------(1)-----(2)---|------|
*| - | 1-3 | ha % muNN muNN m | Nummer |1-3 mm/a ETp ID |1/2 °C - - Nummer |l/sqkm - | - | - mm | % | - h h h h h |J/N - | - - | mm xl org J/N h | QUrb QNat QInt QIn2 QBas QGWt | J/N h - | 0-3 Abgabe WaEquiva| - |
*|-<-->-|-<->-|<----><----><----><----><---->|<------>|-+-<---->-<------>-<->-|-+-<-->-<->-<->-<------>|<--->-<->|<--->|<---><--->|<--->|-+-<---->-<---->-<---->-<---->-<---->|-+-<--->|-<---->-<---->|-<--->-<-><->--+--<---->-|-<-->-<-->-<-->-<-->-<-->-<-->-|--+--<---->-<---->|--+--<------>-<------>|<---->|
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = 'QTalsim'
copyright = '2024, Sydro Consult GmbH'
author = 'Sydro Consult GmbH'
release = '1.4.3'
release = '1.5.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
45 changes: 28 additions & 17 deletions docs/doc_subbasin_preprocessing.rst
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
========================
Sub-basins preprocessing
========================
The third core functionality allows you to calculate the longest flowpath for each sub-basin in the input layer. Please note that to use this functionality, SAGA GIS and WhiteboxTools must be installed.

Input:
^^^^^^
- Sub-basin layer
- Digital Elevation Model (DEM) layer
- Water network layer
The third core functionality allows you to pre-process a sub-basins layer. It calculates the highest and lowest points within the sub-basins, the area and average impermeable area (optional) per sub-basin, and the longest flow path for each sub-basin. Output includes a line layer containing the longest flow paths, a sub-basins layer (and Geopackage) containing the sub-basins with all calculated parameters and an .EZG-ASCII file, which can be used as `input to Talsim <https://www.talsim.de/docs/index.php?title=EZG-Datei>`__ (optional). Please note that to use this functionality, SAGA GIS and WhiteboxTools must be installed.

Prerequisites
-------------
^^^^^^^^^^^^^
.. prerequisites:
**Input Layers:**
- Sub-basin layer
- Digital Elevation Model (DEM) layer
- Water network layer
- Optional: Layer with impervious areas

To use this plugin's functionality, SAGA GIS and WhiteboxTools must be installed.
- SAGA GIS: Ensure that the "Processing Saga NextGen Provider" plugin is installed via the Plugin Manager in QGIS.
- WhiteboxTools: Install the "WhiteboxTools for QGIS" plugin, and make sure the environment path is set correctly. For further guidance, you can watch this instructional `video <https://www.youtube.com/watch?v=xJXDBsNbcTg>`__ produced by Whitebox.

Executing the plugin
--------------------
Executing the Plugin
^^^^^^^^^^^^^^^^^^^^

After installing SAGA GIS and WhiteboxTools, you can run the plugin. Follow these steps:
After installing SAGA GIS and WhiteboxTools, you can run the plugin.

Select Layers
-------------

Select Layers:
^^^^^^^^^^^^^^
- Choose the correct polygon layer for the sub-basin layer.
- Select the field that contains the unique identifier for the sub-basins.
- Select the DEM layer (raster layer) and the water network layer (line layer).

Output Folder:
^^^^^^^^^^^^^^
- When choosing the output folder, it is recommended to use a folder that does not contain any spatial files.
- Optional: Select a layer containing impervious areas (`Example data set <https://sdi.eea.europa.eu/catalogue/srv/eng/catalog.search#/metadata/3bf542bd-eebd-4d73-b53c-a0243f2ed862>`__ ).

Output
------
- When choosing the output folder, it is recommended to use a folder that does not contain any spatial files, as using the same file names can lead to issues.
- Optional: Choose ASCII-Output to input a filename for the .EZG-ASCII-file.
- Output Parameters:
- Area of sub-basin in hectares [ha].
- Optional: Average impervious area in the sub-basin [%] (=field 'Imp_mean').
- Maximum height in sub-basin [MASL].
- Minimum height in sub-basin [MASL].
- Longest flow path [m] (=field 'Length').

Calculation of LongestFlowPath
------------------------------
The plugin first burns the water network into the DEM using the QGIS "Raster calculator".
It then applies SAGA's "Fill sinks (Wang & Liu)" tool to fill any sinks in the DEM. After this The plugin uses WhiteboxTools' "LongestFlowPath" (LFP) to generate the longest flowpath for each sub-basin. To address an issue with LFP creating disconnected flowpaths across different sub-basins (see details `here <https://github.com/jblindsay/whitebox-tools/issues/289>`__), the plugin processes each sub-basin individually, generating the LFP for each one separately. Finally, the plugin saves the correct LFP for each sub-basin and merges them into a single layer.

Expand Down
Binary file modified docs/qtalsim_screenshots/SubBasinPreprocessing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0cf82cd

Please sign in to comment.