53
53
'(?P<aircraft_type_3_letter>\w{3})'
54
54
'\s'
55
55
'(?P<origin_of_flight>[A-Z]{3})'
56
- '(?P<scheduled_time_of_arrival_utc >\d{4})'
56
+ '(?P<scheduled_time_of_arrival_utc_utc >\d{4})'
57
57
'\s'
58
- '(?P<scheduled_time_of_departure_utc >\d{4})'
58
+ '(?P<scheduled_time_of_departure_utc_utc >\d{4})'
59
59
'(?P<overnight_indicator>[0-6])*'
60
60
'(?P<destination_of_flight>[A-Z]{3})'
61
61
'\s'
82
82
'(?P<seat_number>\d{3})'
83
83
'(?P<aircraft_type_3_letter>\w{3})'
84
84
'\s'
85
- '(?P<scheduled_time_of_departure_utc >\d{4})'
85
+ '(?P<scheduled_time_of_departure_utc_utc >\d{4})'
86
86
'(?P<destination_of_flight>[A-Z]{3})'
87
87
'\s'
88
88
'(?P<type_of_flight>[A-Z])'
106
106
'(?P<aircraft_type_3_letter>\w{3})'
107
107
'\s'
108
108
'(?P<origin_of_flight>[A-Z]{3})'
109
- '(?P<scheduled_time_of_arrival_utc >\d{4})'
109
+ '(?P<scheduled_time_of_arrival_utc_utc >\d{4})'
110
110
'\s'
111
111
'(?P<type_of_flight>[A-Z])'
112
112
'(?P<frequency_rate>\d){0,1}'
130
130
'\s'
131
131
'(?P<previous_stop_of_flight>[A-Z0-9]{3})'
132
132
'(?P<origin_of_flight>[A-Z0-9]{3})'
133
- '(?P<scheduled_time_of_arrival_utc >\d{4}){0,1}'
133
+ '(?P<scheduled_time_of_arrival_utc_utc >\d{4}){0,1}'
134
134
'\s'
135
135
'(?P<type_of_flight>[A-Z])'
136
136
'(?P<frequency_rate>\d){0,1}'
152
152
'(?P<seat_number>\d{3}){0,1}'
153
153
'(?P<aircraft_type_3_letter>\w{3})'
154
154
'\s'
155
- '(?P<scheduled_time_of_departure_utc >\d{4}){0,1}'
155
+ '(?P<scheduled_time_of_departure_utc_utc >\d{4}){0,1}'
156
156
'(?P<next_stop_of_flight>[A-Z0-9]{3})'
157
157
'(?P<destination_of_flight>[A-Z0-9]{3})'
158
158
'\s'
173
173
'(?P<end_date_of_operation>[0-9]{2}[A-Z]{3}[0-9]{2}|\s{5})'
174
174
'(?P<days_of_operation>[0-9 ]{8})'
175
175
'(?P<origin_of_flight>[A-Z]{3})'
176
- '(?P<scheduled_time_of_departure_local >\d{4})'
177
- '(?P<scheduled_time_of_departure_utc >\d{4})[+-]\d{4}'
176
+ '(?P<scheduled_time_of_departure_utc_local >\d{4})'
177
+ '(?P<scheduled_time_of_departure_utc_utc >\d{4})[+-]\d{4}'
178
178
'(?P<some_code_3>\w|\s)\s'
179
179
'(?P<destination_of_flight>[A-Z]{3})'
180
- '(?P<scheduled_time_of_arrival_local >\d{4})'
181
- '(?P<scheduled_time_of_arrival_utc >\d{4})[+-]\d{4}'
180
+ '(?P<scheduled_time_of_arrival_utc_local >\d{4})'
181
+ '(?P<scheduled_time_of_arrival_utc_utc >\d{4})[+-]\d{4}'
182
182
'(?P<some_code_4>\w|\s)\s'
183
183
'(?P<aircraft_type_3_letter>\w{3})[A-Z ]'
184
184
'\s{52}'
@@ -332,28 +332,28 @@ def _fix_bad_midnight(row):
332
332
:return row: dict, describing a slot.
333
333
"""
334
334
#for SIR
335
- if 'scheduled_time_of_arrival_utc ' in row :
336
- if row ['scheduled_time_of_arrival_utc ' ] == '2400' :
337
- row = _update_dict (row , {'scheduled_time_of_arrival_utc ' : '0000' })
335
+ if 'scheduled_time_of_arrival_utc_utc ' in row :
336
+ if row ['scheduled_time_of_arrival_utc_utc ' ] == '2400' :
337
+ row = _update_dict (row , {'scheduled_time_of_arrival_utc_utc ' : '0000' })
338
338
339
339
logging .warning ('Slot with invalid time notation. Adjusting time to 0000.\n (%s)' % row )
340
340
341
- if 'scheduled_time_of_departure_utc ' in row :
342
- if row ['scheduled_time_of_departure_utc ' ] == '2400' :
343
- row = _update_dict (row , {'scheduled_time_of_departure_utc ' : '0000' })
341
+ if 'scheduled_time_of_departure_utc_utc ' in row :
342
+ if row ['scheduled_time_of_departure_utc_utc ' ] == '2400' :
343
+ row = _update_dict (row , {'scheduled_time_of_departure_utc_utc ' : '0000' })
344
344
345
345
logging .warning ('Slot with invalid time notation. Adjusting time to 0000.\n (%s)' % row )
346
346
347
347
#for SSIM
348
- if 'scheduled_time_of_arrival_local ' in row :
349
- if row ['scheduled_time_of_arrival_utc ' ] == '2400' :
350
- row = _update_dict (row , {'scheduled_time_of_arrival_utc ' : '0000' })
348
+ if 'scheduled_time_of_arrival_utc_local ' in row :
349
+ if row ['scheduled_time_of_arrival_utc_utc ' ] == '2400' :
350
+ row = _update_dict (row , {'scheduled_time_of_arrival_utc_utc ' : '0000' })
351
351
352
352
logging .warning ('Slot with invalid time notation. Adjusting time to 0000.\n (%s)' % row )
353
353
354
- if 'scheduled_time_of_departure_local ' in row :
355
- if row ['scheduled_time_of_departure_utc ' ] == '2400' :
356
- row = _update_dict (row , {'scheduled_time_of_departure_utc ' : '0000' })
354
+ if 'scheduled_time_of_departure_utc_local ' in row :
355
+ if row ['scheduled_time_of_departure_utc_utc ' ] == '2400' :
356
+ row = _update_dict (row , {'scheduled_time_of_departure_utc_utc ' : '0000' })
357
357
358
358
logging .warning ('Slot with invalid time notation. Adjusting time to 0000.\n (%s)' % row )
359
359
@@ -514,7 +514,7 @@ def _expand_slot(slot):
514
514
# Expand ssim legs
515
515
flight_leg_slot_fields = {'action_code' , 'flight_prefix' , 'flight_suffix' , 'aircraft_type_3_letter' ,
516
516
'type_of_flight' , 'origin_of_flight' , 'seat_number' , 'additional_information' , 'raw' ,
517
- 'scheduled_time_of_departure_local ' , 'scheduled_time_of_arrival_local ' , 'destination_of_flight' ,
517
+ 'scheduled_time_of_departure_utc_local ' , 'scheduled_time_of_arrival_utc_local ' , 'destination_of_flight' ,
518
518
'connecting_flight_prefix' ,'connecting_flight_suffix' ,'frequency_rate' }
519
519
520
520
if flight_leg_slot_fields <= set (slot ):
@@ -535,16 +535,16 @@ def _expand_slot(slot):
535
535
}
536
536
537
537
#determine flight times
538
- if slot ['scheduled_time_of_arrival_utc ' ] is not None :
538
+ if slot ['scheduled_time_of_arrival_utc_utc ' ] is not None :
539
539
departure_start_date = \
540
- datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_departure_utc ' ],
540
+ datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_departure_utc_utc ' ],
541
541
'%Y-%m-%d%H%M' )
542
542
departure_end_date = \
543
- datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_departure_utc ' ], '%Y-%m-%d%H%M' )
543
+ datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_departure_utc_utc ' ], '%Y-%m-%d%H%M' )
544
544
545
545
#determine flight time
546
- departure_time = datetime .strptime (slot ['scheduled_time_of_departure_utc ' ],'%H%M' )
547
- arrival_time = datetime .strptime (slot ['scheduled_time_of_arrival_utc ' ],'%H%M' )
546
+ departure_time = datetime .strptime (slot ['scheduled_time_of_departure_utc_utc ' ],'%H%M' )
547
+ arrival_time = datetime .strptime (slot ['scheduled_time_of_arrival_utc_utc ' ],'%H%M' )
548
548
flight_leg_slot ['flight_time_seconds' ] = (arrival_time - departure_time ).seconds #if we take seconds, overnight flights will also get correct flight time because the -1 day gets removed
549
549
550
550
if slot ['frequency_rate' ]:
@@ -553,7 +553,7 @@ def _expand_slot(slot):
553
553
else :
554
554
dates = rrule (freq = WEEKLY , dtstart = departure_start_date , until = departure_end_date , byweekday = weekdays )
555
555
556
- if slot ['scheduled_time_of_departure_utc ' ] is not None :
556
+ if slot ['scheduled_time_of_departure_utc_utc ' ] is not None :
557
557
flight_leg_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d %H:%M' ) for x in dates ]
558
558
else :
559
559
flight_leg_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d' ) for x in dates ]
@@ -582,12 +582,12 @@ def _expand_slot(slot):
582
582
'raw' : slot ['raw' ]
583
583
}
584
584
585
- if slot ['scheduled_time_of_arrival_utc ' ] is not None :
585
+ if slot ['scheduled_time_of_arrival_utc_utc ' ] is not None :
586
586
arrival_start_date = \
587
- datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_arrival_utc ' ],
587
+ datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_arrival_utc_utc ' ],
588
588
'%Y-%m-%d%H%M' )
589
589
arrival_end_date = \
590
- datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_arrival_utc ' ], '%Y-%m-%d%H%M' )
590
+ datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_arrival_utc_utc ' ], '%Y-%m-%d%H%M' )
591
591
else :
592
592
arrival_start_date = \
593
593
datetime .strptime (slot ['start_date_of_operation' ], '%Y-%m-%d' )
@@ -600,7 +600,7 @@ def _expand_slot(slot):
600
600
else :
601
601
dates = rrule (freq = WEEKLY , dtstart = arrival_start_date , until = arrival_end_date , byweekday = weekdays )
602
602
603
- if slot ['scheduled_time_of_arrival_utc ' ] is not None :
603
+ if slot ['scheduled_time_of_arrival_utc_utc ' ] is not None :
604
604
arrival_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d %H:%M' ) for x in dates ]
605
605
else :
606
606
arrival_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d' ) for x in dates ]
@@ -630,12 +630,12 @@ def _expand_slot(slot):
630
630
else :
631
631
overnight_time = relativedelta (days = 0 )
632
632
633
- if slot ['scheduled_time_of_departure_utc ' ]:
633
+ if slot ['scheduled_time_of_departure_utc_utc ' ]:
634
634
departure_start_date = \
635
- datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_departure_utc ' ],
635
+ datetime .strptime (slot ['start_date_of_operation' ] + slot ['scheduled_time_of_departure_utc_utc ' ],
636
636
'%Y-%m-%d%H%M' ) + overnight_time
637
637
departure_end_date = \
638
- datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_departure_utc ' ],
638
+ datetime .strptime (slot ['end_date_of_operation' ] + slot ['scheduled_time_of_departure_utc_utc ' ],
639
639
'%Y-%m-%d%H%M' ) + overnight_time
640
640
641
641
else :
@@ -648,7 +648,7 @@ def _expand_slot(slot):
648
648
else :
649
649
dates = rrule (freq = WEEKLY , dtstart = departure_start_date , until = departure_end_date , byweekday = weekdays )
650
650
651
- if slot ['scheduled_time_of_departure_utc ' ] is not None :
651
+ if slot ['scheduled_time_of_departure_utc_utc ' ] is not None :
652
652
departure_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d %H:%M' ) for x in dates ]
653
653
else :
654
654
departure_slot ['flight_datetime' ] = [x .strftime ('%Y-%m-%d' ) for x in dates ]
@@ -731,14 +731,14 @@ def read_csv(slotfile):
731
731
flightnumber_regex = '([A-Z]{2,3}|\w{2})\s*(\d+[A-Z]*|\w+)'
732
732
arrival_header = \
733
733
('action_code' , 'origin' , 'arrival_flight_prefix' , 'arrival_flight_suffix' ,
734
- 'ad' , 'scheduled_time_of_arrival_utc ' , 'start_date_of_operation' ,
734
+ 'ad' , 'scheduled_time_of_arrival_utc_utc ' , 'start_date_of_operation' ,
735
735
'end_date_of_operation' , 'days_of_operation' , 'previous_stop_of_flight' ,
736
736
'origin_of_flight' , 'aircraft_type_3_letter' , 'type_of_flight' ,
737
737
'frequency_rate' , 'unknown_2' , 'unknown_3' , 'unknown_4' , 'season' ,
738
738
'additional_information' , 'seat_number' , 'raw' )
739
739
departure_header = \
740
740
('action_code' , 'origin' , 'departure_flight_prefix' , 'departure_flight_suffix' ,
741
- 'ad' , 'scheduled_time_of_departure_utc ' , 'start_date_of_operation' ,
741
+ 'ad' , 'scheduled_time_of_departure_utc_utc ' , 'start_date_of_operation' ,
742
742
'end_date_of_operation' , 'days_of_operation' , 'next_stop_of_flight' ,
743
743
'destination_of_flight' , 'aircraft_type_3_letter' , 'type_of_flight' ,
744
744
'frequency_rate' , 'unknown_2' , 'unknown_3' , 'unknown_4' , 'season' ,
0 commit comments