Skip to content

Commit

Permalink
Fix bug where duplicate dates in summary caused update to crash
Browse files Browse the repository at this point in the history
We drop all duplicate time steps from the summary dates, and only
read the first one.
  • Loading branch information
oyvindeide committed Aug 30, 2023
1 parent 637f843 commit 0229ef6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ert/config/summary_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def read_from_file(self, run_path: str, iens: int) -> xr.Dataset:
data = []
keys = []
time_map = summary.alloc_time_vector(True)
time_map.selectUnique()
axis = [t.datetime() for t in time_map]
if self.refcase:
existing_time_map = self.refcase.alloc_time_vector(True)
Expand Down
21 changes: 21 additions & 0 deletions tests/unit_tests/scenarios/test_summary_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,27 @@ def test_that_different_length_is_ok_as_long_as_observation_time_exists(
es_update.smootherUpdate(prior_ensemble, target_ensemble, "an id")


def test_that_duplicate_summary_time_steps_does_not_fail(
setup_configuration,
prior_ensemble,
target_ensemble,
):
ert = setup_configuration
ert.sample_prior(prior_ensemble, list(range(ert.getEnsembleSize())))
response_times = [
[datetime(2014, 9, 9)],
[datetime(2014, 9, 9)],
[datetime(2014, 9, 9), datetime(2014, 9, 9)],
[datetime(2014, 9, 9)],
[datetime(2014, 9, 9), datetime(1988, 9, 9)],
]
create_responses(ert, prior_ensemble, response_times)

es_update = ESUpdate(ert)

es_update.smootherUpdate(prior_ensemble, target_ensemble, "an id")


def run_sim(dates, value, fname="ECLIPSE_CASE"):
"""
Create a summary file, the contents of which are not important
Expand Down

0 comments on commit 0229ef6

Please sign in to comment.