r.watershed
Watershed basin analysis program.
- Provided by: grass-doc (Version: 6.4.3-3)
- Source: grass
- Report a bug
Watershed basin analysis program.
raster, hydrology
r.watershed
r.watershed help
r.watershed [-f4ma] elevation=name
[depression=name] [flow=name]
[disturbed.land=string] [blocking=name]
[accumulation=name] [drainage=name]
[basin=name] [stream=name]
[half.basin=name] [visual=name]
[length.slope=name] [slope.steepness=name]
[threshold=integer] [max.slope.length=float]
[convergence=integer] [memory=integer]
[--overwrite] [--verbose] [--quiet]
r.watershed generates a set of maps indicating: 1) flow accumulation, drainage direction, the location of streams and watershed basins, and 2) the LS and S factors of the Revised Universal Soil Loss Equation (RUSLE).
r.watershed uses an AT least-cost search algorithm (see REFERENCES section) designed to minimize the impact of DEM data errors. Compared to r.terraflow, this algorithm provides more accurate results in areas of low slope as well as DEMs constructed with techniques that mistake canopy tops as the ground elevation. Kinner et al. (2005), for example, used SRTM and IFSAR DEMs to compare r.watershed against r.terraflow results in Panama. r.terraflow was unable to replicate stream locations in the larger valleys while r.watershed performed much better. Thus, if forest canopy exists in valleys, SRTM, IFSAR, and similar data products will cause major errors in r.terraflow stream output. Under similar conditions, r.watershed will generate better stream and half_basin results. If watershed divides contain flat to low slope, r.watershed will generate better basin results than r.terraflow. (r.terraflow uses the same type of algorithm as ESRI's ArcGIS watershed software which fails under these conditions.) Also, if watershed divides contain forest canopy mixed with uncanopied areas using SRTM, IFSAR, and similar data products, r.watershed will generate better basin results than r.terraflow. The algorithm produces results similar to those obtained when running r.cost and r.drain on every cell on the map.
r.watershed offers two methods to calculate surface flow: single flow direction (SFD, D8) and multiple flow direction (MFD). With MFD, water flow is distributed to all neighbouring cells with lower elevation, using slope towards neighbouring cells as a weighing factor for proportional distribution. The AT least-cost path is always included. As a result, depressions and obstacles are traversed with a gracefull flow convergence before the overflow. The convergence factor causes flow accumulation to converge more strongly with higher values. The supported range is 1 to 10, recommended is a convergence factor of 5 (Holmgren, 1994). If many small sliver basins are created with MFD, setting the convergence factor to a higher value can reduce the amount of small sliver basins.
There are two versions of this program: ram and seg.
ram is used by default, seg can be used by setting the
-m flag.
The ram version requires a maximum of 31 MB of RAM for 1 million cells.
Together with the amount of system memory (RAM) available, this value can be
used to estimate whether the current region can be processed with the
ram version.
The ram version uses virtual memory managed by the operating system to
store all the data structures and is faster than the seg version;
seg uses the GRASS segmentation library which manages data in disk
files. seg uses only as much system memory (RAM) as specified with
the memory option, allowing other processes to operate on the same
system, even when the current geographic region is huge.
Due to memory requirements of both programs, it is quite easy to run out of
memory when working with huge map regions. If the ram version runs
out of memory and the resolution size of the current geographic region
cannot be increased, either more memory needs to be added to the computer,
or the swap space size needs to be increased. If seg runs out of
memory, additional disk space needs to be freed up for the program to run.
The r.terraflow module was specifically designed with huge regions in
mind and may be useful here as an alternative.
In some situations, the region size (number of cells) may be too large for the amount of time or memory available. Running r.watershed may then require use of a coarser resolution. To make the results more closely resemble the finer terrain data, create a map layer containing the lowest elevation values at the coarser resolution. This is done by: 1) Setting the current geographic region equal to the elevation map layer with g.region, and 2) Use the r.neighbors or r.resamp.stats command to find the lowest value for an area equal in size to the desired resolution. For example, if the resolution of the elevation data is 30 meters and the resolution of the geographic region for r.watershed will be 90 meters: use the minimum function for a 3 by 3 neighborhood. After changing to the resolution at which r.watershed will be run, r.watershed should be run using the values from the neighborhood output map layer that represents the minimum elevation within the region of the coarser cell.
The minimum size of drainage basins, defined by the threshold parameter, is only relevant for those watersheds with a single stream having at least the threshold of cells flowing into it. (These watersheds are called exterior basins.) Interior drainage basins contain stream segments below multiple tributaries. Interior drainage basins can be of any size because the length of an interior stream segment is determined by the distance between the tributaries flowing into it.
The r.watershed program does not require the user to have the current geographic region filled with elevation values. Areas without elevation data (masked or NULL cells) are ignored. It is NOT necessary to create a raster map (or raster reclassification) named MASK for NULL cells. Areas without elevation data will be treated as if they are off the edge of the region. Such areas will reduce the memory necessary to run the program. Masking out unimportant areas can significantly reduce processing time if the watersheds of interest occupy a small percentage of the overall area.
Gaps (NULL cells) in the elevation map that are located within the area of interest will heavily influence the analysis: water will flow into but not out of these gaps. These gaps must be filled beforehand, e.g. with r.fillnulls.
Zero (0) and negative values will be treated as elevation data (not no_data).
To isolate an individual river network using the output of this module, a number of approaches may be considered.
All individual river networks in the stream segments output can be identified through their ultimate outlet points. These points are all cells in the stream segments output with negative drainage direction. These points can be used as start points for r.water.outlet or v.net.iso.
To create river mile segmentation from a vectorized streams map, try the v.net.iso or v.lrs.segment modules.
The stream segments output can be easily vectorized after thinning with r.thin. Each stream segment in the vector map will have the value of the associated basin. To isolate subbasins and streams for a larger basin, a MASK for the larger basin can be created with r.water.outlet. The stream segments output serves as a guide where to place the outlet point used as input to r.water.outlet. The basin threshold must have been sufficiently small to isolate a stream network and subbasins within the larger basin.
These examples use the Spearfish sample dataset.
Convert r.watershed streams map output to a vector layer.
If you want a detailed stream network, set the threshold option
small to create lots of catchment basins, as only one stream is presented
per catchment. The r.to.vect -v flag preserves the catchment ID as the
vector category number.
r.watershed elev=elevation.dem stream=rwater.stream
r.to.vect -v in=rwater.stream out=rwater_stream
Set a different color table for the accumulation map:
MAP=rwater.accum
r.watershed elev=elevation.dem accum=$MAP
eval `r.univar -g "$MAP"`
stddev_x_2=`echo $stddev | awk '{print $1 * 2}'`
stddev_div_2=`echo $stddev | awk '{print $1 / 2}'`
r.colors $MAP col=rules << EOF
0% red
-$stddev_x_2 red
-$stddev yellow
-$stddev_div_2 cyan
-$mean_of_abs blue
0 white
$mean_of_abs blue
$stddev_div_2 cyan
$stddev yellow
$stddev_x_2 red
100% red
EOF
Create a more detailed stream map using the accumulation map and
convert it to a vector output map. The accumulation cut-off, and therefore
fractal dimension, is arbitrary; in this example we use the map's mean
number of upstream catchment cells (calculated in the above example by
r.univar) as the cut-off value. This only works with SFD, not with
MFD.
r.watershed elev=elevation.dem accum=rwater.accum
r.mapcalc 'MASK = if(!isnull(elevation.dem))'
r.mapcalc "rwater.course = \
if( abs(rwater.accum) > $mean_of_abs, \
abs(rwater.accum), \
null() )"
r.colors -g rwater.course col=bcyr
g.remove MASK
# Thinning is required before converting raster lines to vector
r.thin in=rwater.course out=rwater.course.Thin
r.colors -gn rwater.course.Thin color=grey
r.to.vect in=rwater.course.Thin out=rwater_course feature=line
v.db.dropcol map=rwater_course column=label
Create watershed basins map and convert to a vector polygon map
r.watershed elev=elevation.dem basin=rwater.basin thresh=15000
r.to.vect -s in=rwater.basin out=rwater_basins feature=area
v.db.dropcol map=rwater_basins column=label
v.db.renamecol map=rwater_basins column=value,catchment
Display output in a nice way
r.shaded.relief map=elevation.dem
d.shadedmap rel=elevation.dem.shade drape=rwater.basin bright=40
d.vect rwater_course color=orange
Ehlschlaeger, C. (1989). Using the AT Search Algorithm
to Develop Hydrologic Models from Digital Elevation Data,
Proceedings of International Geographic Information Systems (IGIS)
Symposium '89, pp 275-281 (Baltimore, MD, 18-19 March 1989).
URL: http://chuck.ehlschlaeger.info/older/IGIS/paper.html
Holmgren, P. (1994). Multiple flow direction algorithms for
runoff modelling in grid based elevation models: An empirical
evaluation. Hydrological Processes Vol 8(4), p.327-334.
DOI: 10.1002/hyp.3360080405
Kinner D., H. Mitasova, R. Harmon, L. Toma, R., Stallard. (2005).
GIS-based Stream Network Analysis for The Chagres River Basin,
Republic of Panama. The Rio Chagres: A Multidisciplinary Profile
of a Tropical Watershed, R. Harmon (Ed.), Springer/Kluwer,
p.83-95.
URL: http://skagit.meas.ncsu.edu/~helena/measwork/panama/panama.html
McCool et al. (1987). Revised Slope Steepness Factor for the Universal Soil Loss Equation, Transactions of the ASAE Vol 30(5).
Weltz M. A., K. G. Renard, J. R. Simanton (1987). Revised Universal Soil Loss Equation for Western Rangelands, U.S.A./Mexico Symposium of Strategies for Classification and Management of Native Vegetation for Food Production In Arid Zones (Tucson, AZ, 12-16 Oct. 1987).
g.region, r.cost, r.drain, r.fillnulls, r.flow, r.mask, r.neighbors, r.param.scale, r.resamp.interp, r.terraflow, r.topidx, r.water.outlet
Original version: Charles Ehlschlaeger, U.S. Army Construction
Engineering Research Laboratory
Faster sorting algorithm and MFD support: Markus Metz
Last changed: $Date: 2010-09-16 00:25:59 -0700 (Thu, 16 Sep 2010) $
Full index
© 2003-2013 GRASS Development Team