summary.spwb: Summarize simulation results

View source: R/summary.spwb.R

summary.spwbR Documentation

Summarize simulation results

Description

Function summary summarizes the model's output in different temporal steps (i.e. weekly, annual, ...).

Usage

## S3 method for class 'spwb'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

## S3 method for class 'pwb'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

## S3 method for class 'growth'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

## S3 method for class 'fordyn'
summary(
  object,
  freq = "years",
  output = "WaterBalance",
  FUN = sum,
  bySpecies = FALSE,
  months = NULL,
  ...
)

Arguments

object

An object of class spwb, pwb, growth or fordyn.

freq

Frequency of summary statistics (see cut.Date).

output

The data table to be summarized. Accepted values are the path to data tables in object, such as 'WaterBalance', 'Soil', 'Stand' or 'Plants$LAI'. It is also possible to use strings like 'Transpiration' and the function will interpret it as 'Plants$Transpiration'.

FUN

The function to summarize results (e.g., sum, mean, ...)

bySpecies

Allows aggregating output by species before calculating summaries (only has an effect with some values of output). Aggregation can involve a sum (as for plant lai or transpiration) or a LAI-weighted mean (as for plant stress or plant water potential).

months

A vector of month numbers (1 to 12) to subset the season where summaries apply.

...

Additional parameters for function summary.

Value

A matrix with dates as row names and the desired summaries in columns

Note

When applied to fordyn objects, the summary function can be used to gather the results of different yearly steps into a single table while keeping a daily resolution (i.e. using freq = "days".

Author(s)

Miquel De Cáceres Ainsa, CREAF

See Also

spwb, pwb, growth, fordyn, plot.spwb, extractSubdaily

Examples

#Load example daily meteorological data
data(examplemeteo)

#Load example plot plant data
data(exampleforestMED)

#Default species parameterization
data(SpParamsMED)

#Initialize soil with default soil params (2 layers)
examplesoil = soil(defaultSoilParams(2))

#Initialize control parameters
control = defaultControl("Granier")

#Initialize input
x = forest2spwbInput(exampleforestMED,examplesoil, SpParamsMED, control)

#Call simulation function
S1<-spwb(x, examplemeteo, latitude = 41.82592, elevation = 100)

#Monthly summary (averages) of soil status
summary(S1, freq="months",FUN=mean, output="Soil")

#Queries the tables in 'Plants'
names(S1$Plants)

#Monthly summary (averages) of plant stress
summary(S1, freq="months",FUN=mean, output="Plants$PlantStress", 
        bySpecies = TRUE)



medfate documentation built on Aug. 29, 2023, 5:07 p.m.