Expand SA quantile samples into one parameter set per run
Source:R/sa_run_samples.R
sa_run_samples.Rdget_parameter_samples returns sensitivity analysis samples as
one table per PFT, quantiles down the rows and traits across the columns.
The config writers want the opposite shape: one row per model run, holding
the parameter values that run uses. This converts between the two, using the
labels the design carries.
Arguments
- sa_samples
Sensitivity analysis samples, a named list with one data.frame per PFT, quantiles as rownames and traits as columns, as returned by
get_parameter_samples.- design_matrix
The design from
generate_OAT_SA_design, carryingsa_pft,sa_traitandsa_quantile.
Value
A named list with one data.frame per entry of sa_samples, each
with one row per design row and one column per trait. This is the shape
write.ensemble.configs takes as ensemble.samples.
Details
Every run starts from each PFT's median values. A run that the design labels as moving a trait then has that one value replaced with the trait's value at the labelled quantile, which is what makes a one-at-a-time design separable. The first row, the median run, keeps every value at its median.
Entries that are not PFTs, such as env, are carried at their medians
for every run, matching what write.sa.configs passes today.
See also
generate_OAT_SA_design for the labels this reads.