@@ -83,7 +83,40 @@ def test_get_maps_that_can_be_produced(self, mock_read_cdf_parents):
8383 version = "v001" ,
8484 descriptor = 'h45-ena-h-sf-sp-anti-hae-4deg-3mo' ,
8585 )
86- )
86+ ),
87+ PossibleMapToProduce (
88+ input_files = {
89+ 'imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100701_v001.cdf' ,
90+ 'imap_glows_l3e_survival-probability-hi-45_20100702-repoint00202_v001.cdf' ,
91+ 'imap_hi_l1c_45sensor-pset_20100401-repoint00201_v001.cdf' ,
92+ 'imap_hi_l1c_45sensor-pset_20100402-repoint00202_v001.cdf' ,
93+ 'imap_hi_l1c_45sensor-pset_20100403-repoint00203_v001.cdf' ,
94+ },
95+ input_metadata = InputMetadata (
96+ instrument = "hi" ,
97+ data_level = "l3" ,
98+ start_date = datetime (2010 , 7 , 1 ),
99+ end_date = datetime (2010 , 9 , 30 , 7 , 30 ),
100+ version = "v001" ,
101+ descriptor = 'h45-ena-h-sf-sp-anti-hae-4deg-3mo' ,
102+ )
103+ ),
104+ PossibleMapToProduce (
105+ input_files = {
106+ 'imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20101001_v001.cdf' ,
107+ 'imap_hi_l1c_45sensor-pset_20101001-repoint00301_v001.cdf' ,
108+ 'imap_hi_l1c_45sensor-pset_20101002-repoint00302_v001.cdf' ,
109+ 'imap_hi_l1c_45sensor-pset_20101003-repoint00303_v001.cdf' ,
110+ },
111+ input_metadata = InputMetadata (
112+ instrument = "hi" ,
113+ data_level = "l3" ,
114+ start_date = datetime (2010 , 10 , 1 ),
115+ end_date = datetime (2010 , 12 , 31 , 7 , 30 ),
116+ version = "v001" ,
117+ descriptor = 'h45-ena-h-sf-sp-anti-hae-4deg-3mo' ,
118+ )
119+ ),
87120 ]
88121
89122 initializer = HiSPInitializer ()
@@ -100,10 +133,39 @@ def test_get_maps_that_can_be_produced(self, mock_read_cdf_parents):
100133 mock_read_cdf_parents .assert_has_calls ([
101134 call ('imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100101_v001.cdf' ),
102135 call ('imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100401_v001.cdf' ),
136+ call ('imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100701_v001.cdf' ),
137+ call ('imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20101001_v001.cdf' ),
103138 ], any_order = True )
104139
105140 self .assertEqual (expected_possible_maps , actual_possible_maps )
106141
142+ @patch ('imap_l3_processing.maps.map_initializer.read_cdf_parents' )
143+ def test_get_maps_that_can_be_produced_with_no_glows_data (self , mock_read_cdf_parents ):
144+ self .mock_query .side_effect = [
145+ create_mock_query_results ([]),
146+ create_mock_query_results ([]),
147+ create_mock_query_results ([
148+ 'imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100101_v001.cdf' ,
149+ 'imap_hi_l2_h45-ena-h-sf-nsp-anti-hae-4deg-3mo_20100401_v001.cdf' ,
150+ ]),
151+ create_mock_query_results ([])
152+ ]
153+
154+ mock_read_cdf_parents .side_effect = self .create_fake_read_cdf_parents ("45" )
155+
156+ initializer = HiSPInitializer ()
157+
158+ actual_possible_maps = initializer .get_maps_that_can_be_produced ('h45-ena-h-sf-sp-anti-hae-4deg-3mo' )
159+
160+ self .assertEqual (2 , len (actual_possible_maps ))
161+ for possible_map in actual_possible_maps :
162+ glows_files = [f for f in possible_map .input_files if 'glows' in f ]
163+ self .assertEqual ([], glows_files )
164+ l2_files = [f for f in possible_map .input_files if '_l2_' in f ]
165+ self .assertGreater (len (l2_files ), 0 )
166+ l1c_files = [f for f in possible_map .input_files if '_l1c_' in f ]
167+ self .assertGreater (len (l1c_files ), 0 )
168+
107169 @patch ('imap_l3_processing.maps.map_initializer.read_cdf_parents' )
108170 def test_get_maps_that_can_be_produced_full_spin_descriptor (self , mock_read_cdf_parents ):
109171 self .mock_query .side_effect = [
@@ -275,7 +337,40 @@ def test_get_maps_that_should_be_produced(self, mock_read_cdf_parents):
275337 version = "v002" ,
276338 descriptor = 'h90-ena-h-sf-sp-anti-hae-4deg-3mo' ,
277339 )
278- )
340+ ),
341+ PossibleMapToProduce (
342+ input_files = {
343+ 'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20100701_v001.cdf' ,
344+ 'imap_glows_l3e_survival-probability-hi-90_20100702-repoint00201_v001.cdf' ,
345+ 'imap_hi_l1c_90sensor-pset_20100401-repoint00201_v001.cdf' ,
346+ 'imap_hi_l1c_90sensor-pset_20100402-repoint00202_v001.cdf' ,
347+ 'imap_hi_l1c_90sensor-pset_20100403-repoint00203_v001.cdf' ,
348+ },
349+ input_metadata = InputMetadata (
350+ instrument = "hi" ,
351+ data_level = "l3" ,
352+ start_date = datetime (2010 , 7 , 1 ),
353+ end_date = datetime (2010 , 9 , 30 , 7 , 30 ),
354+ version = "v001" ,
355+ descriptor = 'h90-ena-h-sf-sp-anti-hae-4deg-3mo' ,
356+ )
357+ ),
358+ PossibleMapToProduce (
359+ input_files = {
360+ 'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20101001_v001.cdf' ,
361+ 'imap_hi_l1c_90sensor-pset_20101001-repoint00301_v001.cdf' ,
362+ 'imap_hi_l1c_90sensor-pset_20101002-repoint00302_v001.cdf' ,
363+ 'imap_hi_l1c_90sensor-pset_20101003-repoint00303_v001.cdf' ,
364+ },
365+ input_metadata = InputMetadata (
366+ instrument = "hi" ,
367+ data_level = "l3" ,
368+ start_date = datetime (2010 , 10 , 1 ),
369+ end_date = datetime (2010 , 12 , 31 , 7 , 30 ),
370+ version = "v001" ,
371+ descriptor = 'h90-ena-h-sf-sp-anti-hae-4deg-3mo' ,
372+ )
373+ ),
279374 ]
280375
281376 initializer = HiSPInitializer ()
@@ -292,6 +387,8 @@ def test_get_maps_that_should_be_produced(self, mock_read_cdf_parents):
292387 mock_read_cdf_parents .assert_has_calls ([
293388 call (f'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20100101_v001.cdf' ),
294389 call (f'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20100401_v001.cdf' ),
390+ call (f'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20100701_v001.cdf' ),
391+ call (f'imap_hi_l2_h90-ena-h-sf-nsp-anti-hae-4deg-3mo_20101001_v001.cdf' ),
295392
296393 call (f'imap_hi_l3_h90-ena-h-sf-sp-anti-hae-4deg-3mo_20100101_v001.cdf' ),
297394 call (f'imap_hi_l3_h90-ena-h-sf-sp-anti-hae-4deg-3mo_20100401_v001.cdf' ),
0 commit comments