Skip to content

Commit 7ac17c8

Browse files
authored
CoDICE L1a lo-counters-aggregated Validation (IMAP-Science-Operations-Center#1544)
* Enabled lo-counters-aggregated validation
1 parent 18dcbd9 commit 7ac17c8

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

imap_processing/codice/codice_l1a.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -501,18 +501,30 @@ def reshape_data(self) -> None:
501501
self.data = []
502502

503503
# First reshape the data based on how it is written to the data array of
504-
# the packet data. The number of counters is the first dimension / axis.
505-
reshape_dims = (
506-
self.config["num_counters"],
507-
*self.config["input_dims"].values(),
508-
)
504+
# the packet data. The number of counters is the first dimension / axis,
505+
# with the exception of lo-counters-aggregated which is treated slightly
506+
# differently
507+
if self.config["dataset_name"] != "imap_codice_l1a_lo-counters-aggregated":
508+
reshape_dims = (
509+
self.config["num_counters"],
510+
*self.config["input_dims"].values(),
511+
)
512+
else:
513+
reshape_dims = (
514+
*self.config["input_dims"].values(),
515+
self.config["num_counters"],
516+
)
509517

510518
# Then, transpose the data based on how the dimensions should be written
511519
# to the CDF file. Since this is specific to each data product, we need
512520
# to determine this dynamically based on the "output_dims" config.
521+
# Again, lo-counters-aggregated is treated slightly differently
513522
input_keys = ["num_counters", *self.config["input_dims"].keys()]
514523
output_keys = ["num_counters", *self.config["output_dims"].keys()]
515-
transpose_axes = [input_keys.index(dim) for dim in output_keys]
524+
if self.config["dataset_name"] != "imap_codice_l1a_lo-counters-aggregated":
525+
transpose_axes = [input_keys.index(dim) for dim in output_keys]
526+
else:
527+
transpose_axes = [1, 2, 0] # [esa_step, spin_sector_pairs, num_counters]
516528

517529
for packet_data in self.raw_data:
518530
reshaped_packet_data = np.array(packet_data, dtype=np.uint32).reshape(

imap_processing/tests/codice/test_codice_l1a.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ def test_l1a_validate_data_arrays(test_l1a_data: xr.Dataset, index):
237237
"hi-counters-singles",
238238
"hi-priority",
239239
"hi-sectored",
240+
"lo-counters-aggregated",
240241
"lo-counters-singles",
241242
"lo-sw-angular",
242243
"lo-nsw-angular",

0 commit comments

Comments
 (0)