calculate_soil_depth_NRCS: Determine soil depth for NRCS soil data

View source: R/extract_soils_NRCS_SDA.R

calculate_soil_depth_NRCSR Documentation

Determine soil depth for NRCS soil data

Description

Determine soil depth for NRCS soil data

Usage

calculate_soil_depth_NRCS(
  x,
  target_site_ids,
  restrict_by_ec_or_ph = TRUE,
  var_site_id = "COKEY",
  var_horizon = "Horizon_No",
  var_horizon_lower_depth = "hzdepb_r",
  var_restrictions = c("Horizon_depth", "RootZoneRestriction_depth", "Bedrock_depth"),
  var_soiltexture = c("sand", "clay", "silt")
)

Arguments

x

A data.frame or matrix. Soil horizons/layers are organized in rows and soil texture variables in columns.

target_site_ids

A vector. The unique location identifiers, e.g., cokey values, for which soil depth is to be determined.

restrict_by_ec_or_ph

A logical value. Include depth restrictions by ph <= 3.5 or ec >= 16. This option requires additional variables.

var_site_id

A character string. The column name of x which contains the unique location identifiers.

var_horizon

A character string. The column name of x which contains the horizon/layer numbers where the shallowest horizon/layer is number one.

var_horizon_lower_depth

A character string. The column name of x that contains the lower depth limit of horizons/layers.

var_restrictions

A vector of character strings. The column names of x that contain depth restrictions, e.g., bedrock.

var_soiltexture

A vector of character strings. The column names of x that contain the three soil texture variables sand, clay, and silt.

Value

A data.frame with at least three columns. Each row represents one value of target_cokeys. The columns are:

  • N_horizons: The number of soil horizons/layers.

  • SoilDepth_cm: The soil depth in centimeters.

  • depth_Lx: The lower depth of soil horizon/layer x. Note: depth_L1 may vary from x[, "hzdepb_r"].

References

Code based on CalcRZDepth() version 2020-08-31: https://github.com/ncss-tech/SoilDataDevelopmentToolbox/blob/master/SDA_Valu2Table.py Note: currently ignores "dense" layer restrictions

Examples

## Not run: 
if (curl::has_internet()) {
  var_stxt3 <- c("sandtotal_r", "claytotal_r", "silttotal_r")

  x <- fetch_soils_from_NRCS_SDA(bind_params = c(471168, 1606800))

  calculate_soil_depth_NRCS(
    x,
    restrict_by_ec_or_ph = FALSE,
    var_soiltexture = var_stxt3
  )

  x2 <- cbind(x, organic = is_NRCS_horizon_organic(x))
  calculate_soil_depth_NRCS(
    x2,
    restrict_by_ec_or_ph = TRUE,
    var_soiltexture = var_stxt3
  )
}

## End(Not run)


DrylandEcology/rSW2exter documentation built on May 4, 2024, 10:53 p.m.