|
5 | 5 | #' |
6 | 6 | #' @param settings A PEcAn settings object containing ensemble configuration |
7 | 7 | #' @param ensemble_size Integer specifying the number of ensemble members |
8 | | -#' @param ensemble_samples list of ensemble parameters across PFTs. The default is NULL. |
9 | 8 | #' Since the `input_design` will only be generated once for the entire model run, |
10 | 9 | #' the only situation, where we might want to recycle the existing `ensemble_samples`, |
11 | 10 | #' is when we split and submit the larger SDA runs (e.g., 8,000 sites) into |
|
18 | 17 |
|
19 | 18 | generate_joint_ensemble_design <- function(settings, |
20 | 19 | ensemble_size, |
21 | | - ensemble_samples = NULL, |
22 | 20 | sobol = FALSE) { |
23 | 21 | if (sobol) { |
24 | 22 | ensemble_size <- as.numeric(ensemble_size) * 2 |
@@ -57,35 +55,10 @@ generate_joint_ensemble_design <- function(settings, |
57 | 55 | sampled_inputs[[input_tag]] <- input_result$ids |
58 | 56 | design_list[[input_tag]] <- input_result$ids |
59 | 57 | } |
60 | | - |
61 | | - # Sample parameters if we don't have it. |
62 | | - if (is.null(ensemble_samples)) { |
63 | | - PEcAn.uncertainty::get.parameter.samples( |
64 | | - settings, |
65 | | - ensemble.size = ensemble_size, |
66 | | - posterior.files, |
67 | | - ens.sample.method |
68 | | - ) |
69 | | - samples.file <- file.path(settings$outdir, "samples.Rdata") |
70 | | - } |
71 | | - |
72 | | - # Load samples from file |
73 | | - samples <- new.env() |
74 | | - # if we don't have the parameters from the outside. |
75 | | - if (is.null(ensemble_samples)) { |
76 | | - if (file.exists(samples.file)) { |
77 | | - load(samples.file, envir = samples) |
78 | | - } else { |
79 | | - PEcAn.logger::logger.error(samples.file, "not found, this file is required") |
80 | | - } |
81 | | - } |
82 | | - if (!is.null(samples$ensemble.samples) | !is.null(ensemble_samples)) { |
83 | | - # Just a placeholder: extract representative trait index per ensemble member |
84 | | - # You may want to flatten or select indices per trait |
85 | | - design_list[["param"]] <- seq_len(ensemble_size) |
86 | | - } else { |
87 | | - PEcAn.logger::logger.warn("ensemble.samples not found in samples.Rdata") |
88 | | - } |
| 58 | + # Here we assumed the length of parameters is identical to the ensemble size. |
| 59 | + # TODO: detect if they are identical. If not, we will need to resample the |
| 60 | + # parameters with replacement. |
| 61 | + design_list[["param"]] <- seq_len(ensemble_size) |
89 | 62 | design_matrix <- data.frame(design_list) |
90 | 63 |
|
91 | 64 | if (sobol) { |
|
0 commit comments