ch_wbt_catchment_onestep {CSHShydRology} | R Documentation |
Delineates a catchment in a single step
Description
Calls all of the ch_wbt
and other functions required to do the sub-tasks
required to delineate a catchment. The names of files to be created
are taken from the list created by the function ch_wbt_filenames
.
Usage
ch_wbt_catchment_onestep(
wd,
in_dem,
pp_sf,
sink_method = "breach_leastcost",
dist = NULL,
check_catchment = TRUE,
threshold = NULL,
snap_dist = NULL,
cb_colour = "red",
pp_colour = "red",
channel_colour = "blue",
contour_colour = "grey",
plot_na = TRUE,
plot_scale = TRUE,
na_location = "tr",
scale_location = "bl",
...
)
Arguments
wd |
Name of working directory. |
in_dem |
File name for original DEM. |
pp_sf |
Vector containing pour points. |
sink_method |
Method for sink removal as used by |
dist |
Maximum search distance for breach paths in cells. Required if |
check_catchment |
If |
threshold |
Threshold for channel initiation. |
snap_dist |
Maximum pour point snap distance in map units. |
cb_colour |
Colour for catchment outline. Default is "red". |
pp_colour |
Colour for catchment pour points. Default is "red". |
channel_colour |
Colour for channel. Default is "blue". |
contour_colour |
Colour for contours Default is "grey". |
plot_na |
If |
plot_scale |
If |
na_location |
Location for the north arrow. Default is tr, i.e. top-right. |
scale_location |
Location for the scale bar. Default is bl, i.e. bottom-left. |
... |
Extra parameters for |
Value
Returns an sp object of the delineated catchment.
Author(s)
Dan Moore and Kevin Shook
See Also
Examples
# Only proceed if Whitebox executable is installed
library(whitebox)
if (check_whitebox_binary()){
library(raster)
test_raster <- ch_volcano_raster()
dem_raster_file <- tempfile(fileext = c(".tif"))
# write test raster to file
writeRaster(test_raster, dem_raster_file, format = "GTiff")
wd <- tempdir()
pourpoint_file <- tempfile("volcano_pourpoints", fileext = ".shp")
pourpoints <- ch_volcano_pourpoints(pourpoint_file)
catchment <- ch_wbt_catchment_onestep(wd = wd, in_dem = dem_raster_file,
pp_sf = pourpoints, sink_method = "fill", threshold = 1, snap_dist = 10)
} else {
message("Examples not run as Whitebox executable not found")
}