Skip to content

Commit

Permalink
Prepare for release V1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenz3tla committed Oct 31, 2024
1 parent c516311 commit 3f83aa8
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 38 deletions.
8 changes: 8 additions & 0 deletions QTalsim/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [1.6.1] - 2024-10-31
- Enhancement
- ISRIC Soil Type Converter: Order field names in final layer by soil horizon/layer
Fixes
- HRU-Calculation
- Do not allow null-references in EFL-layer (e.g. soil ID is null)
- Fix but do not delete complex geometries

## [1.6.0] - 2024-10-25
- Add fourth functionality: ISRIC Soil Type Converter
- Downloads soil data from ISRIC, converts it to soil types and bulk density class and combines this data for the area of interest in one layer
Expand Down
2 changes: 1 addition & 1 deletion QTalsim/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name=QTalsim
qgisMinimumVersion=3.34
description=QTalsim is a QGIS plugin with four principal functionalities that enable the processing of spatial data suitable for Talsim (http://www.talsim.de/).
version=1.6.0
version=1.6.1
author=SYDRO Consult GmbH
email=l.treitler@sydro.de

Expand Down
22 changes: 12 additions & 10 deletions docs/doc_connect_to_db.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ Connect to Talsim DB
Connect to Talsim DB
--------------------
.. _getting-started:
The first step involves connecting to a Talsim SQLite Database. By clicking "Select Database," you can browse and select the Talsim Database.
Note that all geometries must be in the CRS WGS84 (EPSG 4326).


The first step involves connecting to a Talsim SQLite Database. By clicking "Select Database," you can browse and select the Talsim Database. Note that all geometries must be in the CRS WGS84 (EPSG 4326).

The next step requires selecting a scenario from the list and confirming this scenario by clicking "Confirm Scenario and load Layers".
As a result, the System Elements, Outflows, TransportReaches and Sub-basins are added to a layer group (named after the scenario) in the active QGIS-Project.
Expand All @@ -33,6 +34,7 @@ Edit features of Talsim DB

Edit SystemElement Layer
^^^^^^^^^^^^^^^^^^^^^^^^

The SystemElement layer is a point layer that holds all SystemElements. Users can insert new elements, delete unwanted ones, or update existing elements. To insert new elements, simply add a new point to the SystemElement layer and then fill in the fields displayed in the prompt. The most critical field to fill in is the 'Identifier' field. The first character of the identifier represents the ElementTypeCharacter of the system element (e.g., A for sub-basins). Therefore, it is essential for users to insert the correct ElementTypeCharacter here. The remainder of the 'Identifier' field serves as the ElementIdentifier. Please note that the element types cannot be changed by this plugin. Changes of the first character of the 'Identifier'-field are not saved to the DB. The Id (SystemElementId) is automatically added by the plugin. All other fields are optional and can be left empty (='NULL').

Another option is to delete system elements by removing the unwanted point feature.
Expand All @@ -45,31 +47,31 @@ Edit SystemElement Layer
Edit Layers Sub-basins and TransportReach
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

In addition to editing SystemElements directly, it is also possible to edit the geometries of transport reaches (lines) and sub-basins (polygons), as well as their attributes. The plugin offers functionalities to update existing geometries/attributes, delete sub-basins/transport reaches, insert geometries into existing system elements, or add new sub- basin/transport reach elements. The functionality is similar to editing the SystemElement layer.
In addition to editing SystemElements directly, it is also possible to edit the geometries of transport reaches (lines) and sub-basins (polygons), as well as their attributes. The plugin offers functionalities to update existing geometries/attributes, delete sub-basins/transport reaches, insert geometries into existing system elements, or add new sub-basin/transport reach elements. The functionality is similar to editing the SystemElement layer.

Inserting new geometries into existing sub-basins/transport reaches, or adding entirely new elements, can be accomplished by simply adding a geometry to the corresponding layer while in editing mode. When confirming the geometry of the new sub-basin, you must enter the identifier of the sub-basin into the 'Identifier' field. If this 'Identifier' already exists, the geometry is inserted into the existing sub-basin/transport reach element (column geometry). However, if it does not exist, a new element is created (element type = first character of 'Identifier' field). Optionally, you can update any other fields shown in the prompt. Only fields where you do not leave null values are updated in the DB. The 'Geometry' field is automatically filled with the WKT of the new geometry. Fields 'Latitude' and 'Longitude' are automatically filled with the coordinates of the sub-basin's center. Once you have finished editing existing polygons and/or inserting all new sub-basins, it is important to save the edits by clicking the 'Commit Changes' button.
Inserting new geometries into existing sub-basins/transport reaches, or adding entirely new elements, can be accomplished by simply adding a geometry to the corresponding layer while in editing mode. When confirming the geometry of the new sub-basin, you must enter the identifier of the sub-basin into the 'Identifier' field. If this 'Identifier' already exists, the geometry is inserted into the existing sub-basin/transport reach element (column geometry). However, if it does not exist, a new element is created (element type = first character of 'Identifier' field). Optionally, you can update any other fields shown in the prompt. Only fields where you do not leave null values are updated in the DB. The 'Geometry' field is automatically filled with the WKT of the new geometry. Fields 'Latitude' and 'Longitude' are automatically filled with the coordinates of the sub-basin's center. Once you have finished editing existing polygons and/or inserting all new sub-basins, it is important to save the edits by clicking the 'Commit Changes' button.

Additionally, it is possible to edit existing geometries by simply moving the vertices while in editing mode. In the attribute table, you can again also edit the attributes of the elements.
Additionally, it is possible to edit existing geometries by simply moving the vertices while in editing mode. In the attribute table, you can again also edit the attributes of the elements.



External Sub-basins Layer
--------------------------
.. _external-layer:

An additional feature enables the addition of geometries from an external polygon layer to either insert into existing sub-basins or create new sub-basins in the database. First, you must select a polygon layer from the list. If the layer's Coordinate Reference System (CRS) differs from WGS84, it is reprojected to EPSG-code 4326. The layer must include a unique identifier field combining the 'ElementTypeCharacter' and the 'ElementIdentifier' (e.g., AA001 for a sub-basin). After selecting the unique identifier field from the list, you may optionally choose other fields that contain various attributes of the sub-basins.
An additional feature enables the addition of geometries from an external polygon layer to either insert into existing sub-basins or create new sub-basins in the database. First, you must select a polygon layer from the list. If the layer's Coordinate Reference System (CRS) differs from WGS84, it is reprojected to EPSG-code 4326. The layer must include a unique identifier field combining the 'ElementTypeCharacter' and the 'ElementIdentifier' (e.g., AA001 for a sub-basin). After selecting the unique identifier field from the list, you may optionally choose other fields that contain various attributes of the sub-basins.

When these fields are selected, their content is added to the corresponding fields in the database. Another option for updating existing features involves updating the point coordinates (columns 'Latitude' and 'Longitude') to align with the center of the geometry, which can be done by selecting the appropriate checkbox.
When these fields are selected, their content is added to the corresponding fields in the database. Another option for updating existing features involves updating the point coordinates (columns 'Latitude' and 'Longitude') to align with the center of the geometry, which can be done by selecting the appropriate checkbox.

By clicking 'Save New/Updated Features in DB,' all new or updated features with changes in their geometries are saved to the database. Information about these updates and insertions is logged in the QTalsim-log.
By clicking 'Save New/Updated Features in DB,' all new or updated features with changes in their geometries are saved to the database. Information about these updates and insertions is logged in the QTalsim-log.

|External layer|

External TransportReaches Layer
-------------------------------
.. _external-transport-reach-layer:

Similarly to inserting external sub-basins, the plugin provides functionality to insert transport reach geometries using the corresponding window-tab. The user selects a line layer containing the transport reaches to be imported from the list of external layers. If required, this layer is reprojected to EPSG 4326. The user can then map input fields to Talsim fields.
Similarly to inserting external sub-basins, the plugin provides functionality to insert transport reach geometries using the corresponding window-tab. The user selects a line layer containing the transport reaches to be imported from the list of external layers. If required, this layer is reprojected to EPSG 4326. The user can then map input fields to Talsim fields.

By clicking 'Save New/Updated Features in DB,' all new features or features with updated geometries are saved to the database. Once more, information about the updated/inserted features is logged in the QTalsim-log.

Expand All @@ -79,7 +81,7 @@ Update Coordinates to Center of Geometry
----------------------------------------
.. _update-coordinates:

Another provided feature is the option to update the coordinates of all features that have a geometry (line/polygon) to the center of their respective geometries. This functionality is accessed by clicking the button labeled "Optional: Update Coordinates to Center of Sub-basins." Upon clicking this button, the plugin calculates the centroid of the geometries and updates all coordinates (columns 'Latitude' and 'Longitude') with the coordinates of the centroid.
Another provided feature is the option to update the coordinates of all features that have a geometry (line/polygon) to the center of their respective geometries. This functionality is accessed by clicking the button labeled "Optional: Update Coordinates to Center of Sub-basins." Upon clicking this button, the plugin calculates the centroid of the geometries and updates all coordinates (columns 'Latitude' and 'Longitude') with the coordinates of the centroid.

|Update Coordinates|

Expand Down
11 changes: 6 additions & 5 deletions docs/doc_soil.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
=========================
ISRIC Soil Type Converter
=========================

Another core functionality of QTalsim is downloading and processing soil data from `ISRIC <https://www.isric.org/>`__. The plugin downloads the data based on a bounding box defined by the user and then creates an output layer containing the soil type and bulk density class for all cells in the input area across six soil layers.

|Screenshot Soil preprocessing|
Expand All @@ -11,14 +12,14 @@ Executing the Plugin

To execute this plugin, the user must select the following:

- An input layer that defines the bounding box.
- An output folder where the plugin will save all generated files.
- A target CRS to which the output layers will be transformed.
- An input layer that defines the bounding box.
- An output folder where the plugin will save all generated files.
- A target CRS to which the output layers will be transformed.


When the "Download ISRIC Data" button is clicked, the plugin downloads data for clay, silt and sand share, and bulk density within the area defined by the bounding box. The raster files are saved in the specified output folder. The original output files, as returned by ISRIC (in the Homolosine projection), are stored in the 'orig' folder, while the reprojected files (in the user-defined projection) are stored in the 'proj' folder. Each of these folders will contain four files for each of the six soil layers.
When the "Download ISRIC Data" button is clicked, the plugin downloads data for clay, silt and sand share, and bulk density within the area defined by the bounding box. The raster files are saved in the specified output folder. The original output files, as returned by ISRIC (in the Homolosine projection), are stored in the 'orig' folder, while the reprojected files (in the user-defined projection) are stored in the 'proj' folder. Each of these folders will contain four files for each of the six soil layers.

When pressing "Calculate Soil Type", in the first step, the plugin recalculates the values from the mapped units to conventional units, as defined `here <https://www.isric.org/explore/soilgrids/faq-soilgrids#What_do_the_filename_codes_mean>`__. Then, the soil type for each cell is calculated using the clay, silt, and sand proportions, following the soil texture triangle below. The results are saved to the output folder and added to the current QGIS project. In the layer "Soil Types Combined" the soil types of the soil layers are displayed in the different columns of the layer. Additionally, the bulk density values are recalculated and are assigned to the respective bulk density class. The soil types and bulk density class values are intersected and merged into one layer. This vector layer holds the BDOD class and soil type name for every cell. The layer "Soil Types BDOD Combined" can be used as soil layer input to "QTalsim HRU calculation".
When pressing "Calculate Soil Type", in the first step, the plugin recalculates the values from the mapped units to conventional units, as defined `here <https://www.isric.org/explore/soilgrids/faq-soilgrids#What_do_the_filename_codes_mean>`__. Then, the soil type for each cell is calculated using the clay, silt, and sand proportions, following the soil texture triangle below. The results are saved to the output folder and added to the current QGIS project. In the layer "Soil Types Combined" the soil types of the soil layers are displayed in the different columns of the layer. Additionally, the bulk density values are recalculated and are assigned to the respective bulk density class. The soil types and bulk density class values are intersected and merged into one layer. This vector layer holds the BDOD class and soil type name for every cell. The layer "Soil Types BDOD Combined" can be used as soil layer input to "QTalsim HRU calculation".

.. |Bodenartendreieck|
Expand Down
43 changes: 23 additions & 20 deletions docs/doc_subbasin_preprocessing.rst
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
========================
Sub-basins preprocessing
========================

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:**
**Input Layers:**

- Sub-basin layer
- Digital Elevation Model (DEM) layer
- Water network layer
- Optional: Layer with impervious areas
- 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.
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.
- 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
^^^^^^^^^^^^^^^^^^^^
Expand All @@ -27,25 +28,27 @@ Executing the Plugin
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).
- 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>`__).
- 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).
- 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').
- 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
3 changes: 1 addition & 2 deletions docs/hrus_getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ Requirements for Input Layers
use types.


Continue to the next section for detailed step-by-step instructions: :ref:`Step-by-Step Guide <hrus_step_by_step>`

Continue to the next section for detailed step-by-step instructions: `Step-by-Step Guide <https://sydroconsult.github.io/QTalsim/hrus_step_by_step.html>`__



Expand Down

0 comments on commit 3f83aa8

Please sign in to comment.