From 18d2de18bf5b11ff552f00b797846e357f578aa0 Mon Sep 17 00:00:00 2001 From: "Yngve S. Kristiansen" Date: Wed, 2 Oct 2024 09:49:27 +0200 Subject: [PATCH] Fixup .to7 migration, ensure response_key is always first --- src/ert/storage/migration/to7.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ert/storage/migration/to7.py b/src/ert/storage/migration/to7.py index 0c81c7cd1dd..a7a0b6569d0 100644 --- a/src/ert/storage/migration/to7.py +++ b/src/ert/storage/migration/to7.py @@ -240,6 +240,15 @@ def _migrate_responses_from_netcdf_to_parquet(path: Path) -> None: polars.col("time").dt.cast_time_unit("ms") ) + # Ensure "response_key" is the first column + polars_df = polars_df.select( + ["response_key"] + + [ + col + for col in polars_df.columns + if col != "response_key" + ] + ) polars_df.write_parquet(real_dir / f"{ds_name}.parquet") os.remove(real_dir / f"{ds_name}.nc")