ch_wbt_removesinks: Removes sinks from a DEM

View source: R/ch_wbt_removesinks.R

ch_wbt_removesinksR 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


# Not tested automatically as requires installation of Whitebox
ch_wbt_check_whitebox()
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")


CSHS-hydRology/CSHShydRology documentation built on Aug. 18, 2022, 4:44 p.m.