Skip to content

Commit

Permalink
Remove realizations_initialized
Browse files Browse the repository at this point in the history
used in test only
  • Loading branch information
yngve-sk committed Nov 26, 2024
1 parent a238115 commit a3c5fdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
23 changes: 0 additions & 23 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,29 +287,6 @@ def has_data(self) -> List[int]:
if RealizationStorageState.RESPONSES_LOADED in ensemble_state[i]
]

def realizations_initialized(self, realizations: List[int]) -> bool:
"""
Check if specified realizations are initialized.
Parameters
----------
realizations : list of int
List of realization indices.
Returns
-------
initialized : bool
True if all realizations are initialized.
"""

responses = self.get_realization_mask_with_responses()
parameters = self.get_realization_mask_with_parameters()

if len(responses) == 0 and len(parameters) == 0:
return False

return all((responses[real] or parameters[real]) for real in realizations)

def get_realization_list_with_responses(self) -> List[int]:
"""
List of realization indices with associated responses.
Expand Down
11 changes: 9 additions & 2 deletions tests/ert/unit_tests/storage/test_local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,12 @@ def write_error_in_save_field(self, model_ensemble: Ensemble, field_data):

parameters = model_ensemble.parameter_values.values()
fields = [p for p in parameters if isinstance(p, Field)]
assume(not storage_ensemble.realizations_initialized([self.iens_to_edit]))

assume(
not storage_ensemble.get_realization_mask_with_parameters()[
self.iens_to_edit
]
)
for f in fields:
with (
patch(
Expand All @@ -824,7 +829,9 @@ def write_error_in_save_field(self, model_ensemble: Ensemble, field_data):
)

assert temp_file.entered
assert not storage_ensemble.realizations_initialized([self.iens_to_edit])
assert not storage_ensemble.get_realization_mask_with_parameters()[
self.iens_to_edit
]

@rule(
model_ensemble=ensembles,
Expand Down

0 comments on commit a3c5fdc

Please sign in to comment.