Calculates a per-PFT, gridcell-summed quantity from the LPJ-GUESS state, correctly averaging over patches. This should be put into the SDA procedure.

calculateGridcellVariablePerPFT(
  model.state,
  variable,
  pft.params,
  min.diam = 5
)

Arguments

model.state

A large multiply-nested list containing the entire LPJ-GUESS state as read by function readStateBinary.LPJGUESS

variable

A character string specifying what variable to extract. This can be chosen based on the LPJ-GUESS variable name as recorded in the big list of list (that represents describes the model state in R). Once special case is "biomass" which returns the sum of "cmass_leaf", "cmass_root", "cmass_sap" and "cmass_heart"

pft.params

A data frame containing PFT parameters such as allometric coefficients.

min.diam

Minimum tree diameter (in cm) required for inclusion in calculations.

Value

A numeric vector, with one entry per PFT

Author

Matthew Forrest