From a03d62cf4a3c3d19f48a3b8111aeab9f840481fc Mon Sep 17 00:00:00 2001 From: Eivind Jahren Date: Fri, 27 Sep 2024 14:54:19 +0200 Subject: [PATCH] Use iens = 0 to avoid error with ensemble_size=1 --- tests/ert/unit_tests/storage/test_local_storage.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/ert/unit_tests/storage/test_local_storage.py b/tests/ert/unit_tests/storage/test_local_storage.py index a5bc5dd2957..b30b44ec5a4 100644 --- a/tests/ert/unit_tests/storage/test_local_storage.py +++ b/tests/ert/unit_tests/storage/test_local_storage.py @@ -683,7 +683,7 @@ def write_error_in_save_field(self, model_ensemble: Ensemble, field_data): storage_ensemble = self.storage.get_ensemble(model_ensemble.uuid) parameters = model_ensemble.parameter_values.values() fields = [p for p in parameters if isinstance(p, Field)] - iens = 1 + iens = 0 assume(not storage_ensemble.realizations_initialized([iens])) for f in fields: with patch( @@ -709,7 +709,7 @@ def write_error_in_save_field(self, model_ensemble: Ensemble, field_data): def get_parameters(self, model_ensemble: Ensemble): storage_ensemble = self.storage.get_ensemble(model_ensemble.uuid) parameter_names = model_ensemble.parameter_values.keys() - iens = 1 + iens = 0 for f in parameter_names: parameter_data = storage_ensemble.load_parameters(f, iens) @@ -748,7 +748,7 @@ def save_summary(self, model_ensemble: Ensemble, summary_data): smspec, unsmry = summary_data smspec.to_file(self.tmpdir + f"/{summary.input_files[0]}.SMSPEC") unsmry.to_file(self.tmpdir + f"/{summary.input_files[0]}.UNSMRY") - iens = 1 + iens = 0 try: ds = summary.read_from_file(self.tmpdir, iens) @@ -763,7 +763,7 @@ def save_summary(self, model_ensemble: Ensemble, summary_data): def get_responses(self, model_ensemble: Ensemble): storage_ensemble = self.storage.get_ensemble(model_ensemble.uuid) names = model_ensemble.response_values.keys() - iens = 1 + iens = 0 for n in names: data = storage_ensemble.load_responses(n, (iens,)) @@ -820,7 +820,7 @@ def create_ensemble_from_prior(self, prior: Ensemble): model_experiment = self.model[experiment_id] model_experiment.ensembles[ensemble.id] = model_ensemble state = [RealizationStorageState.PARENT_FAILURE] * size - iens = 1 + iens = 0 if ( list(prior.response_values.keys()) == [r.name for r in model_experiment.responses]