Clips, pre-processes and calculates or determines all input data related to the digital elevation model (DEM) in the broader sense: acc, acc_wtd, cha, dem, dir, rds, slp, and wsh.

Requires TauDEM 5.3.7 and the WhiteboxTools binary (whitebox::install_whitebox) to be installed on your computer.

DEMrelatedInput(
  cv_dir,
  cs_dem,
  cs_cha,
  sp_msk,
  sp_olp,
  sp_sds,
  cs_rds = NULL,
  cs_wgs = NULL,
  cs_dir = NULL,
  ns_brn = 50,
  is_adj = 1L,
  is_ths = 1L,
  ls_tmp = FALSE,
  cs_fex = c("tif", "img")
)

Arguments

cv_dir

A character vector specifying the desired project root directory (first position).

cs_dem

A character string specifying a path to a potentially large raster digital elevation model.

cs_cha

A character string specifying a path to a potentially large raster providing channels.

sp_msk

An sp::SpatialPolygonsDataFrame providing a somewhat oversized catchment mask used to clip the potentially large input rasters for further processing.

sp_olp

An sp::SpatialPointsDataFrame providing the desired catchment outlet(s).

sp_sds

An sp::SpatialPointsDataFrame providing channel sources.

cs_rds

An optional character string specifying a path to a potentially large raster providing roads.

cs_wgs

An optional character string specifying a path to a potentially large raster providing flow accumulation weights.

cs_dir

An optional character string specifying a path to a potentially large raster providing D8 flow directions using ArcGIS codes.

ns_brn

A numeric scalar specifying the stream burning step size in m.

is_adj

A numeric scalar specifying how many cells adjacent to channels shall be burnt.

is_ths

An integer scalar specifying the number of threads to use during computation (no effect in case OpenMP is not supported by the toolchain and/or platform).

ls_tmp

A logical scalar specifying if the temporary files created during computation shall be kept.

cs_fex

A character string specifying the file extension of the created raster files (either the default "tif" or "img" for backward compatibility).

Value

A two column numeric matrix specifying one or more catchment outlet coordinates and side effects in the form of raster files.

Details

This function applies the following (pre-processing) steps to ensure hydrologic consistency of the generated input data:

  • Stream burning and orientation of cells adjacent to channel cells approximately into the direction of channel cells (no effect with ns_brn = 0).

  • Depression breaching.

  • Tracing of downslope flowpaths from the provided channel sources.

When roads are provided, they are considered as flow obstacles breaking the continuity of the calculated flow accumulations.

In case no flow accumulation weights are provided, acc and acc_wtd are identical.

Providing existing flow directions prevents calculating them, which, for example, may be useful in case the effect of tillage directions has been enforced on topographic flow directions in advance. Please note that doing so renders stream burning and depression breaching without effect.

dem represents the breached DEM with reversed stream burning if applicable. This processed DEM also serves as the basis for the calculation of the D8 slopes provided by slp.

References

Lindsay, J.B., 2016. Efficient hybrid breaching-filling sink removal methods for flow path enforcement in digital elevation models. Hydrological Processes 30, 846–857.

See also

Examples

if (FALSE) {
# obtain temporary project root directory
cv_dir <- normalizePath(
  tempfile("cmt"),
  winslash = .Platform$file.sep,
  mustWork = FALSE
)
# obtain directory holding "large" rasters and other required data sets
cs_dir_lrg <- system.file("tinytest", "largeData", package = "RPhosFate")

nm_olc <- DEMrelatedInput(
  cv_dir = cv_dir,
  cs_dem = file.path(cs_dir_lrg, "dem_lrg.tif"),
  cs_cha = file.path(cs_dir_lrg, "cha_lrg.tif"),
  sp_msk = raster::shapefile(file.path(cs_dir_lrg, "msk.shp")),
  sp_olp = raster::shapefile(file.path(cs_dir_lrg, "olp.shp")),
  sp_sds = raster::shapefile(file.path(cs_dir_lrg, "sds.shp")),
  cs_rds = file.path(cs_dir_lrg, "rds_lrg.tif"),
  cs_wgs = file.path(cs_dir_lrg, "wgs_lrg.tif"),
  ls_tmp = TRUE
)}