R.stream.* modules: Difference between revisions
(+cat) |
(typos fixed; updates needed) |
||
Line 1: | Line 1: | ||
Modules r.stream.order r.stream.basins, r.stream.distance and r.stream.stats are prepared to perform Hortonian analysis in GRASS GIS. Modules can work with outputs data of r.watershed and r.stream.extract being | [[TOC]] | ||
Modules {{AddonCmd|r.stream.order}}, {{AddonCmd|r.stream.basins}}, {{AddonCmd|r.stream.distance}}, and {{AddonCmd|r.stream.stats}} are prepared to perform Hortonian analysis in GRASS GIS. Modules can work with outputs data of {{cmd|r.watershed}} and {{AddonCmd|r.stream.extract}} being prepared by Markus Metz. | |||
''NOTE: This page needs some updating.'' | |||
The tutorial/presentation was prepared with North Carolina Dataset. | The tutorial/presentation was prepared with North Carolina Dataset. | ||
Line 5: | Line 9: | ||
[http://grass.osgeo.org/download/data.php http://grass.osgeo.org/download/data.php] | [http://grass.osgeo.org/download/data.php http://grass.osgeo.org/download/data.php] | ||
As a base map elev_ned_30_m was used. Regions | As a base map 'elev_ned_30_m' was used. Regions settings for analysis: | ||
<pre> | <pre> | ||
projection: 99 (Lambert Conformal Conic) | projection: 99 (Lambert Conformal Conic) | ||
Line 24: | Line 28: | ||
[[File:Elevation_with_streams.jpg||350px|thumb|center|Digital elevation model with streams]] | [[File:Elevation_with_streams.jpg||350px|thumb|center|Digital elevation model with streams]] | ||
Because r.stream.extract is still in progress analysis will be based on r.watershed results. Stream network has been obtained with r.watershed in MFD mode: | Because r.stream.extract is still in progress (still valid? 4/2011) analysis will be based on r.watershed results. Stream network has been obtained with r.watershed in MFD mode: | ||
<pre>r.watershed -f elevation=elev threshold=700 accumulation=accum drainage=dirs stream=streams convergence=5</pre> | <pre>r.watershed -f elevation=elev threshold=700 accumulation=accum drainage=dirs stream=streams convergence=5</pre> | ||
Line 32: | Line 36: | ||
<pre">g.region rast=elev_ned_30_m</pre> | <pre">g.region rast=elev_ned_30_m</pre> | ||
For future analysis following map produced by r.watershed are | For future analysis following map produced by r.watershed are required: ''streams'' with streams network, ''dirs'' with flow direction and ''accum'' with flow accumulation. | ||
== r.stream.order == | == r.stream.order == | ||
Module r.stream. | Module {{AddonCmd|r.stream.order}} may order stream network according four most popular ordering systems. Module can create both all four at once or every order separate. The accumulation mas is an option necessary if you want to determine main channels in Horton and Hack Ordering based on accumulation instead of channel length | ||
<pre">r.stream.order stream=streams dir=dirs strahler=strahler shreve=shreeve horton=horton hack=hack</pre> | <pre">r.stream.order stream=streams dir=dirs strahler=strahler shreve=shreeve horton=horton hack=hack</pre> | ||
Line 49: | Line 53: | ||
== r.stream.basins == | == r.stream.basins == | ||
Module r.stream.basins is prepared to delineate basins and | Module {{AddonCmd|r.stream.basins}} is prepared to delineate basins and subbasins according user rules. It covers (in very small part) functionality of {{cmd|r.water.outlet}} and {{cmd|r.watershed}} but additionally it has much more possibilities which are presented in this section of tutorial. Module is prepared to delineate number of basins in one step. It requires only two maps direction and streams. In stream map we can store all information required to proper delineation. | ||
To | To delineate all basins with categories of streams simply use: | ||
<pre>r.stream.basins dir=dirs stream=streams basins=bas_basins_elem</pre> | <pre>r.stream.basins dir=dirs stream=streams basins=bas_basins_elem</pre> | ||
Line 57: | Line 61: | ||
[[File:bas_elem.png||350px|thumb|center|Elementary basins]] | [[File:bas_elem.png||350px|thumb|center|Elementary basins]] | ||
To delineate all basins | To delineate all basins defined by outlets, ignoring subbasins use similar code but with -l flag. That flag ignores all nodes and uses only real outlets (in most cases that on image border). That option is very useful to determine major and minor basins in area. | ||
<pre>r.stream.basins -l dir=dirs stream=streams basins=bas_basins_last</pree> | <pre>r.stream.basins -l dir=dirs stream=streams basins=bas_basins_last</pree> | ||
Line 64: | Line 68: | ||
[[File:bas_basin_last.png|350px|thumb|center|Main basins]] | [[File:bas_basin_last.png|350px|thumb|center|Main basins]] | ||
To | To delineate only one or more particular basin it require to reclass stream basin to the planned set. The fastest method is {{cmd|r.reclass}} but also {{cmd|r.mapcalc}} may replace r.reclass. The output is the last (downstream) cell of given stream: | ||
<pre> | <pre> | ||
Line 76: | Line 80: | ||
[[File:basin_1.png|350px|thumb|center|One basin]] | [[File:basin_1.png|350px|thumb|center|One basin]] | ||
It is also possible to use more than one stream as an output. If some stream will be | It is also possible to use more than one stream as an output. If some stream will be tributary of others it will produce subbasins in main basins. It can be eliminated with -l flag only if streams are in sequence. | ||
<pre> | <pre> | ||
Line 89: | Line 93: | ||
[[File:basin_3.png|350px|thumb|center|Three basins]] | [[File:basin_3.png|350px|thumb|center|Three basins]] | ||
Basin delineated in previous step can be used to cut off streams of that basin. In next step these streams can be used to | Basin delineated in previous step can be used to cut off streams of that basin. In next step these streams can be used to delineate subbasins of given basin: | ||
<pre> | <pre> | ||
Line 99: | Line 103: | ||
To delineate basins of particular order we must use the following procedure: | |||
<pre> | <pre> | ||
Line 109: | Line 113: | ||
</pre> | </pre> | ||
The flag -c must be used because all streams has category 2 (result of reclass operation). If we need basins with category of streams we must use little different approach. First with mapcalc procedure extract that streams with order 2, next use -l flag to | The flag -c must be used because all streams has category 2 (result of reclass operation). If we need basins with category of streams we must use little different approach. First with mapcalc procedure extract that streams with order 2, next use -l flag to create basins with category of last (downstream) segments | ||
<pre> | <pre> | ||
Line 120: | Line 124: | ||
To determine areas of contribution to streams of particular order we need only use as streams | To determine areas of contribution to streams of particular order we need only use as streams the result of ordering. | ||
<pre> | <pre> | ||
Line 127: | Line 131: | ||
[[File:Bas_contrib_strahler.png|350px|thumb|center|Areas of contribution to stream of particular order]] | [[File:Bas_contrib_strahler.png|350px|thumb|center|Areas of contribution to stream of particular order]] | ||
Basin can be terminated according user's input. For now input must be in raster format (vector format is planned in the feature). What is important input can be anything: lines, polygons or points. But it shall | Basin can be terminated according user's input. For now input must be in raster format (vector format is planned in the feature). What is important input can be anything: lines, polygons or points. But it shall overlapping with streams. It is very useful in situation, when we cannot determine the real route and identifier of streams but we can determine its most probable route (for example in hydrological simulation) we can mark with any area in place where link is most probable | ||
[[File:basin_points.png|350px|thumb|center|Basin outlets of custom shape]] | [[File:basin_points.png|350px|thumb|center|Basin outlets of custom shape]] | ||
The last example is a little beat complex but also easy to calculate. One of the most popular hydrological modeling is determination of areas of potential source of pollution. The example will be done for lake marked with FULL_HYDR 8056 in North Carolina sample dataset. The lake was extracted and converted to binary raster map. Next we can determine all basins contributing to the lake, | The last example is a little beat complex but also easy to calculate. One of the most popular hydrological modeling is determination of areas of potential source of pollution. The example will be done for lake marked with FULL_HYDR 8056 in North Carolina sample dataset. The lake was extracted and converted to binary raster map. Next we can determine all basins contributing to the lake, additionally with areas of lake where every basin contributes. | ||
<pre> | <pre> | ||
Line 142: | Line 146: | ||
File:bas_lake_dengerous.png|[[Areas of contribution to lake]] | File:bas_lake_dengerous.png|[[Areas of contribution to lake]] | ||
</gallery> | </gallery> | ||
== r.stream.distance == | == r.stream.distance == | ||
Module {{AddonCmd|r.stream.distance}} has been prepared to calculate distance to streams and outlets and elevation above streams and outlets. In outlets mode it can also calculate parameters for subbasins. | |||
Module r.stream.distance has been prepared to calculate distance to streams and outlets and elevation above streams and outlets. In outlets mode it can also calculate parameters for subbasins. | |||
The distance are calculated metres. It support both projected and LL locations. The distance is calculated for flat maps. To add topography correction use mapcalc formula | The distance are calculated metres. It support both projected and LL locations. The distance is calculated for flat maps. To add topography correction use mapcalc formula | ||
<pre>echo' dist_corrected = sqrt(distance^2 + elevation ^2)'|r.mapcalc</pre> | <pre>echo' dist_corrected = sqrt(distance^2 + elevation ^2)'|r.mapcalc</pre> | ||
Distance and elevation above streams | Distance and elevation above streams: | ||
<pre>r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream</pre> | <pre>r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream</pre> | ||
Line 158: | Line 162: | ||
</gallery> | </gallery> | ||
Distance and elevation above outlets | Distance and elevation above outlets: | ||
<pre>r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream</pre> | <pre>r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream</pre> | ||
Line 167: | Line 171: | ||
</gallery> | </gallery> | ||
Distance and elevation above outlets in subbasin mode | Distance and elevation above outlets in subbasin mode: | ||
<pre>r.stream.distance -o dir=dirs stream=streams dem=elev distance=distance_outlets elevation=elevation_outlets</pre> | <pre>r.stream.distance -o dir=dirs stream=streams dem=elev distance=distance_outlets elevation=elevation_outlets</pre> | ||
Line 184: | Line 188: | ||
== r.stream.stats == | == r.stream.stats == | ||
Module r.stream.stats was prepared to calculate statistics | Module {{AddonCmd|r.stream.stats}} was prepared to calculate statistics according ordered stream network map. These statistics are calculated according formulas given by R.Horton (1945). Because Horton do not defined precisely what is stream slope, I proposed 2 different approaches: first (slope) use cell-by-cell slope calculation, second (gradient) use difference between elevation of outlet and source of every channel to its length to calculate formula. Bifurcation ratio for every order is calculated according formula: n_streams[1]/n_stream[i+1] where i the current order and i+1 next higher order. For max order of the map number of streams is zero. Rest of the ratios are calculated in similar mode. The bifurcation and other ratios for the whole catchment (map) is calculated as mean i.e sum of all bifurcation ratio / max_order-1 (for max_order stream bifurcation ratio = 0). | ||
It is strongly recommended to extract stream network using basin map created with r.stream.basin. If whole stream order map is used the calculation will be performed but results may not have hydrological sense. | It is strongly recommended to extract stream network using basin map created with {{AddonCmd|r.stream.basin}}. If whole stream order map is used the calculation will be performed but results may not have hydrological sense. | ||
Stream network extracted from the whole network: | Stream network extracted from the whole network: | ||
Line 231: | Line 235: | ||
3 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.1576 | 0.0302 | 3 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.1576 | 0.0302 | ||
</pre> | </pre> | ||
== References == | |||
* J Jasiewicz, M Metz, 2011: A new GRASS GIS toolkit for Hortonian analysis of drainage networks, Computers & Geosciences. [http://dx.doi.org/10.1016/j.cageo.2011.03.003 DOI] | |||
[[Category: Documentation]] | [[Category: Documentation]] |
Revision as of 21:59, 1 May 2011
Modules r.stream.order, r.stream.basins, r.stream.distance, and r.stream.stats are prepared to perform Hortonian analysis in GRASS GIS. Modules can work with outputs data of r.watershed and r.stream.extract being prepared by Markus Metz.
NOTE: This page needs some updating.
The tutorial/presentation was prepared with North Carolina Dataset.
http://grass.osgeo.org/download/data.php
As a base map 'elev_ned_30_m' was used. Regions settings for analysis:
projection: 99 (Lambert Conformal Conic) zone: 0 datum: nad83 ellipsoid: a=6378137 es=0.006694380022900787 north: 228500 south: 215000 west: 630000 east: 645000 nsres: 30 ewres: 30 rows: 450 cols: 500 cells: 225000
Because r.stream.extract is still in progress (still valid? 4/2011) analysis will be based on r.watershed results. Stream network has been obtained with r.watershed in MFD mode:
r.watershed -f elevation=elev threshold=700 accumulation=accum drainage=dirs stream=streams convergence=5
Be sure you set the region for analysis before run it.
<pre">g.region rast=elev_ned_30_m
For future analysis following map produced by r.watershed are required: streams with streams network, dirs with flow direction and accum with flow accumulation.
r.stream.order
Module r.stream.order may order stream network according four most popular ordering systems. Module can create both all four at once or every order separate. The accumulation mas is an option necessary if you want to determine main channels in Horton and Hack Ordering based on accumulation instead of channel length
<pre">r.stream.order stream=streams dir=dirs strahler=strahler shreve=shreeve horton=horton hack=hack
To obtain Scheidegger's stream order is just enough multiply Shreve stream magnitude x2.
r.stream.basins
Module r.stream.basins is prepared to delineate basins and subbasins according user rules. It covers (in very small part) functionality of r.water.outlet and r.watershed but additionally it has much more possibilities which are presented in this section of tutorial. Module is prepared to delineate number of basins in one step. It requires only two maps direction and streams. In stream map we can store all information required to proper delineation.
To delineate all basins with categories of streams simply use:
r.stream.basins dir=dirs stream=streams basins=bas_basins_elem
To delineate all basins defined by outlets, ignoring subbasins use similar code but with -l flag. That flag ignores all nodes and uses only real outlets (in most cases that on image border). That option is very useful to determine major and minor basins in area.
r.stream.basins -l dir=dirs stream=streams basins=bas_basins_last</pree> [[File:bas_basin_last.png|350px|thumb|center|Main basins]] To delineate only one or more particular basin it require to reclass stream basin to the planned set. The fastest method is {{cmd|r.reclass}} but also {{cmd|r.mapcalc}} may replace r.reclass. The output is the last (downstream) cell of given stream: <pre> echo '42=42 * = NULL' > tmp1 r.reclass input=streams output=sel_streams_1 <tmp1 r.stream.basins dir=dirs stream=streams basins=bas_basin_1
It is also possible to use more than one stream as an output. If some stream will be tributary of others it will produce subbasins in main basins. It can be eliminated with -l flag only if streams are in sequence.
echo '42 = 42 252 = 252 188 = 188 * = NULL' >tmp r.reclass input=streams output=sel_streams_1 <tmp1 r.stream.basins dir=dirs stream=streams basins=bas_basin_3
Basin delineated in previous step can be used to cut off streams of that basin. In next step these streams can be used to delineate subbasins of given basin:
echo 'sel_all_streams_42 = if(bas_basin_1,streams,null())'|r.mapcalc r.stream.basins dir=dirs stream=sel_all_streams_42 basins=bas_elem_42
To delineate basins of particular order we must use the following procedure:
echo '2 = 2 * = NULL' > tmp r.reclass input=ord_strahler output=sel_strahler_2 < tmp r.stream.basins -c dir=dirs stream=sel_strahler_2 basins=bas_basin_strahler_2
The flag -c must be used because all streams has category 2 (result of reclass operation). If we need basins with category of streams we must use little different approach. First with mapcalc procedure extract that streams with order 2, next use -l flag to create basins with category of last (downstream) segments
echo 'sel_strahler_cat_2 =if(ord_strahler==2,streams,null())'|r.mapcalc r.stream.basins -l dir=dirs stream=sel_strahler_2 basins=bas_basin_strahler_2
To determine areas of contribution to streams of particular order we need only use as streams the result of ordering.
r.stream.basins dir=dirs stream=ord_strahler basins=bas_basin_strahler
Basin can be terminated according user's input. For now input must be in raster format (vector format is planned in the feature). What is important input can be anything: lines, polygons or points. But it shall overlapping with streams. It is very useful in situation, when we cannot determine the real route and identifier of streams but we can determine its most probable route (for example in hydrological simulation) we can mark with any area in place where link is most probable
The last example is a little beat complex but also easy to calculate. One of the most popular hydrological modeling is determination of areas of potential source of pollution. The example will be done for lake marked with FULL_HYDR 8056 in North Carolina sample dataset. The lake was extracted and converted to binary raster map. Next we can determine all basins contributing to the lake, additionally with areas of lake where every basin contributes.
v.extract -d input=lakes@PERMANENT output=lake8056 type=area layer=1 'where=FULL_HYDRO = 8056' new=-1 v.to.rast input=lake8056@horton output=lake8056 use=val type=area layer=1 value=1 echo 'sel_streams_lake=if(lake8056,streams,null())'|r.mapcalc r.stream.basins dir=dirs stream=sel_streams_lake basins=bas_basin_lake
r.stream.distance
Module r.stream.distance has been prepared to calculate distance to streams and outlets and elevation above streams and outlets. In outlets mode it can also calculate parameters for subbasins. The distance are calculated metres. It support both projected and LL locations. The distance is calculated for flat maps. To add topography correction use mapcalc formula
echo' dist_corrected = sqrt(distance^2 + elevation ^2)'|r.mapcalc
Distance and elevation above streams:
r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream
Distance and elevation above outlets:
r.stream.distance dir=dirs stream=streams dem=elev distance=distance_stream elevation=elevation_stream
Distance and elevation above outlets in subbasin mode:
r.stream.distance -o dir=dirs stream=streams dem=elev distance=distance_outlets elevation=elevation_outlets
r.stream.distance -o -s dir=dirs stream=streams dem=elev distance=distance_outlets elevation=elevation_outlets
r.stream.stats
Module r.stream.stats was prepared to calculate statistics according ordered stream network map. These statistics are calculated according formulas given by R.Horton (1945). Because Horton do not defined precisely what is stream slope, I proposed 2 different approaches: first (slope) use cell-by-cell slope calculation, second (gradient) use difference between elevation of outlet and source of every channel to its length to calculate formula. Bifurcation ratio for every order is calculated according formula: n_streams[1]/n_stream[i+1] where i the current order and i+1 next higher order. For max order of the map number of streams is zero. Rest of the ratios are calculated in similar mode. The bifurcation and other ratios for the whole catchment (map) is calculated as mean i.e sum of all bifurcation ratio / max_order-1 (for max_order stream bifurcation ratio = 0). It is strongly recommended to extract stream network using basin map created with r.stream.basin. If whole stream order map is used the calculation will be performed but results may not have hydrological sense.
Stream network extracted from the whole network:
echo 'tmp_stream=if(bas_basin_3==242,streams,null())'|r.mapcalc r.stream.stats r.stream.stats stream=tmp_stream dir=dirs dem=elev
summary result:
Summary: Max order | Tot.N.str. | Tot.str.len. | Tot.area. | Dr.dens. | Str.freq. 3 | 14 | 28.4911 | 33.0822 | 0.8612 | 0.4232 Stream ratios with standard deviations: Bif.rt. | Len.rt. | Area.rt. | Slo.rt. | Grd.rt. 3.1667 | 0.5807 | 0.2590 | 1.6552 | 2.1745 0.2357 | 0.2062 | 0.0385 | 0.0679 | 0.8689 Order | Avg.len | Avg.ar | Avg.sl | Avg.grad. | Avg.el.dif num | (km) | (km2) | (m/m) | (m/m) | (m) 1 | 1.6473 | 2.1943 | 0.0117 | 0.0096 | 13.7182 2 | 2.2676 | 7.6665 | 0.0073 | 0.0034 | 8.5856 3 | 5.2147 | 33.0822 | 0.0043 | 0.0022 | 11.5075 Order | Std.len | Std.ar | Std.sl | Std.grad. | Std.el.dif num | (km) | (km2) | (m/m) | (m/m) | (m) 1 | 1.4628 | 1.8567 | 0.0023 | 0.0026 | 10.6447 2 | 2.8040 | 9.8164 | 0.0010 | 0.0020 | 10.0869 3 | -0.0000 | 0.0000 | -0.0000 | -0.0000 | -0.0000 Order | N.streams | Tot.len (km) | Tot.area (km2) 1 | 10 | 16.4734 | 21.9429 2 | 3 | 6.8029 | 22.9995 3 | 1 | 5.2147 | 33.0822 Order | Bif.rt. | Len.rt. | Area.rt. | Slo.rt. | Grd.rt. | d.dens. | str.freq. 1 | 3.3333 | 0.7265 | 0.2862 | 1.6072 | 2.7888 | 0.7507 | 0.4557 2 | 3.0000 | 0.4349 | 0.2317 | 1.7033 | 1.5601 | 0.2958 | 0.1304 3 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.0000 | 0.1576 | 0.0302
References
- J Jasiewicz, M Metz, 2011: A new GRASS GIS toolkit for Hortonian analysis of drainage networks, Computers & Geosciences. DOI