Skip to content

Commit

Permalink
Add rechunking in fragments code and ROWID to columns in backup app.
Browse files Browse the repository at this point in the history
  • Loading branch information
JSKenyon committed Sep 21, 2023
1 parent 34db3fb commit d733257
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions quartical/apps/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def backup():
# This call exists purely to get the relevant shape and dtype info.
data_xds_list = xds_from_storage_ms(
args.ms_path,
columns=column_name,
columns=(column_name, "ROWID"),
index_cols=("TIME",),
group_cols=("FIELD_ID", "DATA_DESC_ID", "SCAN_NUMBER"),
)
Expand All @@ -81,7 +81,7 @@ def backup():
# Repeat of above call but now with correct chunking information.
data_xds_list = xds_from_storage_ms(
args.ms_path,
columns=column_name,
columns=(column_name, "ROWID"),
index_cols=("TIME",),
group_cols=("FIELD_ID", "DATA_DESC_ID", "SCAN_NUMBER"),
chunks=chunks
Expand Down
7 changes: 7 additions & 0 deletions quartical/data_handling/ms_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xds_from_table_fragment,
xds_to_table_fragment
)
from daskms.experimental.utils import rechunk_by_size
from dask.graph_manipulation import clone
from loguru import logger
from quartical.weights.weights import initialize_weights
Expand Down Expand Up @@ -300,6 +301,12 @@ def write_xds_list(xds_list, ref_xds_list, ms_path, output_opts):
warnings.simplefilter("ignore")

if output_opts.fragment_path:

xds_list = [
rechunk_by_size(xds, {'corr'}, only_when_needed=True)
for xds in xds_list
]

write_xds_list = xds_to_table_fragment(
xds_list,
output_opts.fragment_path,
Expand Down

0 comments on commit d733257

Please sign in to comment.