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 ch_wbt_removesinks.

dist

Maximum search distance for breach paths in cells. Required if sink_method = "breach_leastcost".

check_catchment

If TRUE (the default) ch_checkcatchment will be called after the catchment is created.

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 TRUE (the default) a north arrow is added to the plot.

plot_scale

If TRUE (the default) a scale bar is added to the plot.

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 ch_wbt_removesinks.

Value

Returns an sp object of the delineated catchment.

Author(s)

Dan Moore and Kevin Shook

See Also

ch_wbt_filenames

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")
}

[Package CSHShydRology version 1.3.0 Index]