Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicates from summary files #6117

Merged
merged 1 commit into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Loading