martes, 8 de enero de 2013

Hydrology analysis with TauDEM

To start the year, here is the first external contribution to this blog, a great post about the TauDEM algorithm provider for hydrological analysis. Alexander Bruy, an active QGIS developer, and most likely the most active SEXTANTE developer apart from myself, is responsible for this great entry that I am glad to share here.

Thanks, Alex!

-------

TauDEM (Terrain Analysis Using Digital Elevation Models) is a set of Digital Elevation Model (DEM) tools for the extraction and analysis of hydrologic information from topography as represented by a DEM. This is software developed at Utah State University (USU) for hydrologic digital elevation model analysis and watershed delineation.


TauDEM is distributed as a set of standalone command line executable programs for a Windows and source code for compiling and use on other systems.  SEXTANTE contains only the interface description, so you need to install TauDEM 5.0.6 by yourself and configure SEXTANTE properly.

Let’s start.


First of all load into QGIS the DEM and adjust symbology. It is the same DEM used in the last hydrological analysis post

TauDEM extracts hydrologically useful information from raw digital elevation model data. The main idea is based on the concept of the hydrological flow field being represented by flow from each grid cell to one or more of its neighbors. For this to work the topography should not contain pits, defined as one or more grid cells surrounded completely by cells with higher elevation. The first step in hydrological analysis is should be pit removal. TauDEM uses a fill process to do this, raising the elevation of pits until they drain out. A DEM with pits removed is referred to as hydrologically correct and can be used to calculate flow directions for each grid cell.


So the first tool to run is Pit Remove

Select the DEM in the Elevation Grid field and execute it.


The output DEM is the same, because our input file has no pits. If you are absolutely sure that your input file has no pits, this step can be skipped, otherwise it is safer to run Pit Remove to ensure that all further analysis will be correct.

The next algorithm to run is D8 Flow Direction. 


This takes as input the hydrologically correct elevation grid (which we create at the previous step) and outputs D8 flow direction and slope for each grid cell. The resulting D8 flow direction grid is shown below. 
It uses an encoding of the direction of steepest descent from each grid cell using the numbers 1 to 8, to represent each one of the cells around a given one. D8 is the simplest flow direction model.

NOTE: all TauDEM algorithms have built-in help, so you always can read description of the algorithm, required inputs and produced results.

The next tool to run is D8 Contributing Area. It counts the number of grid cells draining through (out of) each grid cell based on D8 flow directions.


There are optional inputs (outlets and an input weight grid) which we leave empty for now. These inputs are described in the tool help and allow to restrict calculation to the specific area upstream of the designated outlet and to accumulate an input weight field, rather than just counting contributing area as a number of grid cells. There is also an option named Check for edge contamination (set to Yes by default). 

The resulting layer produced by this algorithms looks like this:
A logarithmic scale is better suited to the particular distribution of values in this layer

In the rendering below, pink color is used to show NODATA values, so as to illustrate edge contamination.
The functions above used the D8 flow model that represents flow from each grid cell to one neighbor. TauDEM also provides the D∞ (D-Infinity) flow model that calculates the steepest outwards flow direction using triangular facets centered on each grid cell and distributes flow between neighboring grid cells based on flow direction angles. 

Having flow directions and slope grids we can delineate and analyze stream networks and watersheds. The simplest stream network delineation method uses a threshold on contributing area.

First we need to define a stream using the Stream Definition by Threshold algorithm. 


This tool defines a stream raster grid by applying a threshold to the input. In our case the input is a D8 contributing area grid and a threshold of 100 grid cells has been used.

The result depicts the stream network as a binary grid (but is not logically connected as a network shapefile yet).
The next step is to define the outlet point. This can be done by creating a point shapefile and placing the outlet point. Press the New Shapefile Layer button in the QGIS main window, and the following dialog will appear.



Select Point as shape type, and specify the same CRS as the DEM. TauDEM requires this, because it doesn’t do any spatial reference transformations. Now press OK and save the new file wherever you prefer. A new vector layer will be added to QGIS canvas. Select it and start editing. Zoom to a likely location for an outlet and create a new feature, then save and stop editing.

It is not required for the outlet to be precisely located where there will be a stream as TauDEM has a tool to move outlets to streams that we will used. Alternatively, if the outlet point location is available from some other source (e.g. location information about a stream gauge), it can be created from that information.
Here is the outlet we created manually.

As you can see, it is located outside the stream. So we use the Move Outlets To Stream tool to get outlet in correct place.



IMPORTANT: TauDEM creates shapefile in same CRS as input files, but it doesn’t create .prj file. You need to define projection for output file manually in order to get it in correct place. This can be done from layer context menu using Set Layer CRS item.

Here is our initial outlet (red) and correct one (green). Notice how the outlet has been moved to match the stream.

With the outlet positioned on the stream the stream network upstream of the outlet can be delineated.
We again run the D8 Contributing Area algorithm, but this time specifying an outlet shapefile to evaluate contributing area and effectively identify the watershed upstream of the outlet point (or points for multiple outlets).


The result is the contributing area only for the watershed upstream of the outlet.

The next step is to use the Stream Definition By Threshold algorithm to define streams using a specified contributing area threshold. We choose a threshold of 200 grid cells.


The result is a grid stream network upstream of the outlet
This network is still only represented as a grid. To convert it into vector elements represented using a shapefile, the Stream Reach and Watershed algorithm is used.


This algorithm produces many outputs including watershed grid and stream network in shape format and some text files with additional information. Here we visualize the watershed grid and stream network shapefile.

The attributes of a stream network link contains useful information such as downstream and upstream connectivity, stream order, length, slope, drainage area etc (detailed explanation of fields is available in the tool help).


Rather than do each step separately, we can create model with SEXTANTE modeler to run these algorithms together.





5 comentarios:

  1. Hey, great post, this is exactly what I needed for my students today!

    Thanks Alexander and Volaya

    ResponderEliminar
  2. I have visited the TauDEM website and it is very unclear to me how to install TauDEM for use with QGIS. Can you give any hints?
    thanks
    john coleman 2013-06-02

    ResponderEliminar
  3. I'm agree with John. It's very confusing for some users to know what programm, version or TauDem library to download and how to install it for QGIS, because it's not documented on TauDem Web page. On the the download page, only procedure to install software with ArcGIS is described.

    It would be appreciated to clarify what TauDen version, software to chose and how to install it within QGIS both for Windows and Linux users.

    Regards!

    ResponderEliminar
  4. Este comentario ha sido eliminado por el autor.

    ResponderEliminar