check_soillayer_availability: Check whether soil layers are available in a specified zone

View source: R/Functions_Supporting.R

check_soillayer_availabilityR Documentation

Check whether soil layers are available in a specified zone

Description

Check whether soil layers are available in a specified zone

Usage

check_soillayer_availability(
  soil_depths_cm,
  used_depth_range_cm = NULL,
  strict = TRUE,
  type = c("warn", "error")
)

Arguments

soil_depths_cm

A numeric vector. The lower depth limits of soil layers in [cm].

used_depth_range_cm

A numeric vector of length two. The upper and lower depth limit of the zone (depth range) to consider.

strict

A logical vector either of length one or equal to the length of used_depth_range_cm. TRUE indicates that the corresponding value (or all) of used_depth_range_cm is required to be either zero or one of the values of soil_depths_cm.

type

A character string. If a value is not present, then either a warning is issued or an error.

Value

(Invisibly) a logical value indicating whether at least one required value is missing (FALSE) or all are present (TRUE).

Examples

check_soillayer_availability(
  c(5, 10, 30, 50), c(0, 40),
  strict = TRUE,
  type = "warn"
)
check_soillayer_availability(
  c(5, 10, 30, 50), c(0, 40),
  strict = c(TRUE, FALSE),
  type = "warn"
)
check_soillayer_availability(
  c(5, 10, 30, 50), c(20, 30, 40),
  strict = TRUE,
  type = "warn"
)


DrylandEcology/rSW2metrics documentation built on May 25, 2023, 10:38 a.m.