ch_wbt_removesinks {CSHShydRology}R Documentation

Removes sinks from a DEM

Description

Sinks are removed from a DEM using one of several methods. The raster file types supported are listed in Spatial_hydrology_functions.

Usage

ch_wbt_removesinks(
  in_dem,
  out_dem,
  method = "breach_leastcost",
  dist = NULL,
  fn_dem_fsc = NULL,
  ...
)

Arguments

in_dem

File path for original dem. Required.

out_dem

File path for dem after removing sinks.

method

Method for removing sinks. Default method is breach_leastcost. Other methods include breach, fill, fill_pd (Planchon and Darboux), and fill_wl (Wang and Liu).

dist

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

fn_dem_fsc

File path for dem after removing single-cell pits.

...

Additional arguments to be passed to functions to remove sinks.

Value

Returns a raster object containing the processed dem.

Author(s)

Dan Moore

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"))
  no_sink_raster_file <- tempfile("no_sinks", fileext = c(".tif"))

  # write test raster to file
  writeRaster(test_raster, dem_raster_file, format = "GTiff")

  # remove sinks
  removed_sinks <- ch_wbt_removesinks(dem_raster_file, no_sink_raster_file, method = "fill")
} else {
  message("Examples not run as Whitebox executable not found")
}

[Package CSHShydRology version 1.4.0 Index]