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

Fix key error on empty summary observations in plotter #9568

Merged
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
2 changes: 1 addition & 1 deletion src/ert/dark_storage/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def get_observation_keys_for_response(

elif (
displayed_response_key
in ensemble.experiment.response_type_to_response_keys["summary"]
in ensemble.experiment.response_type_to_response_keys.get("summary", {})
):
response_key = displayed_key_to_response_key["summary"](displayed_response_key)[
0
Expand Down
11 changes: 11 additions & 0 deletions tests/ert/unit_tests/gui/tools/plot/test_plot_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,3 +326,14 @@ def test_that_multiple_observations_are_parsed_correctly(api):
ensemble = next(x for x in api.get_all_ensembles() if x.id == "ens_id_5")
obs_data = api.observations_for_key([ensemble.id], "WOPR:OP1")
assert obs_data.shape == (3, 6)


def test_that_observations_for_empty_ensemble_returns_empty_data(api_and_storage):
eivindjahren marked this conversation as resolved.
Show resolved Hide resolved
api, storage = api_and_storage
experiment = storage.create_experiment(
parameters=[],
responses=[SummaryConfig(name="summary", input_files=[""], keys=["NAIMFRAC"])],
observations={},
)
ensemble = storage.create_ensemble(experiment.id, ensemble_size=1)
assert api.observations_for_key([str(ensemble.id)], "NAIMFRAC").empty
Loading