Tutorial: Calculate time of concentration of a river (Kirpich equation)
Site: | OpenCourseWare for GIS |
Course: | QGIS Advanced Tutorials |
Book: | Tutorial: Calculate time of concentration of a river (Kirpich equation) |
Printed by: | Guest user |
Date: | Sunday, 22 December 2024, 8:07 AM |
1. Introduction
In this tutorial we're going to calculate the time of concentration of a river. We'll use the Kirpich equation, but you can apply the method to other equations in a similar way.
The Kirpich equation:
tc = k * (dx ** const1) * (S ** const2)
Where:
tc
= time of concentration in minutesk
= 0.0195 to convert to SI unitsdx
= distance between the first and last node in metersS
= the elevation difference between the first and last node in m/mconst1
= 0.77const2
= -0.385
After this tutorial you're able to:
- Select longest path of a river
- Dissolve the line segments
- Find first and last node on river
- Merge first and last node into one point vector layer
- Sample elevation from the DEM at these points
- Calculate the Kirpich equation by hand or using the PyQGIS script
2. Select the longest path of a river
The first step is to select the longest path of the river for which you want to calculate the time of concentration. Unfortunately, there's not a simple tool that does that. Here we'll use a manual procedure.
1. Start QGIS
2. Open the Kirpich project from the GeoPackage provided with this tutorial. In the main menu choose Project | Open from | GeoPackage...
3. In the Load project from GeoPackage dialogue browse to Kirpich_data.gpkg and choose Kirpich as project.
The project has the catchment polygon (catchpoly), channels, DEM (SRTM 1-Arc Second) and is styled using blending with a hillshade.
4. Click on channels
5. Click the Select Features by area or single click icon
6. Now select the channel segments of the longest path from upstream to downstream. Keep the <Shift>
button pressed to add the segments. Zoom in if necessary. You can use
the scroll button of your mouse to zoom in/out and you can use the
spacebar in combination with moving the mouse to pan. If you accidently
have selected a wrong segment, click on it again with to deselect it.
After selecting the longest path the selected segments should be yellow as in the picture above.
Now we're going to export this longest path to a new layer.
7. Click right on channels in the Layers panel and choose Export | Save selected feature as...
8. In the dialogue save it to the Kirpich_data GeoPackage, call the layer river and click OK.
9. Copy the style from channels to river: click right on channels and choose Styles | Copy Style | All Style Categories... and click right on Kirpich_data river and choose Styles | Paste Style | All Style Categories.
10. Remove the channels layer.
Now we have the longest path of the river.
In the next step we're going to dissolve the segments of the longest path to one feature.
3. Dissolve river segments to one feature
Because our river layer still consists of many segements stored as separate features with their own start and end node we need to dissolve the layer first, so it becomes one feature.
1. In the main menu choose Vector | Geoprocessing tools | Dissolve...
2. In the Dissolve dialogue choose the Kirpich_data river layer as Input layer, don't choose a dissolve field and save the layer to the Kirpich_data GeoPackage with the name river_dissolved and click Run.
3. Click Close after processing.
4. Copy the style from the Kirpich_data river layer and remove that layer.
5. Check the attribute table.
In the next section we're going to find the first and last node of the river.
4. Find the first and last node of the river
In this step we're going to find the first and last node of the river. For the Kirpich equation we later need the distance between these points and their elevation difference.
1. Open the Processing Toolbox: from the main menu choose Processing | Toolbox.
2. click on the tool Vector Geometry | Extract specific vertices
0, -1
and save it to the Kirpich_data GeoPackage with the name firstlastnode. Click Run.5. Sample elevation of the first and last node
6. Calculate the time of concentration in PyQGIS
Because there's no easy way to calculate the Kirpich equation with
the field calculator in the attribute table, we're going to develop a
PyQGIS script in this section to implement the Kirpich equation
The Kirpich equation:
tc = k * (dx ** const1) * (S ** const2)
Where:
tc
= time of concentration in minutesk
= 0.0195 to convert to SI unitsdx
= distance between the first and last node in metersS
= the elevation difference between the first and last node in m/mconst1
= 0.77const2
= -0.385
Now you'll see the Python console appearing at the bottom of the screen.
2. Click the Show Editor icon .
This opens the editor where we can write code. A free tutorial to start learning PyQGIS can be found here.
3.
Write the code from the screenshot below. The lines with # give and
explanation. Alternatively you can download the script from GitHub.
4. Click the button and save the script as Kirpich.py
5. Click to run the script
You'll see the results in the Python console:
The concentration time is 21.8 minutes.