Skip to content

Commit 674f4e1

Browse files
authored
ULTRA l2 add backwards compatibility for old PSETS (#2928)
* add backwards compatibility for old psets * fix check * temporary test for coverage
1 parent 8f74867 commit 674f4e1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

imap_processing/ena_maps/ena_maps.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,14 @@ def downsample_counts(self) -> None:
627627
nside of the input pset counts variable (e.g. 128) to the nside of the pset.
628628
"""
629629
pset_data = self.data
630+
# TODO remove this check once we reprocess all psets
631+
# going forward, all psets should have counts_pixel_index as a coordinate.
632+
if "counts_pixel_index" not in pset_data.dims:
633+
logger.info(
634+
"No counts_pixel_index found in the dataset. Skipping counts "
635+
"downsampling."
636+
)
637+
return
630638
counts_n_pix = pset_data.sizes["counts_pixel_index"]
631639
pset_n_pix = hp.nside2npix(self.nside)
632640
if counts_n_pix != pset_n_pix:

imap_processing/tests/ena_maps/test_ena_maps.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,16 @@ def test_instantiate(self):
9898
"energy_bin_geometric_mean",
9999
)
100100

101+
# TODO remove this test when the TODO in the ultra downsample_counts function is
102+
# removed.
103+
def test_old_pset(self):
104+
pset = self.l1c_pset_products[0]
105+
pset = pset.drop_dims("counts_pixel_index")
106+
pset = ena_maps.UltraPointingSet(
107+
pset,
108+
spice_reference_frame=geometry.SpiceFrame.IMAP_DPS,
109+
)
110+
101111
@pytest.mark.usefixtures("_setup_ultra_l1c_pset_products")
102112
def test_init_cdf(
103113
self,

0 commit comments

Comments
 (0)