R.stream.* modules: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 163: Line 163:


<gallery widths=300 heights=300 perrow>
<gallery widths=300 heights=300 perrow>
File:Distance_outlet.png|[[Distance to the outlet]]  
File:Distance_outlets.png|[[Distance to the outlet]]  
File:Elevation_outlet.png|[[Elevation above the outlet]]
File:Elevation_outlet.png|[[Elevation above the outlet]]
</gallery>
</gallery>

Revision as of 09:50, 6 October 2009

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 preparing by Markus Metz.

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 setings 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
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:

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 requied: streams with streams network, dirs with flow direction and accum with flow accumulation.


r.stream.order

Module r.stream.strahler may order stream network according four most popular ordering systems. Module can create both all four at once or every order separete

<pre">r.stream.order stream=streams dir=dirs accum=accum 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 subasins according user rules. I covers (in very small part) funcionalty of r.water.outlet and r.watershed but addationaly has much more posibilities which are presented in this section of tutorial. Module is prepared to delineate number of basins in one step. It requires only two maps direciton and streams. In stream map we can store all information required to proper delineation.

To delinaate all basins with categories of streams simply use:

r.stream.basins dir=dirs stream=streams basins=bas_basins_elem
Elementary basins

To delineate all basins definied 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 delinaeate only one or more particular basin it require to reclass stream basin to theplaned set. The fastest method is r.reclass but also r.mapcalc may repcalce 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 
One basin

It is also possible to use more than one stream as an output. If some stream will be tributurary 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
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 delinaeate 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
main basin and subbasins with streams


Do 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 creatre 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
Basin of order 2 with unique categories


To determine areas of contribution to streams of particular order we need only use as streams teh result of ordering.

r.stream.basins dir=dirs stream=ord_strahler basins=bas_basin_strahler
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 overlaping 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

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, addationally 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