Skip to content

Commit

Permalink
get_ensemble_responses without get_ensemble_state
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Nov 20, 2024
1 parent 3b603d4 commit b555902
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/ert/dark_storage/endpoints/records.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
)
from ert.dark_storage.enkf import get_storage
from ert.storage import Storage
from ert.storage.realization_storage_state import RealizationStorageState

router = APIRouter(tags=["record"])

Expand Down Expand Up @@ -117,7 +116,6 @@ def get_ensemble_responses(

response_names_with_observations = set()
observations = ensemble.experiment.observations

for (
response_type,
response_config,
Expand All @@ -134,29 +132,22 @@ def get_ensemble_responses(
)
response_names_with_observations.update(set(obs_with_responses))

has_responses = any(
s == RealizationStorageState.HAS_DATA for s in ensemble.get_ensemble_state()
)

for name in (
ensemble.experiment.response_type_to_response_keys.get("summary", [])
if has_responses
else []
):
for name in ensemble.experiment.response_type_to_response_keys.get("summary", []):
response_map[str(name)] = js.RecordOut(
id=UUID(int=0),
name=name,
userdata={"data_origin": "Summary"},
has_observations=name in response_names_with_observations,
)

for name in gen_data_display_keys(ensemble) if has_responses else []:
response_map[str(name)] = js.RecordOut(
id=UUID(int=0),
name=name,
userdata={"data_origin": "GEN_DATA"},
has_observations=name in response_names_with_observations,
)
if "gen_data" in ensemble.experiment.response_type_to_response_keys:
for name in gen_data_display_keys(ensemble):
response_map[str(name)] = js.RecordOut(
id=UUID(int=0),
name=name,
userdata={"data_origin": "GEN_DATA"},
has_observations=name in response_names_with_observations,
)

return response_map

Expand Down

0 comments on commit b555902

Please sign in to comment.