extract {medfate}R Documentation

Extracts model outputs

Description

Function extract() extracts daily or subdaily output and returns it as a tidy data frame.

Usage

extract(
  x,
  level = "forest",
  output = NULL,
  vars = NULL,
  dates = NULL,
  subdaily = FALSE
)

Arguments

x

An object returned by simulation functions spwb, pwb or growth.

level

Level of simulation output, either "forest" (stand-level results), "soillayer" (soil layer-level results), "cohort" (cohort-level results), "sunlitleaf" or "shadeleaf" (leaf-level results)

output

Section of the model output to be explored. See details.

vars

Variables to be extracted (by default, all of them).

dates

A date vector indicating the subset of simulated days for which output is desired.

subdaily

A flag to indicate that subdaily values are desired (see details).

Details

When subdaily = FALSE, parameter output is used to restrict the section in x where variables are located. For example output = "Plants" will correspond to variables "LAI", "LAIlive", "Transpiration", "StemPLC",... as returned by a call names(x$Plants).

Option subdaily = TRUE only works when simulations have been carried using control option 'subdailyResults = TRUE' (see defaultControl). When using subdaily = TRUE, parameter output is not taken into account, and options for parameter vars are the following:

Value

Function extract() returns a data frame:

Author(s)

Miquel De Cáceres Ainsa, CREAF

See Also

summary.spwb

Examples

#Load example daily meteorological data
data(examplemeteo)

#Load example plot plant data
data(exampleforest)

#Default species parameterization
data(SpParamsMED)

#Define soil with default soil params (4 layers)
examplesoil <- defaultSoilParams(4)

#Initialize control parameters
control <- defaultControl("Granier")

#Initialize input
x <- spwbInput(exampleforest,examplesoil, SpParamsMED, control)

#Call simulation function (ten days)
S1<-spwb(x, examplemeteo[1:10, ], latitude = 41.82592, elevation = 100)

#Extracts daily forest-level output as a data frame
extract(S1, level = "forest")

#Extracts daily soil layer-level output as a data frame
extract(S1, level = "soillayer")

#Extracts daily cohort-level output as a data frame
extract(S1, level = "cohort")

#Select the output tables/variables to be extracted
extract(S1, level ="cohort", output="Plants", vars = c("PlantStress", "StemPLC"))


[Package medfate version 4.4.0 Index]