Skip to content

Commit e975c90

Browse files
author
Dongchen Zhang
committed
Remove the ensemble.samples argument.
1 parent 1695ffd commit e975c90

File tree

2 files changed

+6
-40
lines changed

2 files changed

+6
-40
lines changed

modules/uncertainty/R/generate_joint_ensemble_design.R

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#'
66
#' @param settings A PEcAn settings object containing ensemble configuration
77
#' @param ensemble_size Integer specifying the number of ensemble members
8-
#' @param ensemble_samples list of ensemble parameters across PFTs. The default is NULL.
98
#' Since the `input_design` will only be generated once for the entire model run,
109
#' the only situation, where we might want to recycle the existing `ensemble_samples`,
1110
#' is when we split and submit the larger SDA runs (e.g., 8,000 sites) into
@@ -18,7 +17,6 @@
1817

1918
generate_joint_ensemble_design <- function(settings,
2019
ensemble_size,
21-
ensemble_samples = NULL,
2220
sobol = FALSE) {
2321
if (sobol) {
2422
ensemble_size <- as.numeric(ensemble_size) * 2
@@ -57,35 +55,10 @@ generate_joint_ensemble_design <- function(settings,
5755
sampled_inputs[[input_tag]] <- input_result$ids
5856
design_list[[input_tag]] <- input_result$ids
5957
}
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)
8962
design_matrix <- data.frame(design_list)
9063

9164
if (sobol) {

modules/uncertainty/man/generate_joint_ensemble_design.Rd

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)