Skip to content

Commit

Permalink
Apply OCD.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKenyon committed Oct 25, 2023
1 parent a0a23ed commit a85839b
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions quartical/apps/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,21 @@ def restore():
zarr_xds_list = xds_from_zarr(f"{zarr_root}::{zarr_name}")
backup_column_name = list(zarr_xds_list[0].data_vars.keys()).pop()

# this will fail if the column does not exist but if we allow all columns
# This will fail if the column does not exist but if we allow all columns
# we need to select out the relevant dims for rechunking below
ms_xds_list = xds_from_storage_ms(args.ms_path,
columns=(args.column_name,),
index_cols=("TIME",),
group_cols=("FIELD_ID", "DATA_DESC_ID", "SCAN_NUMBER"),)
ms_xds_list = xds_from_storage_ms(
args.ms_path,
columns=(args.column_name,),
index_cols=("TIME",),
group_cols=("FIELD_ID", "DATA_DESC_ID", "SCAN_NUMBER"),
)

for i, (ds, dsr) in enumerate(zip(ms_xds_list, zarr_xds_list)):
dsr = dsr.chunk(ds.chunks)
data_array = getattr(dsr, backup_column_name)
ms_xds_list[i] = ds.assign(**{
args.column_name : (data_array.dims,
data_array.data)
})
ms_xds_list[i] = ds.assign(
{args.column_name: (data_array.dims, data_array.data)}
)

restored_xds_list = xds_to_storage_table(
ms_xds_list,
Expand Down

0 comments on commit a85839b

Please sign in to comment.