calc_subbas | R Documentation |
Takes DEM from a GRASS location and a file of drainage locations to calculate hydrological subbasins for each drainage point using GRASS functions.
calc_subbas(
dem = NULL,
drain_points = NULL,
river = NULL,
flowaccum = NULL,
drainage_dir = NULL,
disk_swap = FALSE,
basin_out = NULL,
stream = NULL,
points_processed = NULL,
outlet = NULL,
thresh_stream = NULL,
thresh_sub = NULL,
snap_dist = NULL,
rm_spurious = 0.01,
keep_temp = F,
overwrite = F,
silent = F
)
dem |
Digital Elevation Model in GRASS location used for delineation of subbasins. Should be larger than the expected catchment, otherwise artefacts close to boundaries may occur. |
drain_points |
|
river |
River vector map in GRASS location if available. If set to |
flowaccum |
(optional) Existing raster map of flow accumulation in GRASS location. Must correspond to map generated by |
drainage_dir |
(optional) Existing raster map of drainage direction in GRASS location. Must correspond to map generated by |
disk_swap |
(optional) Only needed if memory requirements exceed available RAM (large DEMs): If set to |
basin_out |
Output: Name of subbasins raster map exported into GRASS location. |
stream |
Output: Prefix of calculated stream segments vector (<stream>_vect) and
raster (<stream>_rast) maps exported into GRASS location. Only generated if
|
points_processed |
Output: Prefix of point vector files exported to GRASS location.
|
outlet |
Integer (row number) defining the catchment outlet in |
thresh_stream |
Integer defining threshold for stream calculation. Raster
cells in accumulation map with values greater than thresh_stream are
considered as streams. Needs to be set only if |
thresh_sub |
Integer defining threshold for subbasin calculation. Parameter for
GRASS function r.watershed defining the minimum size of an exterior
watershed basin in number of grid cells. If |
snap_dist |
Integer defining maximum distance for snapping of |
rm_spurious |
|
keep_temp |
|
overwrite |
|
silent |
|
The function constructs subbasins based on param drain_points
(if given) and param thresh_sub
(if given). Both are merged, preserving the former outlet points, if present.
Function returns nothing. Various output is generated in the GRASS-location:
stream segmentsIf river
is not supplied, vector (<stream>_vect) and raster (<stream>_rast) will be generated.
Subbasin mapraster map basin_out
If keep_temp=TRUE
, the following temporary maps are preserved and can be used for tracing errors:
accum_t
If flowaccum
is not supplied, contains map of flow accumulation.
drain_t
If flowaccum
is not supplied, contains map of darinage direction.
<points_processed>_t
Raw subbasin outlet points.
<points_processed>_centered_t
Subbasin outlet points centered at cell centers.
<points_processed>_shifted_t
Subbasin outlet points shifted slightly out of centers (for preventing pathological cases while snapping).
<points_processed>_snapped_t
Raw subbasin outlet points snapped to closest river.
<points_processed>_calc_t
internally calculated drain points (only if parameter thresh_sub is not NULL).
<points_processed>_all_t
combined drain points as raster (easier to identify double drain points sharing one raster cell).
Prepare GRASS location and necessary raster files in advance and start
GRASS session in R using initGRASS
. Location
should not contain any maps ending on *_t as these will be removed by
calling the function to remove temporary maps.
You should select your DEM sufficiently large. Otherwise, the resulting catchment might be truncated or boundaries influence the calculation of stream segments.
Check the results (subbasins and snapped points). In case points have been snapped
to the wrong stream segment, adjust point locations manually in GRASS and re-run
the function with the updated locations (use readVECT
to import the updated drainage points).
Generated raster and vector stream maps might slightly deviate from each other as the raster map is thinned (GRASS function r.thin) prior to conversion to a vector map to ensure strictly linear features.
If you run into memory issues, consider argument disk_swap
(see also
https://grass.osgeo.org/grass74/manuals/r.watershed.html#in-memory-mode-and-disk-swap-mode)
and see discussion on https://github.com/tpilz/lumpR/issues/16.
Tobias Pilz tpilz@uni-potsdam.de
lumpR package introduction with literature study and sensitivity analysis:
Pilz, T.; Francke, T.; Bronstert, A. (2017): lumpR 2.0.0: an R package facilitating
landscape discretisation for hillslope-based hydrological models.
Geosci. Model Dev., 10, 3001-3023, doi: 10.5194/gmd-10-3001-2017
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.