From 3e063f75297c3b19664ae3a0cf5a9e2aa0d17af5 Mon Sep 17 00:00:00 2001 From: "Yngve S. Kristiansen" Date: Tue, 17 Sep 2024 10:19:43 +0200 Subject: [PATCH] Add migrations --- src/ert/config/ert_config.py | 2 +- src/ert/storage/migration/to7.py | 4 ++ .../observations/FWPR | 2 - .../observations/GEN | 2 - .../storage/test_storage_migration.py | 68 +++++++++---------- 5 files changed, 39 insertions(+), 39 deletions(-) delete mode 100644 tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/FWPR delete mode 100644 tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/GEN diff --git a/src/ert/config/ert_config.py b/src/ert/config/ert_config.py index 7dd7f15b245..23ac82a6595 100644 --- a/src/ert/config/ert_config.py +++ b/src/ert/config/ert_config.py @@ -124,7 +124,7 @@ def __post_init__(self) -> None: def write_observations_to_folder(self, dest: Path) -> None: for name, dataset in self.observations.items(): - dataset.to_netcdf(dest / f"{name}", engine="scipy") + dataset.write_parquet(dest / name) @staticmethod def with_plugins( diff --git a/src/ert/storage/migration/to7.py b/src/ert/storage/migration/to7.py index 3eeead21396..0d66e113bd7 100644 --- a/src/ert/storage/migration/to7.py +++ b/src/ert/storage/migration/to7.py @@ -183,6 +183,10 @@ def _migrate_observations_to_grouped_parquet(path: Path): for experiment in path.glob("experiments/*"): _obs_keys = os.listdir(os.path.join(experiment, "observations")) + if len(set(_obs_keys) - {"summary", "gen_data"}) == 0: + # Observations are already migrated, likely from .to4 migrations + continue + obs_ds_infos = [ ObservationDatasetInfo.from_path(experiment / "observations" / p) for p in _obs_keys diff --git a/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/FWPR b/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/FWPR deleted file mode 100644 index 9ab94b51f6d..00000000000 --- a/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/FWPR +++ /dev/null @@ -1,2 +0,0 @@ -name,time,observations,std -RWPR,1996-01-02,0.1,0.05 diff --git a/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/GEN b/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/GEN deleted file mode 100644 index 3dfa01048df..00000000000 --- a/tests/unit_tests/storage/snapshots/test_storage_migration/test_that_storage_matches/observations/GEN +++ /dev/null @@ -1,2 +0,0 @@ -report_step,index,observations,std -1,0,0.0,0.1 diff --git a/tests/unit_tests/storage/test_storage_migration.py b/tests/unit_tests/storage/test_storage_migration.py index 1185c9e6a08..8fcd79138f7 100644 --- a/tests/unit_tests/storage/test_storage_migration.py +++ b/tests/unit_tests/storage/test_storage_migration.py @@ -30,40 +30,40 @@ def copy_shared(tmp_path, block_storage_path): @pytest.mark.parametrize( "ert_version", [ - # "10.3.1", - # "10.2.8", - # "10.1.3", - # "10.0.3", - # "9.0.17", - # "8.4.9", - # "8.4.8", - # "8.4.7", - # "8.4.6", - # "8.4.5", - # "8.4.4", - # "8.4.3", - # "8.4.2", - # "8.4.1", - # "8.4.0", - # "8.3.1", - # "8.3.0", - # "8.2.1", - # "8.2.0", - # "8.1.1", - # "8.1.0", - # "8.0.13", - # "8.0.12", - # "8.0.11", - # "8.0.10", - # "8.0.9", - # "8.0.8", - # "8.0.7", - # "8.0.6", - # "8.0.4", - # "8.0.3", - # "8.0.2", - # "8.0.1", - # "8.0.0", + "10.3.1", + "10.2.8", + "10.1.3", + "10.0.3", + "9.0.17", + "8.4.9", + "8.4.8", + "8.4.7", + "8.4.6", + "8.4.5", + "8.4.4", + "8.4.3", + "8.4.2", + "8.4.1", + "8.4.0", + "8.3.1", + "8.3.0", + "8.2.1", + "8.2.0", + "8.1.1", + "8.1.0", + "8.0.13", + "8.0.12", + "8.0.11", + "8.0.10", + "8.0.9", + "8.0.8", + "8.0.7", + "8.0.6", + "8.0.4", + "8.0.3", + "8.0.2", + "8.0.1", + "8.0.0", "7.0.4", "7.0.3", "7.0.2",