params2edr.Rd
Creates a nested list whose components are suitable for passing to EDR.
params2edr(params, sep = ".", prospect = TRUE, version = 5)
params | Named parameter vector |
---|---|
sep | Separator between PFT name and trait name. Must be a single character (default = "."). |
prospect | Logical. If |
version | PROSPECT version |
List containing spectra_list
and trait.values
, both objects needed by EDR.
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.