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 minutes
k = 0.0195 to convert to SI units
dx = distance between the first and last node in meters
S = the elevation difference between the first and last node in m/m
const1 = 0.77
const2 = -0.385


After this tutorial you're able to:

  1. Select longest path of a river
  2. Dissolve the line segments
  3. Find first and last node on river
  4. Merge first and last node into one point vector layer
  5. Sample elevation from the DEM at these points
  6. 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.

Select longest path of channel

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.

Longest path of the channel

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.

Dissolve dialogue

3. Click Close after processing.

4. Copy the style from the Kirpich_data river layer and remove that layer.

5. Check the attribute table.

Dissolved river

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


This tool can be used to extract specific vertices.The first vertex corresponds to an index of 0, the second vertex has an index of 1, etc. Negative indices can be used to find vertices at the end of the geometry, e.g., an index of -1 corresponds to the last vertex, -2 corresponds to the second last vertex, etc.

3. In the Extract Specific Vertices dialogue choose river_dissolved as Input layer, for Vertex indices type 0, -1 and save it to the Kirpich_data GeoPackage with the name firstlastnode. Click Run.


4. Click Close after processing.

5. Click right on the firstlastnode layer and choose Open Attribute Table.
Attributes of first and last node

You can see in the field vertex_pos the index of the vertex and in the distance field the distance from the first node in meters. So here the distance of the last node is 3745 m. We need that value in the equation.
We also need the elevation difference between the first and last node. In the next step we're going to sample the elevation on the two nodes.

5. Sample elevation of the first and last node

For the Kirpich equation we also need the elevation difference between the first and the last node of the river.
In this section we're going to sample the elevation at nodes from the DEM.

1.  In the Processing Toolbox choose Raster analysis | Sample raster values

2. In the Sample Raster Values dialogue choose firstlastnode as Input Point Layer, DEM as Raster Layer to sample. Expand the Advanced Parameters section and replace the Output column prefix with Z. Save the Sampled Points to the Kirpich_Data GeoPackage with the layer name firstlastz. Click Run.
Sample raster values dialogue

3. Click Close after processing

4. Click right on the firstlastz layer and choose Open Attribute Layer.


Now we have the distance and the elevation at the first and last node.

Now we can fill in the Kirpich equation. In the next section we're going to develop a PyQGIS script that can do the calculation.

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 minutes
k = 0.0195 to convert to SI units
dx = distance between the first and last node in meters
S = the elevation difference between the first and last node in m/m
const1 = 0.77
const2 = -0.385

1. In the main menu go to Plugins | Python Console

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.