Skip to content

Commit

Permalink
Add some documentation to _update_response_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Oct 23, 2024
1 parent 93fecc9 commit 5414ccd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ def save_response(
)

response_keys = data["response_key"].unique().to_list()
self.experiment.update_response_keys(response_type, response_keys)
self.experiment._update_response_keys(response_type, response_keys)

def calculate_std_dev_for_parameter(self, parameter_group: str) -> xr.Dataset:
if parameter_group not in self.experiment.parameter_configuration:
Expand Down
8 changes: 7 additions & 1 deletion src/ert/storage/local_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,15 @@ def response_key_to_response_type(self) -> Dict[str, str]:

return mapping

def update_response_keys(
def _update_response_keys(
self, response_type: str, new_response_keys: List[str]
) -> None:
"""
When a response is saved to storage, it may contain keys
that are not explicitly declared in the config. Calling this ensures
that the response config saved in this storage has keys corresponding
to the actual received responses.
"""
if not any(
k for k in new_response_keys if k not in self.response_key_to_response_type
):
Expand Down

0 comments on commit 5414ccd

Please sign in to comment.