Creates a nested list whose components are suitable for passing to EDR.

params2edr(params, sep = ".", prospect = TRUE, version = 5)

Arguments

params

Named parameter vector

sep

Separator between PFT name and trait name. Must be a single character (default = ".").

prospect

Logical. If TRUE (default), scan for PROSPECT traits and pass them to PROSPECT.

version

PROSPECT version

Value

List containing spectra_list and trait.values, both objects needed by EDR.

Details

If prospect = TRUE, parameters prefixed with prospect_ are passed to prospect with the specified version, and other parameters are passed to trait.values.

The regular expression defining the separation is greedy, i.e. temperate.Early_Hardwood.SLA will separate into temperate.Early_Hardwood and SLA (assuming the default sep = "."). Therefore, it is crucial that trait names not contain any sep characters (neither ED nor PROSPECT parameters should anyway). If this is a problem, use an alternate separator (e.g. |).

Note that using sep = "." allows this function to directly invert the default behavior of unlist. That is, calling unlist(params2edr(params, prospect = FALSE)$trait.values) will return the input vector of trait values. This makes unlist a convenient way to go from a trait.values list to a properly formatted params vector.

Because unused ED parameters in the config.xml are ignored, the PROSPECT parameters are saved in the trait.values object as well, which may be useful for debugging.