get_soiltemp: Extract soil temperature

View source: R/sw_OutputDerived_Functions.R

get_soiltempR Documentation

Extract soil temperature

Description

Extract soil temperature

Usage

get_soiltemp(
  x,
  timestep = c("Day", "Week", "Month", "Year"),
  levels = c("min", "avg", "max"),
  surface = TRUE,
  soillayers = NULL,
  keep_time = FALSE,
  verbose = FALSE
)

Arguments

x

An object of class swOutput.

timestep

A character string. One of the rSOILWAT2 time steps.

levels

A character string indicating which within-day minimum, average, or maximum values are requested.

surface

A logical value. Output surface soil temperature as first column in returned matrices; equivalent to requesting a 0 via soillayers.

soillayers

An integer vector of requested soil layers. NULL returns soil temperature from all available soil layers; NA does not return soil temperature; including a 0 is equivalent to setting surface to TRUE.

keep_time

A logical value. Include time information in the returned object.

verbose

A logical value. Issue warnings if requested levels are not available.

Value

A named list of length levels where elements are numeric matrices of soil temperature ⁠[C]⁠ with time steps as rows and (requested) soil surface and soil layers as columns.

Notes

Requested soillayers that are not available in x are ignored (with a warning if verbose).

Requested levels that are not available (e.g., "min" before rSOILWAT2 v5.3.0) are replaced by values from the average level (with a warning if verbose).

Examples

sw_out <- sw_exec(inputData = rSOILWAT2::sw_exampleData)
get_soiltemp(sw_out, "Month")
get_soiltemp(sw_out, "Month", "avg")
get_soiltemp(sw_out, "Month", "avg", surface = TRUE, soillayers = NA)
get_soiltemp(sw_out, "Month", "avg", soillayers = 0)
get_soiltemp(sw_out, "Month", "avg", surface = FALSE, soillayers = NULL)
get_soiltemp(sw_out, "Month", "avg", surface = FALSE, soillayers = c(1, 3))
get_soiltemp(sw_out, "Month", "avg", surface = FALSE, soillayers = c(1, 30))


Burke-Lauenroth-Lab/rSOILWAT2 documentation built on Dec. 9, 2023, 1:46 a.m.