14
14
hist_arguments = ["query" , "-c" , "OPERA_L2_CSLC-S1_V1" , "--processing-mode=historical" , "--start-date=2021-01-24T23:00:00Z" ,\
15
15
"--end-date=2021-01-24T23:00:00Z" , "--frame-range=100,101" ]
16
16
17
- BURST_MAP = Path (__file__ ).parent / "opera-disp-s1-consistent-burst-ids-2024-10-14-2016-07-01_to_2024-09-04.json"
18
- disp_burst_map_hist , burst_to_frames , datetime_to_frames = cslc_utils .process_disp_frame_burst_hist (BURST_MAP )
17
+ s3 , path , file , burst_file_url = cslc_utils .get_s3_resource_from_settings ("DISP_S1_BURST_DB_S3PATH" )
18
+ file = Path (__file__ ).parent / file
19
+ disp_burst_map_hist , burst_to_frames , datetime_to_frames = cslc_utils .process_disp_frame_burst_hist (file )
19
20
20
21
frame_blackout_dates = process_disp_blackout_dates (Path (__file__ ).parent / "sample_disp_s1_blackout.json" )
21
22
blackout_dates_obj = DispS1BlackoutDates (frame_blackout_dates , disp_burst_map_hist , burst_to_frames )
22
23
23
24
#TODO: We may change the database json during production that could have different burst ids for the same frame
24
25
#TODO: So we may want to create different versions of this unit test, one for each version of the database json
25
26
def test_burst_map ():
26
- assert len (disp_burst_map_hist .keys ()) == 1428
27
+ assert len (disp_burst_map_hist .keys ()) == 1427
27
28
burst_set = set ()
28
29
for burst in ['T042-088905-IW2' , 'T042-088907-IW3' , 'T042-088907-IW2' , 'T042-088910-IW1' , 'T042-088910-IW3' , 'T042-088913-IW1' , 'T042-088906-IW1' , 'T042-088911-IW1' , 'T042-088912-IW2' , 'T042-088913-IW2' , 'T042-088907-IW1' , 'T042-088913-IW3' , 'T042-088909-IW3' , 'T042-088912-IW3' , 'T042-088909-IW1' , 'T042-088909-IW2' , 'T042-088908-IW2' , 'T042-088910-IW2' , 'T042-088906-IW3' , 'T042-088911-IW2' , 'T042-088908-IW1' , 'T042-088912-IW1' , 'T042-088911-IW3' , 'T042-088905-IW1' , 'T042-088905-IW3' , 'T042-088906-IW2' , 'T042-088908-IW3' ]:
29
30
burst_set .add (burst )
30
31
assert disp_burst_map_hist [11114 ].burst_ids .difference (burst_set ) == set ()
31
32
diff_time = disp_burst_map_hist [11114 ].sensing_datetimes [0 ] - dateutil .parser .isoparse ("2016-08-10T14:07:13" )
32
33
assert diff_time .total_seconds () < 60
33
34
34
- assert len (disp_burst_map_hist [46799 ].burst_ids ) == 15
35
- assert len (disp_burst_map_hist [46799 ].sensing_datetimes ) == 1
35
+ assert len (disp_burst_map_hist [46799 ].burst_ids ) == 16
36
+ assert len (disp_burst_map_hist [46799 ].sensing_datetimes ) == 0
36
37
37
- assert len (disp_burst_map_hist [28498 ].burst_ids ) == 23
38
+ assert len (disp_burst_map_hist [28498 ].burst_ids ) == 18
38
39
39
40
def test_split_download_batch_id ():
40
41
"""Test that the download batch id is correctly split into frame and acquisition cycle"""
@@ -90,7 +91,7 @@ def test_parse_cslc_native_id():
90
91
burst_id , acquisition_dts , acquisition_cycles , frame_ids = \
91
92
cslc_utils .parse_cslc_native_id ("OPERA_L2_CSLC-S1_T050-105601-IW3_20160823T025448Z_20240614T120433Z_S1A_VV_v1.1" , burst_to_frames , disp_burst_map_hist )
92
93
assert frame_ids == [13200 , 13201 ]
93
- assert disp_burst_map_hist [13200 ].sensing_datetimes [0 ] == dateutil .parser .isoparse ("2016 -08-23T02 :54:48 " )
94
+ assert disp_burst_map_hist [13200 ].sensing_datetimes [0 ] == dateutil .parser .isoparse ("2017 -08-18T02 :54:31 " )
94
95
95
96
#TODO: 09-05-2024 Uncomment after the database file has been updated
96
97
'''burst_id, acquisition_dts, acquisition_cycles, frame_ids = \
@@ -113,7 +114,7 @@ def test_build_ccslc_m_index():
113
114
def test_determine_acquisition_cycle_cslc ():
114
115
"""Test that the acquisition cycle is correctly determined"""
115
116
acquisition_cycle = cslc_utils .determine_acquisition_cycle_cslc (dateutil .parser .isoparse ("20170227T230524" ), 831 , disp_burst_map_hist )
116
- assert acquisition_cycle == 12
117
+ assert acquisition_cycle == 240
117
118
118
119
acquisition_cycle = cslc_utils .determine_acquisition_cycle_cslc (dateutil .parser .isoparse ("20170203T230547" ), 832 , disp_burst_map_hist )
119
120
assert acquisition_cycle == 216
@@ -130,7 +131,7 @@ def test_determine_k_cycle():
130
131
cslc_dependency = CSLCDependency (10 , 1 , disp_burst_map_hist , args , token , cmr , settings , blackout_dates_obj ) # m doesn't matter here
131
132
132
133
k_cycle = cslc_dependency .determine_k_cycle (dateutil .parser .isoparse ("20170227T230524" ), None , 831 )
133
- assert k_cycle == 2
134
+ assert k_cycle == 5
134
135
135
136
k_cycle = cslc_dependency .determine_k_cycle (dateutil .parser .isoparse ("20160702T230546" ), None , 832 )
136
137
assert k_cycle == 1
@@ -271,15 +272,15 @@ def test_nearest_sensing_datetime():
271
272
272
273
count , nearest_time = cslc_utils .get_nearest_sensing_datetime (disp_burst_map_hist [8882 ].sensing_datetimes ,
273
274
dateutil .parser .isoparse ("2027-11-02T00:26:48" ))
274
- assert nearest_time == dateutil .parser .isoparse ("2024-08-28T00:27:00 " )
275
+ assert nearest_time == dateutil .parser .isoparse ("2024-12-26T00:26:57 " )
275
276
276
277
def test_calculate_historical_progress ():
277
278
end_date = dateutil .parser .isoparse ("2018-07-01T00:00:00" )
278
279
frame_states = {'46288' : 30 , '46289' : 30 , '26690' : 45 , '26691' : 45 , '38500' : 0 }
279
280
280
281
progress , frame_completion , last_processed_datetimes \
281
282
= cslc_utils .calculate_historical_progress (frame_states , end_date , disp_burst_map_hist )
282
- assert progress == 67
283
+ assert progress == 69
283
284
assert frame_completion == {'46288' : 71 , '46289' : 71 , '26690' : 100 , '26691' : 100 , '38500' : 0 }
284
285
assert last_processed_datetimes == {'46288' : datetime (2018 , 1 , 29 , 13 , 43 , 14 ),
285
286
'46289' : datetime (2018 , 1 , 29 , 13 , 43 , 36 ),
0 commit comments