Skip to content

Commit

Permalink
fixup! Save everest realization metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Jan 29, 2025
1 parent ca8a3d5 commit 2202375
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ everest = [
"decorator",
"resdata",
"colorama",
"ropt[pandas]>=0.1,<0.11",
"ropt[pandas]>=0.10.1,<0.11",
"ropt-dakota>=0.1,<0.11",
"seba-sqlite",
]
Expand Down
45 changes: 13 additions & 32 deletions src/ert/run_models/everest_run_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,39 +377,20 @@ def _forward_model_evaluator(
)
ert_ensemble = everest_ensemble.ert_ensemble

realizations = self._everest_config.model.realizations
num_perturbations = (
1
if self._everest_config.optimization is None
else self._everest_config.optimization.perturbation_num or 1
)

realization_mapping: dict[int, EverestRealizationInfo] = {}
if len(evaluator_context.realizations) == len(realizations):
# Function evaluation
realization_mapping = {
i: EverestRealizationInfo(geo_realization=real, perturbation=None)
for i, real in enumerate(realizations)
}
elif len(evaluator_context.realizations) == num_perturbations:
realization_mapping = {
p: EverestRealizationInfo(geo_realization=real, perturbation=p)
for p, real in enumerate(realizations)
}
else:
# Function and gradient
for i, real in enumerate(realizations):
realization_mapping[i] = EverestRealizationInfo(
geo_realization=real, perturbation=None
)

i = len(realization_mapping)
for real in realizations:
for p in range(num_perturbations or 1):
realization_mapping[i] = EverestRealizationInfo(
geo_realization=real, perturbation=p
realization_mapping: dict[int, EverestRealizationInfo] = {
idx: EverestRealizationInfo(
geo_realization=self._everest_config.model.realizations[real],
perturbation=(
evaluator_context.perturbations[idx]
if (
evaluator_context.perturbations is not None
and evaluator_context.perturbations[idx] >= 0
)
i += 1
else None
),
)
for idx, real in enumerate(evaluator_context.realizations)
}

# Fill in data from ROPT here
everest_ensemble.save_realization_mapping(
Expand Down

0 comments on commit 2202375

Please sign in to comment.