TerraHidro Wiki Page

TerraHidro 5 - Console applications

Download

  • Last stable release:

- Windows (01/01/2024): TerraHidro-5.2.0.exe
- Linux (10/05/2023): terrahidro-5.2.0.tar.gz

Add the path to the TerraHidro directory into the PATH variable. After this step, the TerraHidro system can be executed by typing th in a terminal.

- Windows: Settings, type Edit System Variables, System Variables, select Path, Edit, New, copy path to the TerraHidro directory (e.g. C:\TerraHidro-5.2.0).
- Linux: extract the file terrahidro-5.2.0.tar.gz using “tar -zxvf terrahidro-5.2.0.tar.gz” under /home/user, where user is the username; open a terminal, export PATH=/home/user/terrahidro-5.2.0/bin:$PATH, export TERRALIB_HOME=/home/user/terrahidro-5.2.0, export LD_LIBRARY_PATH=/home/user/terrahidro-5.2.0/lib:$LD_LIBRARY_PATH. In order to permanently set the variables PATH, TERRALIB_HOME, and LD_LIBRARY_PATH, these variables must be modified in the resources file under the /home/user directory (e.g. .bashrc).

Note: The Linux version was compiled on a Fedora Core 36 that had all the necessary packages installed. The Terralib library has many dependencies, which must be solved to avoid any problems. The main packages (version) used for the compilation were: gcc/stdc++ (12.2.1), glibc (2.35), qt5 (5.15.8), boost (1.76), proj (8.2.1), geos (3.10.2), gdal (3.4.3), sqlite (3.36), tiff (4.4), geotiff (1.7.1), X11 (1.7.3). Please, solve any dependencies before executing TerraHidro on Linux.

  • Input data for examples (lower Tocantins region known as Acará-Guamá):

Tocantins DEM: tocantinsDEM.tif
Tocantins drainage (Shapefile): tocantinsDRN.zip
Tocantins drainage (GeoPackage): tocantinsDRN.gpkg
Tocantins drainage sources (Shapefile): tocantinsSRC.zip
Tocantins drainage sources (GeoPackage): tocantinsSRC.gpkg

Example 1: drainage network and minibasins

Consider as input the DEM of the Tocantins basin located at “C:\data\tocantinsDEM.tif”.
The drainage network and minibasins can be extracted using the TerraHidro 5 console functionalities.

1. Generate a pitless DEM from the input DEM.
The removepits functionality executes the carvev, simplepits, and pfs functionalities, in this order.

C:\data>th removepits tocantinsDEM.tif tocantinsPitlessDEM.tif

2. Generate the D8 flow directions from the pitless DEM.

C:\data>th d8 tocantinsPitlessDEM.tif tocantinsD8.tif

3. Generate the contributing area from the D8 flow directions.

C:\data>th d8ca tocantinsD8.tif tocantinsD8ContributingArea.tif

4. Generate the drainage network from the contributing area.
This step requires a threshold value for the minimum contributing area.

C:\data>th d8drainage tocantinsD8ContributingArea.tif tocantinsDrainage.tif 1000

5. Generate the drainage network vector file from the grid file.

C:\data>th d8drainagev tocantinsDrainage.tif tocantinsD8.tif tocantinsDrainage.shp

6. Generate the drainage network segments.
Each drainage segment is identified by a unique integer.

C:\data>th segments tocantinsD8.tif tocantinsDrainage.tif tocantinsSegments.tif

7. Generate the drainage network minibasins.

C:\data>th minibasins tocantinsD8.tif tocantinsSegments.tif tocantinsMinibasins.tif

Additional steps can be executed to produce high-quality vector data. The vectorized drainage network generated with the d8drainagev functionality simply joins all the drainage network cells that are connected by the D8 flow directions. This procedure generates a vectorized drainage network that contains lines in a raster pattern, which can be improved with some tools from QGIS that smooth the lines for more natural drainage flows. Besides the drainage network, the minibasins raster can be also vectorized, and each polygon smoothed in order to improve the limits of the minibasins.

The next commands use the tools available in QGIS 3.22.9 under Windows, where the directory C:\Program Files\QGIS 3.22.9\apps\Python39\Scripts contains the scripts gdal_sieve.bat and gdal_polygonize.bat, and the directory C:\Program Files\QGIS 3.22.9\bin contains the script grass78.bat. Both directories were added to the PATH environment variable before executing the scripts. In addition, the scripts generalize_line.bat (generalize_line.bat) and generalize_polygon.bat (generalize_polygon.bat) set the method and the parameters for smoothing the lines and polygons, respectively, writing the vector files tocantinsDrainageSmooth.gpkg and tocantinsMinibasinsSmooth.gpkg as output (if necessary, the correct path to the data and file names must be changed inside the scripts).

C:\data>grass78.bat --tmp-location tocantinsDrainage.shp --exec generalize_line.bat
C:\data>gdal_sieve.bat -st 3 tocantinsMinibasins.tif tocantinsMinibasins3.tif
C:\data>gdal_polygonize.bat tocantinsMinibasins3.tif -f GPKG tocantinsMinibasins.gpkg
C:\data>grass78.bat --tmp-location tocantinsMinibasins.gpkg --exec generalize_polygon.bat

Example 2: improvements to match a reference drainage network

Suppose that the user already has a reference drainage network. The quality of the D8 flow directions and, consequently, the minibasins can be improved by using the drainage network as input to some of the TerraHidro functionalities.
First, the DEM must be modified to agree with the drainage network. Next, the hydrologically consistent DEM must be generated by processing flat areas and pits also using the drainage network data.

1. Generate a modified DEM that matches the drainage network.
In this example, buffer size and smooth factor are not used, only the sharp factor to decrease the elevation data of the DEM at the corresponding drainage network cells.

C:\data>th agreedem tocantinsDEM.tif tocantinsDRN.shp 0 0 100 tocantinsAgreeDEM.tif

Note: if the drainage network file is of vector type (Shapefile or GeoPackage), the agreedem functionality executes the gdal_rasterize command available from the QGIS installation for conversion to raster.
The user must add the QGIS bin directory to the path, e.g. C:\Program Files\QGIS 3.22.9\bin.

2. Extract the flat areas from the input DEM.
Minimum number of cells for flat areas must be informed.

C:\data>th flatareas tocantinsDEM.tif 100 tocantinsFlatAreas.tif

3. Modify the AgreeDEM on flat areas using the drainage network.
In this case, all directions are checked when traversing flat areas.

C:\data>th carve tocantinsAgreeDEM.tif tocantinsDRN.shp tocantinsFlatAreas.tif DRNON ALL tocantinsFlatlessAgreeDEM.tif

4. Remove simple pits from the flatless AgreeDEM.

C:\data>th simplepits tocantinsFlatlessAgreeDEM.tif tocantinsFlatlessAgreeDEM2.tif

5. Generate a pitless DEM by removing complex pits.
The new flatless AgreeDEM is modified with the PFSD algorithm that also uses the drainage network. The pits located in the drainage network are processed first, and the other pits are selected by traversing cells in the upstream direction.
The D8 flow directions, contributing area, drainage network, segments, and minibasins can be generated from the flatless and pitless AgreeDEM, as shown from step 2 of the Example 1.

C:\data>th pfsd tocantinsFlatlessAgreeDEM2.tif tocantinsDRN.shp tocantinsFlatlessPitlessAgreeDEM.tif

Details about functionalities

This section includes a brief description of the TerraHidro functionalities used in the previous examples. More details about the carvev, simplepits, and pfs functionalities can be found in JARDIM (2017).

carvev - Identifies and modifies flat areas by decreasing the elevation values from the border to the center.

First, the flat areas are identified with a window that is moved from cell to cell. Whenever all cells inside the red window have the same elevation as the center cell, each cell of same elevation that is located inside the red and green windows is marked as flat area.

Next, the elevation of all cells identified as flat area is decreased from the border to the center. The decreasing factor is decremented at each step, so that a stair pattern is formed inside the flat area.

simplepits - First attempt at removing pits. The pit elevation is set to the lowest elevation from a neighbor cell increased by a small increment. If all neighbors do not become a new pit, the pit is solved.

pfs - Performs a grid search from the pit to find the closest cell with elevation lower than the pit. Visited cells are added into a priority queue, creating a tree of paths to linearly decrease the elevation of each cell in the successful path.

d8 - Defines the flow direction of each cell by assigning a code that indicates to which neighbor cell the flow must continue, i.e. the neighbor cell of steepest descent. Valid flows are coded with a power of 2 from 1 to 128, whereas invalid flows with 0.

Codes and corresponding flow directions:

Elevation and D8 flow direction grids:

d8ca - Computes the contributing area (accumulated flow) by following the flow directions and counting how many cells reach each cell, including the cell.

d8drainage - Defines the drainage network cells by assigning the value 1 if the contributing area is equal to or greater than a given threshold, otherwise assigns the value 0.

d8drainagev - Creates the vector data from the rasters of the drainage network and D8 flow directions.

segments - Assigns a unique integer value to each drainage segment. The extreme points of a drainage segment are specified by one of three cases: 1. initial point and intersection point; 2. both intersection points; 3. intersection point and final point.

minibasins - Delineates the minibasins that are associated to the drainage network segments using the D8 flow directions.

agreedem - Modifies the DEM by sharpening the drainage network cells, i.e. decreasing the elevation values, and by optionally smoothing the cells around the drainage network given a distance buffer.

flatareas - Extracts flat areas from the DEM by setting as flat areas all sets of adjacent cells that contain the minimum required number of cells of same elevation.

carve - Removes flat areas by optionally using a drainage network that indicates the cells where elevation must be lower inside the flat area.
The example below shows the staircase pattern created after removing the flat area, thus decreasing elevation values from higher (red) to lower (blue) cells.

References

JARDIM, A. C. Direções de fluxo em modelos digitais de elevação: um método com foco na qualidade da estimativa e processamento de grande volume de dados. Doctoral thesis in Applied Computing. National Institute for Space Research (INPE). 2017.

All functionalities

All functionalities available in the TerraHidro console application are shown by typing “th” on the console.

Full list:

carve - Finds and carves flat areas from a DEM around a drainage network.

th carve inputDEM.tif inputDrainage.shp inputFlatAreas.tif DRNON|DRNOFF CROSS|DIAG|ALL outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • inputDrainage.shp - input drainage network (vector or raster).
  • inputFlatAreas.tif - input flat areas generated with the flatareas functionality (raster).
  • DRNON|DRNOFF - parameter that indicates whether the drainage network must be used (DRNON) or not (DRNOFF) to carve the flat areas. If DRNOFF is used, the carving process converges to the center of the flat areas, which is not necessarily the river channel's location (similar to executing the carvev functionality).
  • CROSS|DIAG|ALL - parameter that indicates which cells must be selected to form the border of the flat areas in the carving process (CROSS = horizontal/vertical, DIAG = diagonal, ALL = all directions).
  • outputDEM.tif - output DEM with flat areas carved (raster).

carvev - Finds and carves flat areas from a DEm in V-shaped format.

th carvev inputDEM.tif outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • outputDEM.tif - output DEM with flat areas carved (raster).

simplepits - Tries to remove each pit by filling the pit cell. If this procedure does not generate a new pit, this pit is removed. Warning: This operation does not generate a pitless DEM.

th simplepits inputDEM.tif outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • outputDEM.tif - output DEM with simple pits removed (raster).

pfsd - Removes all pits using the PFS algorithm to carve a path to an outlet cell by processing pits from the drainage network to the upstream cells. This operation generates a pitless DEM.

th pfsd inputDEM.tif inputDrainage.shp outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • inputDrainage.shp - input drainage network (vector or raster).
  • outputDEM.tif - output DEM with complex pits removed (raster).

pfs - Removes all pits using the PFS algorithm to carve a path to an outlet cell. This operation generates a pitless DEM.

th pfs inputDEM.tif outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • outputDEM.tif - output DEM with complex pits removed (raster).

removepits - This is the preferred procedure to remove all pits from a DEM. This is equivalent to perform the carvev, simplepits and pfs precedures in sequence. This operation generates a pitless DEM.

th removepits inputDEM.tif outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • outputDEM.tif - output DEM with flat areas carved and simple/complex pits removed (raster).

agreedem - Modifies a DEM to match a specified drainage network.

th agreedem inputDEM.tif inputDrainage.shp bufferSize smoothFactor sharpFactor outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • inputDrainage.shp - input drainage network (vector or raster).
  • bufferSize - buffer size around the drainage network specified either as an integer (number of cells: fixed) or a string (attribute of the input drainage network: variable). The buffer as an attribute is generated with the flatbuffer functionality.
  • smoothFactor - smooth factor for modifying DEM values inside the buffer (in DEM vertical units, usually in meters).
  • sharpFactor - sharp factor for modifying DEM values on the drainage network (in DEM vertical units, usually in meters).
  • outputDEM.tif - output reconditioned DEM (raster).

tpi - Computes the Topographic Position Index (TPI) from a DEM.

th tpi inputDEM.tif inputWindowSize SQUARE|CIRCLE outputTPI.tif
  • inputDEM.tif - input DEM (raster).
  • inputWindowSize - window size for selecting neighbour cells to compute their average DEM elevation (in cells).
  • SQUARE|CIRCLE - type of window for selecting neighbour cells (SQUARE = square window, CIRCLE = circular window).
  • outputTPI.tif - output topographic position index (raster).

tps - Computes the Topographic Position-based Stream (TPS) from a D8 flow directions grid, a contributing area grid, a TPI grid, minimum and maximum contributing area thresholds, and a TPI threshold.

th tps inputD8.tif inputContributingArea.tif inputTPI.tif inputCAmin inputCAmax inputV outputTPS.tif
  • inputD8.tif - input D8 flow directions generated with the d8 functionality (raster).
  • inputContributingArea.tif - input contributing area (accumulated flow) generated with the d8ca functionality (raster).
  • inputTPI.tif - input topographic position index generated with the tpi functionality (raster).
  • inputCAmin - minimum threshold of contributing area.
  • inputCAmax - maximum threshold of contributing area.
  • inputV - threshold of topographic position index (TPI).
  • outputTPS.tif - output topographic position-based stream (raster).

flatareas - Extracts flat areas from a DEM.

th flatareas inputDEM.tif minFlatAreaCells outputFlatAreas.tif
  • inputDEM.tif - input DEM (raster).
  • minFlatAreaCells - minimum number of cells for flat areas.
  • outputFlatAreas.tif - output flat areas (raster).

flatbuffer - Generates buffer sizes around a drainage network from flat areas and extracts drainage points with buffer.

th flatbuffer inputDrainage.shp inputFlatAreas.tif inputBufferAttribute IN|INOUT MED|EQD inputEquidistance outputDrainage.shp outputPoints.shp
  • inputDrainage.shp - input drainage network (vector).
  • inputFlatAreas.tif - input flat areas generated with the flatareas functionality (raster).
  • inputBufferAttribute - input name of the buffer attribute (string) to be added to the output drainage network.
  • IN|INOUT - parameter that specifies which points must be selected to compute buffer values for each drainage segment (IN = only inside flat areas, INOUT = inside and outside flat areas).
  • MED|EQD - parameter that specifies the location of the output points generated with buffer (MED = mean point of subsegments of drainage segment, EQD = equidistant points on drainage segment).
  • inputEquidistance - input distance value for the equidistant points that is used only if the EQD parameter is informed.
  • outputDrainage.shp - output drainage network with attribute of buffer size added to the attribute table. The buffer values are associated to each drainage segment.
  • outputPoints.shp - output points generated on the drainage network with attribute of buffer size added to the attribute table. The points are either mean points (MED) or equidistant points (EQD).

d8 - Generates the D8 flow directions grid from a pitless DEM.

th d8 inputDEM.tif outputD8.tif
  • inputDEM.tif - input DEM (raster).
  • outputD8.tif - output D8 flow directions (raster).

d8ca - Generates the contributing area grid from a D8 flow directions grid.

th d8ca inputD8.tif outputD8ContributingArea.tif
  • inputD8.tif - input D8 flow directions (raster).
  • outputD8ContributingArea.tif - output D8 contributing area or accumulated flow (raster).

d8drainage - Generates the drainage network grid from a contributing area grid.

th d8drainage inputContributingArea.tif outputDrainage.tif thresholdValue
  • inputContributingArea.tif - input D8 contributing area (raster).
  • outputDrainage.tif - output drainage network (raster).
  • thresholdValue - threshold value of contributing area to select cells for the drainage network (in cells).

d8drainagev - Generates the drainage network vectors from a drainage network grid.

th d8drainagev inputDrainage.tif inputD8.tif outputDrainage.shp
  • inputDrainage.tif - input drainage network (raster).
  • inputD8.tif - input D8 flow directions (raster).
  • outputDrainage.shp - output drainage network (vector).

hand - Generates the HAND height grid from a DEM grid, a D8 flow directions grid and a drainage network grid.

th hand inputDEM.tif inputD8.tif inputDrainage.tif outputHAND.tif
  • inputDEM.tif - input DEM (raster).
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • outputHAND.tif - output Height Above Nearest Drainage (raster).

sand - Generates the SAND slope grid from a DEM grid, a D8 flow directions grid, and a drainage network grid.

th sand inputDEM.tif inputD8.tif inputDrainage.tif outputSAND.tif
  • inputDEM.tif - input DEM (raster).
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • outputSAND.tif - output Slope Above Nearest Drainage (raster).

segments - Generates the segments from a D8 flow directions grid and a drainage network grid.

th segments inputD8.tif inputDrainage.tif outputSegments.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • outputSegments.tif - output drainage network segments coded with unique integer values (raster).

minibasins - Generates the minibasins from a D8 flow directions grid and a segments network grid.

th minibasins inputD8.tif inputSegments.tif outputMinibasins.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputSegments.tif - input drainage network segments (raster).
  • outputMinibasins.tif - output minibasins associated to the input segments coded with the same unique integer values (raster).

outletbasin - Generates the outlet basin from a D8 flow directions grid, and row and column of an outlet point.

th outletbasin inputD8.tif inputOutletrow inputOutletcolumn outputOutletbasin.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputOutletrow - grid row of the outlet cell of the basin to be delineated.
  • inputOutletcolumn - grid column of the outlet cell of the basin to be delineated.
  • outputOutletbasin.tif - output basin delineated from the outlet cell (raster).

d8slope - Generates slope from D8 flow directions.

th d8slope inputDEM.tif inputD8.tif outputD8Slope.tif
  • inputDEM.tif - input DEM (raster).
  • inputD8.tif - input D8 flow directions (raster).
  • outputD8Slope.tif - output slope computed from each D8 flow direction between neighbouring cells (raster).

d8upscale - Upscales a drainage network grid.

th d8upscale inputD8.tif inputD8ContributingArea.tif outputUpscaleRaster.tif outletPixelsRaster.tif factor [mufp] [at]
  • inputD8.tif - input D8 flow directions (raster).
  • inputD8ContributingArea.tif - input D8 contributing area (raster).
  • outputUpscaleRaster.tif - output D8 flow directions upscaled by factor using the D8 contributing area for better estimation (raster).
  • outletPixelsRaster.tif - output outlet pixels (raster).
  • factor - input upscale factor (integer).
  • mufp - input minimum upstream flow path (integer, optional, default = factor/5).
  • at - input contributing area threshold (integer, optional, default = factor^2).

flowpath - Generates flow paths from sources.

th flowpath inputD8.tif inputSources.shp outputFlowPaths.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputSources.shp - input drainage source points to initiate flow paths (vector).
  • outputFlowPaths.tif - output flow paths that follow the D8 flow directions from each drainage source point (raster).

fill - Fills voids of a DEM data (e.g. SRTM 30 m) using a reference DEM data (e.g. SRTM 90 m).

th fill inputDEM.tif referenceDEM.tif outputDEM.tif
  • inputDEM.tif - input DEM (raster).
  • referenceDEM.tif - input reference DEM with data to be used for filling (raster).
  • outputDEM.tif - output DEM with voids filled from the reference DEM (raster).

d8toupstream - Generates the upstream flow directions from a D8 flow directions grid.

th d8toupstream inputD8.tif outputUpstream.tif
  • inputD8.tif - input D8 flow directions (raster).
  • outputUpstream.tif - output D8 upstream flow directions computed as the sum of the D8 flow directions (raster).

mouths - Generates the drainage mouths from a D8 flow directions grid and a drainage network grid.

th mouths inputD8.tif inputDrainage.tif outputMouths.txt
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • outputMouths.txt - output mouths (grid coordinates), i.e. the cells where the drainage flows end (text file).

orderedmouths - Generates the ordered drainage mouths by accumulated area from an accumulated area grid and a mouths text file.

th orderedmouths inputContributingArea.tif inputMouths.txt outputOrderedMouths.txt
  • inputContributingArea.tif - input D8 contributing area (raster).
  • inputMouths.txt - input mouths (grid coordinates) (text file).
  • outputOrderedMouths.txt - output mouths (grid coordinates) ordered by contributing area from higher to lower values (text file).

rivers - Generates the separated rivers and sources from an D8 upstream flow directions grid, a drainage grid, contributing area grid and a mouths text file.

th rivers inputD8upstream.tif inputDrainage.tif inputAccumulatedArea.tif inputMouths.txt outputRivers.tif outputSources.txt
  • inputD8upstream.tif - input D8 upstream flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • inputAccumulatedArea.tif - input D8 contributing area (raster).
  • inputMouths.txt - input mouths (grid coordinates) (text file).
  • outputRivers.tif - output rivers formed by all drainage segments that converge to each mouth coded with unique integer values (raster).
  • outputSources.txt - output sources (grid coordinates) of all rivers (text file).

ottorivers - Generates the otto codification of rivers from an D8 upstream flow directions grid, a drainage grid, contributing area grid and a mouths text file.

th ottorivers inputD8upstream.tif inputDrainage.tif inputAccumulatedArea.tif inputMouths.txt outputOttoRivers.tif outputNewLevelMouths.txt
  • inputD8upstream.tif - input D8 upstream flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • inputAccumulatedArea.tif - input D8 contributing area (raster).
  • inputMouths.txt - input mouths (grid coordinates) (text file).
  • outputOttoRivers.tif - output ottorivers with five segments of main river and four main tributaries ottoencoded (raster).
  • outputNewLevelMouths.txt - output mouths and sources (grid coordinates) of segments and tributaries of ottorivers for the next level of ottoencoding (text file).

ottobasins - Generates the otto codification of basins from an D8 upstream flow directions grid, a Otto rivers grid.

th ottobasins inputD8.tif inputOttoRivers.tif outputOttoBasins.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputOttoRivers.tif - input ottorivers with codes of main river's segments and tributaries (raster).
  • outputOttoBasins.tif - output ottobasins associated to the ottorivers coded with the same unique integer values (raster).

mainriver - Generates the main river from an D8 upstream flow directions grid, a drainage grid, contributing area grid and a mouth text file.

th mainriver inputD8upstream.tif inputDrainage.tif inputAccumulatedArea.tif inputMouth.txt outputRiver.tif
  • inputD8upstream.tif - input D8 upstream flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • inputAccumulatedArea.tif - input D8 contributing area (raster).
  • inputMouth.txt - input mouth (grid coordinates) (text file).
  • outputRiver.tif - output main river of the drainage network traced upstream from the mouth according to the largest contributing areas (raster).

shreve - Generates the Shreve stream order from an D8 flow directions grid, a drainage grid, and a sources text file.

th shreve inputD8.tif inputDrainage.tif inputSources.txt outputShreve.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • inputSources.txt - input sources (grid coordinates) of the drainage network (text file).
  • outputShreve.tif - output Shreve order encoding of the drainage segments (raster).

strahler - Generates the Strahler stream order from an D8 flow directions grid, a drainage grid, and a sources text file.

th strahler inputD8.tif inputDrainage.tif inputSources.txt outputStrahler.tif
  • inputD8.tif - input D8 flow directions (raster).
  • inputDrainage.tif - input drainage network (raster).
  • inputSources.txt - input sources (grid coordinates) of the drainage network (text file).
  • outputStrahler.tif - output Strahler order encoding of the drainage segments (raster).

TerraHidro Plugin for QGIS Processing Toolbox

The TerraHidro Plugin for QGIS Processing Toolbox provides QGIS and TerraHidro users the interfaces that allow to execute all TerraHidro functionalities inside QGIS. First, the TerraHidro Plugin must be installed from the Plugins ⇒ Manage and Install Plugins option available in the QGIS menu bar. Just type in “terrahidro” in the search box, select the TerraHidro plugin, and click Install Plugin. Please, check the option “Show experimental plugins” under Options in the left menu. In addition, it is necessary to create an environment variable called TERRAHIDRO that points to the directory where the TerraHidro executable was extracted.

After the installation, the TerraHidro Plugin is added to the QGIS Processing Toolbox. The TerraHidro functionalities are organized in different groups, where each group includes the functionalities related to the type of processing required by the user, i.e. Basin, DEM, Drainage, and Flow tools.

For example, if the user wants to generate a reconditioned DEM using a drainage network, the agreedem functionality can be executed from the corresponding option found under the DEM Tools group. After opening the AgreeDEM interface, the input raster and vector data must be selected from the layers already inserted into the QGIS project together with the other input data values, as well as the output data to be generated.

As another example, the user can generate a drainage network that is traced from particular points specified as drainage sources. These points are informed as input data together with the D8 flow directions to form the flow paths that define the drainage network.

Contact

Write to the TerraHidro Team at henrique.renno@inpe.br (developer) or sergio.rosim@inpe.br (manager).

Previous Version

TerraHidro developed with Terralib 4: TerraHidro 0.4.X

This previous version of the TerraHidro system is not under development anymore, but it is still supported by the TerraHidro team.

Copyright (C) 2008-2014 National Institute For Space Research (INPE) - Brazil.

TerraHidro is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

TerraHidro is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

GNU LESSER GENERAL PUBLIC LICENSE

Version 3, 29 June 2007

Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.

0. Additional Definitions.

As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.

“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.

An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.

A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.

The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.

The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.

1. Exception to Section 3 of the GNU GPL.

You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.

2. Conveying Modified Versions.

If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:

  • a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
  • b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.

3. Object Code Incorporating Material from Library Header Files.

The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:

  • a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
  • b) Accompany the object code with a copy of the GNU GPL and this license document.

4. Combined Works.

You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:

  • a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
  • b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
  • c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
  • d) Do one of the following:
    • 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
    • 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
  • e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)

5. Combined Libraries.

You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:

  • a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
  • b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.

6. Revised Versions of the GNU Lesser General Public License.

The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.

If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.


QR Code
QR Code start (generated for current page)