@@ -468,9 +468,87 @@ def determine_spice_offset(date: datetime):
468468 processor = GlowsProcessor (processing_input , input_metadata )
469469 processor .process ()
470470
471+ @run_periodically (timedelta (days = 14 ))
472+ def test_glows_l3abcde_with_prod_l2 (self ):
473+ ancillary_file_paths = [
474+ GLOWS_TEST_DATA / "imap_glows_calibration-data_20000101_v003.dat" ,
475+ GLOWS_TEST_DATA / "imap_glows_map-of-extra-helio-bckgrd_20251112_v001.dat" ,
476+ GLOWS_TEST_DATA / "imap_glows_pipeline-settings_20251112_v001.json" ,
477+ GLOWS_TEST_DATA / "imap_glows_time-dep-bckgrd_20251112_v001.dat"
478+ ]
479+
480+ prod_data_folder = get_run_local_data_path ("glows_prod_data" )
481+
482+ l2_paths = list ((prod_data_folder / "imap/glows/l2" ).rglob ("*.cdf" ))
483+ input_files = l2_paths + ancillary_file_paths
484+
485+ l3a_integration_data_dir = get_run_local_data_path ("test_glows_l3a_with_prod_l2" )
486+ with (mock_imap_data_access (l3a_integration_data_dir , input_files )):
487+ for i , l2_path in enumerate (l2_paths ):
488+ l2_science_file_path = ScienceFilePath (l2_path )
489+ l2_science_input = ScienceInput (l2_path .name )
490+ input_files .extend (ancillary_file_paths )
491+
492+ start_date , end_date = l2_science_input .get_time_range ()
493+
494+ input_metadata = InputMetadata (
495+ instrument = "glows" ,
496+ data_level = "l3a" ,
497+ start_date = start_date ,
498+ end_date = end_date ,
499+ version = "v001" ,
500+ descriptor = "hist" ,
501+ repointing = l2_science_file_path .repointing ,
502+ )
503+
504+ ancillary_inputs = [AncillaryInput (ancillary .name ) for ancillary in ancillary_file_paths ]
505+ processing_inputs = [l2_science_input , * ancillary_inputs ]
506+ processor = GlowsProcessor (ProcessingInputCollection (* processing_inputs ), input_metadata )
507+
508+ try :
509+ _ = processor .process ()
510+ except Exception as e :
511+ print (f"Processing L3a day { start_date } failed! Reason: { e } " )
512+
513+ l3bcde_ancillary_inputs = [
514+ GLOWS_TEST_DATA / "imap_glows_uv-anisotropy-1CR_20100101_v001.json" ,
515+ GLOWS_TEST_DATA / "imap_glows_WawHelioIonMP_20100101_v001.json" ,
516+ GLOWS_TEST_DATA / "imap_glows_bad-days-list_20100101_v001.dat" ,
517+ GLOWS_TEST_DATA / "imap_glows_pipeline-settings-l3bcde_20100101_v003.json" ,
518+ GLOWS_TEST_DATA / "imap_glows_plasma-speed-2010a_20100101_v001.dat" ,
519+ GLOWS_TEST_DATA / "imap_glows_proton-density-2010a_20100101_v001.dat" ,
520+ GLOWS_TEST_DATA / "imap_glows_uv-anisotropy-2010a_20100101_v001.dat" ,
521+ GLOWS_TEST_DATA / "imap_glows_photoion-2010a_20100101_v001.dat" ,
522+ GLOWS_TEST_DATA / "imap_glows_lya-2010a_20100101_v001.dat" ,
523+ GLOWS_TEST_DATA / "imap_glows_electron-density-2010a_20100101_v001.dat" ,
524+ GLOWS_TEST_DATA / "imap_glows_ionization-files_20100101_v001.dat" ,
525+ GLOWS_TEST_DATA / "imap_glows_energy-grid-lo_20100101_v001.dat" ,
526+ GLOWS_TEST_DATA / "imap_glows_tess-xyz-8_20100101_v001.dat" ,
527+ GLOWS_TEST_DATA / "imap_lo_elongation-data_20100101_v001.dat" ,
528+ GLOWS_TEST_DATA / "imap_glows_energy-grid-hi_20100101_v001.dat" ,
529+ GLOWS_TEST_DATA / "imap_glows_energy-grid-ultra_20100101_v001.dat" ,
530+ GLOWS_TEST_DATA / "imap_glows_tess-ang-16_20100101_v001.dat" ,
531+ GLOWS_TEST_DATA / "imap_2026_090_01.repoint"
532+ ]
533+ l3a_inputs = list ((l3a_integration_data_dir / "imap/glows/l3a" ).rglob ("*.cdf" ))
534+ prod_spice_inputs = list ((prod_data_folder / "imap/spice/repoint" ).rglob ("*" ))
535+
536+ logging .basicConfig (force = True , level = logging .INFO ,
537+ format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' )
538+
539+ input_paths = l3bcde_ancillary_inputs + l3a_inputs + prod_spice_inputs
540+ with mock_imap_data_access (get_run_local_data_path ("test_glows_l3bcde_with_prod_l2" ), input_paths ):
541+ processing_input = ProcessingInputCollection (RepointInput ("imap_2026_090_01.repoint" ))
542+ input_metadata = InputMetadata (instrument = "glows" , data_level = "l3b" , descriptor = "ion-rate-profile" ,
543+ version = "v001" , start_date = datetime (2000 , 1 , 1 ),
544+ end_date = datetime (2000 , 1 , 1 ))
545+
546+ processor = GlowsProcessor (processing_input , input_metadata )
547+ processor .process ()
548+
471549 @staticmethod
472550 def _fill_official_l2_cdf_with_json_values (output_folder : Path ) -> Path :
473- official_l2_path = get_test_data_path ("glows/imap_glows_l2_hist_20130908-repoint01000_v001 .cdf" )
551+ official_l2_path = get_test_data_path ("glows/imap_glows_l2_hist_20251224-repoint00088_v001 .cdf" )
474552 json_file_path = get_test_instrument_team_data_path ("glows/imap_glows_l2_20130908085214_orbX_modX_p_v00.json" )
475553
476554 new_file_path = output_folder / official_l2_path .name
@@ -486,8 +564,8 @@ def _fill_official_l2_cdf_with_json_values(output_folder: Path) -> Path:
486564 epoch = start_of_epoch_window + epoch_window / 2
487565
488566 cdf ["epoch" ][0 ] = epoch
489- cdf ['start_time' ][0 ] = ( start_of_epoch_window - TTJ2000_EPOCH ). total_seconds () * 1e9
490- cdf ['end_time' ][0 ] = ( end_of_epoch_window - TTJ2000_EPOCH ). total_seconds () * 1e9
567+ cdf ['start_time' ][0 ] = instrument_data [ "start_time" ]
568+ cdf ['end_time' ][0 ] = instrument_data [ "end_time" ]
491569
492570 lightcurve_vars = [
493571 "spin_angle" ,
0 commit comments