Skip to content

Commit

Permalink
Remove duplicates from summary files
Browse files Browse the repository at this point in the history
  • Loading branch information
Øyvind Eide (EDT DSD SD2) authored and oyvindeide committed Sep 20, 2023
1 parent ec1a34c commit 95e21d5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ert/config/summary_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ def read_from_file(self, run_path: str, iens: int) -> xr.Dataset:
)
data.append(np_vector)

return xr.Dataset(
ds = xr.Dataset(
{"values": (["name", "time"], data)},
coords={"time": axis, "name": keys},
)
return ds.drop_duplicates(["time", "name"])

def _should_load_summary_key(self, data_key: Any, user_set_keys: set[str]) -> bool:
return any(fnmatch(data_key, key) for key in user_set_keys)
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 @@ -153,3 +153,24 @@ def run_sim(dates, value, fname="ECLIPSE_CASE"):
)
t_step["FOPR"] = value
ecl_sum.fwrite()


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")

0 comments on commit 95e21d5

Please sign in to comment.