@@ -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 (
0 commit comments