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 28, 2024
1 parent 25ac827 commit 53eea27
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 @@ -297,29 +297,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 53eea27

Please sign in to comment.