TerraHidro Wiki Page

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
start [2023/05/26 13:26]
189.18.138.211 [All functionalities]
start [2025/02/28 15:07] (current)
henrique [Contact]
Line 2: Line 2:
 ===== Download ===== ===== Download =====
  
-  * Last stable release ​(10/​05/​2023):\\+  * Last stable release:\\
  
-- Windows: ​[[http://www.dpi.inpe.br/terrahidro/download/TerraHidro-5.2.0.exe|TerraHidro-5.2.0.exe]]\\ +- Windows ​(19/​02/​2025)https://drive.google.com/drive/folders/13N77EyJcHiL1u6audwLgqXoTl1mJD-bG?​usp=drive_link\\
-- Linux: [[http://​www.dpi.inpe.br/​terrahidro/​download/​terrahidro-5.2.0.tar.gz|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.\\ 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//​).\\ - 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á):​\\   * Input data for examples (lower Tocantins region known as Acará-Guamá):​\\
Line 62: Line 58:
 <​code>​ <​code>​
 C:​\data>​th minibasins tocantinsD8.tif tocantinsSegments.tif tocantinsMinibasins.tif C:​\data>​th minibasins tocantinsD8.tif tocantinsSegments.tif tocantinsMinibasins.tif
 +</​code>​
 +
 +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** ([[http://​www.dpi.inpe.br/​terrahidro/​download/​generalize_line.bat|generalize_line.bat]]) and **generalize_polygon.bat** ([[http://​www.dpi.inpe.br/​terrahidro/​download/​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).
 +<​code>​
 +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
 </​code>​ </​code>​
 ===== Example 2: improvements to match a reference drainage network ===== ===== Example 2: improvements to match a reference drainage network =====
Line 304: Line 310:
   * inputDrainage.tif - input drainage network (raster).   * inputDrainage.tif - input drainage network (raster).
   * outputSAND.tif - output Slope Above Nearest Drainage (raster).   * outputSAND.tif - output Slope Above Nearest Drainage (raster).
 +**gfplain** - Generates the floodplain and water height grids from a DEM grid, a D8 flow directions grid, a contributing area grid, a drainage network grid, and parameters of power law h=a*A^b.
 +<​code>​
 +th gfplain inputDEM.tif inputD8.tif inputContributingArea.tif inputDrainage.tif inputA inputB outputFloodplain.tif outputWaterHeight.tif
 +</​code>​
 +  * inputDEM.tif - input DEM (raster).
 +  * inputD8.tif - input D8 flow directions (raster).
 +  * inputContributingArea.tif - input contributing area (raster).
 +  * inputDrainage.tif - input drainage network (raster).
 +  * inputA - parameter a of power law.
 +  * inputB - parameter b of power law.
 +  * outputFloodplain.tif - output floodplain delineated from water heights on drainage network (raster).
 +  * outputWaterHeight.tif - output water height computed from contributed area with power law (raster).
 **segments** - Generates the segments from a D8 flow directions grid and a drainage network grid. **segments** - Generates the segments from a D8 flow directions grid and a drainage network grid.
 <​code>​ <​code>​
Line 351: Line 369:
   * inputSources.shp - input drainage source points to initiate flow paths (vector).   * 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).   * outputFlowPaths.tif - output flow paths that follow the D8 flow directions from each drainage source point (raster).
 +**watercourses** - Generates water courses from contributing areas.
 +<​code>​
 +th watercourses inputD8upstream.tif inputContributingArea.tif outputWaterCourses.tif
 +</​code>​
 +  * inputD8upstream.tif - input D8 upstream flow directions (raster).
 +  * inputContributingArea.tif - input contributing area (raster).
 +  * outputWaterCourses.tif - output water courses formed upstream by following the largest contributing areas (raster).
 +**damcourse** - Generates water courses from dam breaks given dam points, subbasins of Q5 specific discharges, D8 flow directions grid, and contributing area grid, limiting length from either only Qpeak/Q5 ratio or also height and volume of dam (input data with projection of units in meters).
 +<​code>​
 +th damcourse inputDams.shp inputQ5Subbasins.shp inputD8.tif inputContributingArea.tif Q5LENGTH|HVLENGTH outputDams.shp outputWaterCourses.shp
 +</​code>​
 +  * inputDams.shp - input points of dams (vector) with attributes: id (int64), height (double), volume (double), Qpeak (double, -1.0 to use equation), equationQpeak (int32, 0 = FROEHLICH / 1 = FERLA).
 +  * inputQ5Subbasins.shp - input polygons of specific Q5 discharge (vector) with attribute: Q5_m3sKm2 (real).
 +  * inputD8.tif - input D8 flow directions (raster).
 +  * inputContributingArea.tif - input contributing area (raster).
 +  * Q5LENGTH|HVLENGTH - parameter to limit length of water course from either only peak and specific discharges (Qpeak and Q5) or also height and volume of dam.
 +  * outputDams.shp - output points of dams (vector) with new attribute of peak discharge from equation: calcQpeak (double).
 +  * outputWaterCourses.shp - output water courses (vector).
 +**damsections** - Generates sections on water courses from dam breaks given water courses, number and length of sections (input data with projection of units in meters).
 +<​code>​
 +th damsections inputWaterCourses.shp SECTIONS LENGTH outputSections.shp
 +</​code>​
 +  * inputWaterCourses.shp - input water courses (vector).
 +  * SECTIONS - number of sections.
 +  * LENGTH - length of sections.
 +  * outputSections.shp - output sections (vector).
 +**dambreak** - Generates water course basin, water height, floodplain, water flow velocity, and hydrodynamic hazard from breaking of dams (input data with projection of units in meters).
 +<​code>​
 +th dambreak inputDams.shp inputWaterCourses.shp inputSections.shp inputDEM.tif inputD8.tif inputD8Upstream.tif inputContributingArea.tif inputManning MSANA1|MSANA2 outputDirectory outputSections.shp outputWaterCourseSegments.shp outputWaterCourseBasin.tif outputWaterHeight.tif outputFloodplain.tif outputVelocity.tif outputHydrodynamicHazard.tif
 +</​code>​
 +  * inputDams.shp - input points of dams (vector) with attributes: id (int64), height (double), volume (double), Qpeak (double, -1.0 to use equation), equationQpeak (int32, 0 = FROEHLICH / 1 = FERLA).
 +  * inputWaterCourses.shp - input water courses (vector).
 +  * inputSections.shp - input sections (vector).
 +  * inputDEM.tif - input DEM (raster).
 +  * inputD8.tif - input D8 flow directions (raster).
 +  * inputD8upstream.tif - input D8 upstream flow directions (raster).
 +  * inputContributingArea.tif - input contributing area (raster).
 +  * inputManning - input Manning coefficient.
 +  * MSANA1|MSANA2 - input parameter for method of decaying discharges.
 +  * outputDirectory - output directory for output files (raster for output variables, dambasin for cropping of output variables, and profiles with text files for output information of water course and sections).
 +  * outputSections.shp - output sections (vector) with new attributes relative to water course point: DEM elevation, cross section wetted area, discharge, water height, water level, water flow velocity, and hydrodynamic hazard.
 +  * outputWaterCourseSegments.shp - output water course segments (vector) traced between sections with attributes: coordinates and elevation of initial/end points, length, slope, discharge, water height, water level, water flow velocity, and hydrodynamic hazard
 +  * outputWaterCourseBasin.tif - output basin of water course (raster).
 +  * outputWaterHeight.tif - output water height (raster).
 +  * outputFloodplain.tif - output floodplain (raster).
 +  * outputVelocity.tif - output water flow velocity (raster).
 +  * outputHydrodynamicHazard.tif - output hydrodynamic hazard (raster).
 **fill** - Fills voids of a DEM data (e.g. SRTM 30 m) using a reference DEM data (e.g. SRTM 90 m). **fill** - Fills voids of a DEM data (e.g. SRTM 30 m) using a reference DEM data (e.g. SRTM 90 m).
 <​code>​ <​code>​
Line 412: Line 477:
   * inputDrainage.tif - input drainage network (raster).   * inputDrainage.tif - input drainage network (raster).
   * inputAccumulatedArea.tif - input D8 contributing area (raster).   * inputAccumulatedArea.tif - input D8 contributing area (raster).
-  * putMouth.txt - input mouth (grid coordinates) (text file).+  * 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).   * 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. **shreve** - Generates the Shreve stream order from an D8 flow directions grid, a drainage grid, and a sources text file.
Line 418: Line 483:
 th shreve inputD8.tif inputDrainage.tif inputSources.txt outputShreve.tif th shreve inputD8.tif inputDrainage.tif inputSources.txt outputShreve.tif
 </​code>​ </​code>​
 +  * 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. **strahler** - Generates the Strahler stream order from an D8 flow directions grid, a drainage grid, and a sources text file.
 <​code>​ <​code>​
 th strahler inputD8.tif inputDrainage.tif inputSources.txt outputStrahler.tif th strahler inputD8.tif inputDrainage.tif inputSources.txt outputStrahler.tif
 </​code>​ </​code>​
 +  * 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 ===== ===== TerraHidro Plugin for QGIS Processing Toolbox =====
  
Line 441: Line 514:
 ===== Contact ===== ===== Contact =====
  
-Write to the TerraHidro Team at <​henrique.renno@inpe.br>​ (developer) or <​sergio.rosim@inpe.br>​ (manager).+Write to the TerraHidro Team at <​sergio.rosim@inpe.br>​ (manager).
 ===== Previous Version ===== ===== Previous Version =====
  

QR Code
QR Code start (generated for current page)