@@ -394,9 +394,14 @@ def test_codice_lo_l3a_direct_event_to_data_product(self):
394394 position = rng .random ((len (epoch ), len (priority ), len (event_num ))),
395395 spin_angle_bin = rng .random (24 ),
396396 spin_angle_bin_delta = rng .random (24 ),
397- energy_bin = rng .random (128 ),
398- energy_bin_delta_plus = rng .random (128 ),
399- energy_bin_delta_minus = rng .random (128 ),
397+ energy_bin = rng .random (len (energy_step )),
398+ energy_bin_delta_plus = rng .random (len (energy_step )),
399+ energy_bin_delta_minus = rng .random (len (energy_step )),
400+ half_spin_per_esa_step = rng .random ((len (epoch ), len (energy_step ))),
401+ rgfo_spin_sector = rng .random (len (epoch )),
402+ rgfo_esa_step = rng .random (len (epoch )),
403+ nso_spin_sector = rng .random (len (epoch )),
404+ nso_esa_step = rng .random (len (epoch )),
400405 )
401406
402407 np .testing .assert_array_equal (direct_event .event_index , np .arange (len (event_num )))
@@ -440,6 +445,11 @@ def test_codice_lo_l1a_sw_priority_read_from_instrument_team_cdf(self):
440445 np .testing .assert_array_equal (actual_l1a_sw_priority_rates .p2_heplusplus , cdf ["p2_heplusplus" ][...])
441446 np .testing .assert_array_equal (actual_l1a_sw_priority_rates .p3_heavies , cdf ["p3_heavies" ][...])
442447 np .testing .assert_array_equal (actual_l1a_sw_priority_rates .p4_dcrs , cdf ["p4_dcrs" ][...])
448+ np .testing .assert_array_equal (actual_l1a_sw_priority_rates .half_spin_per_esa_step , cdf ["half_spin_per_esa_step" ][...])
449+ np .testing .assert_array_equal (actual_l1a_sw_priority_rates .rgfo_spin_sector , cdf ["rgfo_spin_sector" ][...])
450+ np .testing .assert_array_equal (actual_l1a_sw_priority_rates .rgfo_esa_step , cdf ["rgfo_esa_step" ][...])
451+ np .testing .assert_array_equal (actual_l1a_sw_priority_rates .nso_spin_sector , cdf ["nso_spin_sector" ][...])
452+ np .testing .assert_array_equal (actual_l1a_sw_priority_rates .nso_esa_step , cdf ["nso_esa_step" ][...])
443453
444454 def test_codice_lo_l1a_nsw_priority_read_from_instrument_team_cdf (self ):
445455 instrument_team_cdf_path = get_test_instrument_team_data_path (
@@ -523,7 +533,7 @@ def test_codice_lo_3d_distributions_data_product(self):
523533 self .assert_variable_attributes (next (actual_variables ), elevation .astype (str ), ELEVATION_ANGLE_LABEL_VAR_NAME )
524534
525535 def test_codice_lo_l2_direct_events_reads_from_correct_float_data (self ):
526- all_fill_l2_cdf_path = get_test_data_path ('codice/imap_codice_l2_lo-direct-events -all-fill_20250814_v001 .cdf' )
536+ all_fill_l2_cdf_path = get_test_data_path ('codice/imap_codice_l2_lo-direct-events_20260307_v003 -all-fill .cdf' )
527537
528538 rng = np .random .default_rng ()
529539 with tempfile .TemporaryDirectory () as tmpdir :
@@ -550,20 +560,20 @@ def test_codice_lo_l2_direct_events_reads_from_correct_float_data(self):
550560 np .testing .assert_array_equal (l2_direct_event .elevation_angle , cdf ["elevation_angle" ][:, :7 , ...])
551561
552562 def test_codice_lo_l2_direct_events_read_from_cdf_handles_fill_value (self ):
553- all_fill_l2_cdf_path = get_test_data_path ('codice/imap_codice_l2_lo-direct-events -all-fill_20250814_v001 .cdf' )
563+ all_fill_l2_cdf_path = get_test_data_path ('codice/imap_codice_l2_lo-direct-events_20260307_v003 -all-fill .cdf' )
554564 l2_direct_event = CodiceLoL2DirectEventData .read_from_cdf (all_fill_l2_cdf_path )
555565
556566 with CDF (str (all_fill_l2_cdf_path )) as cdf :
557567 np .testing .assert_array_equal (cdf ["epoch" ], l2_direct_event .epoch )
558568 np .testing .assert_array_equal (cdf ["epoch_delta_plus" ], l2_direct_event .epoch_delta_plus )
559569 np .testing .assert_array_equal (cdf ["epoch_delta_minus" ], l2_direct_event .epoch_delta_minus )
560570
561- np .testing .assert_array_equal (l2_direct_event .apd_energy , np .full ((9 , 7 , 10000 ), np .nan ))
562- np .testing .assert_array_equal (l2_direct_event .energy_step , np .full ((9 , 7 , 10000 ), np .nan ))
563- np .testing .assert_array_equal (l2_direct_event .energy_per_charge , np .full ((9 , 7 , 10000 ), np .nan ))
564- np .testing .assert_array_equal (l2_direct_event .spin_angle , np .full ((9 , 7 , 10000 ), np .nan ))
565- np .testing .assert_array_equal (l2_direct_event .spin_sector , np .full ((9 , 7 , 10000 ), np .nan ))
566- np .testing .assert_array_equal (l2_direct_event .elevation_angle , np .full ((9 , 7 , 10000 ), np .nan ))
571+ np .testing .assert_array_equal (l2_direct_event .apd_energy , np .full ((2 , 7 , 10000 ), np .nan ))
572+ np .testing .assert_array_equal (l2_direct_event .energy_step , np .full ((2 , 7 , 10000 ), np .nan ))
573+ np .testing .assert_array_equal (l2_direct_event .energy_per_charge , np .full ((2 , 7 , 10000 ), np .nan ))
574+ np .testing .assert_array_equal (l2_direct_event .spin_angle , np .full ((2 , 7 , 10000 ), np .nan ))
575+ np .testing .assert_array_equal (l2_direct_event .spin_sector , np .full ((2 , 7 , 10000 ), np .nan ))
576+ np .testing .assert_array_equal (l2_direct_event .elevation_angle , np .full ((2 , 7 , 10000 ), np .nan ))
567577
568578 self .assertIsInstance (l2_direct_event .position , np .ma .masked_array )
569579 np .testing .assert_array_equal (l2_direct_event .position .data , cdf ["position" ][:, :7 , ...])
@@ -594,60 +604,37 @@ def test_codice_lo_l2_direct_events_read_from_cdf_handles_fill_value(self):
594604 self .assertTrue (np .all (l2_direct_event .tof .mask ))
595605
596606 def test_codice_lo_l1a_sw_priority_read_from_cdf_handles_fill_value (self ):
597- l1a_sw_all_fill_path = get_test_data_path ("codice/imap_codice_l1a_lo-sw-priority -all-fill_20250814_v001 .cdf" )
607+ l1a_sw_all_fill_path = get_test_data_path ("codice/imap_codice_l1a_lo-sw-priority_20260307_v003 -all-fill .cdf" )
598608 l1a_sw = CodiceLoL1aSWPriorityRates .read_from_cdf (l1a_sw_all_fill_path )
599609
600610 with CDF (str (l1a_sw_all_fill_path )) as cdf :
601611 np .testing .assert_array_equal (l1a_sw .spin_period , np .full_like (cdf ['spin_period' ], np .nan ))
602612
603- self .assertIsInstance (l1a_sw .nso_half_spin , np .ma .masked_array )
604- np .testing .assert_array_equal (l1a_sw .nso_half_spin ,
605- np .full_like (l1a_sw .nso_half_spin .data , cdf ['nso_half_spin' ]))
606- self .assertTrue (np .all (l1a_sw .nso_half_spin .mask ))
607-
608- self .assertIsInstance (l1a_sw .rgfo_half_spin , np .ma .masked_array )
609- np .testing .assert_array_equal (l1a_sw .rgfo_half_spin ,
610- np .full_like (l1a_sw .rgfo_half_spin .data , cdf ['rgfo_half_spin' ]))
611- self .assertTrue (np .all (l1a_sw .rgfo_half_spin .mask ))
612-
613- self .assertIsInstance (l1a_sw .data_quality , np .ma .masked_array )
614- np .testing .assert_array_equal (l1a_sw .data_quality ,
615- np .full_like (l1a_sw .data_quality .data , cdf ['data_quality' ]))
616- self .assertTrue (np .all (l1a_sw .data_quality .mask ))
617-
618- self .assertIsInstance (l1a_sw .p0_tcrs , np .ma .masked_array )
619- np .testing .assert_array_equal (l1a_sw .p0_tcrs , np .full_like (l1a_sw .p0_tcrs .data , cdf ['p0_tcrs' ]))
620- self .assertTrue (np .all (l1a_sw .p0_tcrs .mask ))
621-
622- self .assertIsInstance (l1a_sw .p1_hplus , np .ma .masked_array )
623- np .testing .assert_array_equal (l1a_sw .p1_hplus , np .full_like (l1a_sw .p1_hplus .data , cdf ['p1_hplus' ]))
624- self .assertTrue (np .all (l1a_sw .p1_hplus .mask ))
625-
626- self .assertIsInstance (l1a_sw .p2_heplusplus , np .ma .masked_array )
627- np .testing .assert_array_equal (l1a_sw .p2_heplusplus ,
628- np .full_like (l1a_sw .p2_heplusplus .data , cdf ['p2_heplusplus' ]))
629- self .assertTrue (np .all (l1a_sw .p2_heplusplus .mask ))
630-
631- self .assertIsInstance (l1a_sw .p3_heavies , np .ma .masked_array )
632- np .testing .assert_array_equal (l1a_sw .p3_heavies , np .full_like (l1a_sw .p3_heavies .data , cdf ['p3_heavies' ]))
633- self .assertTrue (np .all (l1a_sw .p3_heavies .mask ))
634-
635- self .assertIsInstance (l1a_sw .p4_dcrs , np .ma .masked_array )
636- np .testing .assert_array_equal (l1a_sw .p4_dcrs , np .full_like (l1a_sw .p4_dcrs .data , cdf ['p4_dcrs' ]))
637- self .assertTrue (np .all (l1a_sw .p4_dcrs .mask ))
638-
639- self .assertIsInstance (l1a_sw .st_bias_gain_mode , np .ma .masked_array )
640- np .testing .assert_array_equal (l1a_sw .st_bias_gain_mode ,
641- np .full_like (l1a_sw .st_bias_gain_mode .data , cdf ['st_bias_gain_mode' ]))
642- self .assertTrue (np .all (l1a_sw .st_bias_gain_mode .mask ))
643-
644- self .assertIsInstance (l1a_sw .sw_bias_gain_mode , np .ma .masked_array )
645- np .testing .assert_array_equal (l1a_sw .sw_bias_gain_mode ,
646- np .full_like (l1a_sw .sw_bias_gain_mode .data , cdf ['sw_bias_gain_mode' ]))
647- self .assertTrue (np .all (l1a_sw .sw_bias_gain_mode .mask ))
613+ integer_variable_names = [
614+ "nso_half_spin" ,
615+ "rgfo_half_spin" ,
616+ "data_quality" ,
617+ "p0_tcrs" ,
618+ "p1_hplus" ,
619+ "p2_heplusplus" ,
620+ "p3_heavies" ,
621+ "p4_dcrs" ,
622+ "st_bias_gain_mode" ,
623+ "sw_bias_gain_mode" ,
624+ "half_spin_per_esa_step" ,
625+ "rgfo_spin_sector" ,
626+ "rgfo_esa_step" ,
627+ "nso_spin_sector" ,
628+ "nso_esa_step" ,
629+ ]
630+
631+ for var in integer_variable_names :
632+ var_data = getattr (l1a_sw , var )
633+ self .assertIsInstance (var_data , np .ma .masked_array )
634+ np .testing .assert_equal (var_data .mask , np .full_like (cdf [var ], True ))
648635
649636 def test_codice_lo_l1a_nsw_priority_read_from_cdf_handles_fill_value (self ):
650- l1a_nsw_all_fill_path = get_test_data_path ("codice/imap_codice_l1a_lo-nsw-priority -all-fill_20250814_v001 .cdf" )
637+ l1a_nsw_all_fill_path = get_test_data_path ("codice/imap_codice_l1a_lo-nsw-priority_20260307_v003 -all-fill .cdf" )
651638
652639 l1a_nsw_model = CodiceLoL1aNSWPriorityRates .read_from_cdf (l1a_nsw_all_fill_path )
653640
0 commit comments