Skip to content

Commit

Permalink
Fixup .to7 migration, ensure response_key is always first
Browse files Browse the repository at this point in the history
  • Loading branch information
yngve-sk committed Oct 2, 2024
1 parent 488e992 commit 18d2de1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ert/storage/migration/to7.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 18d2de1

Please sign in to comment.