Skip to content

Commit 594cf39

Browse files
committed
Implementing sim time_mode
1 parent c228098 commit 594cf39

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: ssim/ssim.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,21 @@ def _parse_sim(text):
179179
# record_4 = regexes['sim']['record_4'].finditer(text)
180180
# record_5 = regexes['sim']['record_5'].search(text).groupdict()
181181

182-
time_mode = record_2['time_mode']
183-
if time_mode!='U':
184-
raise NotImplementedError("Support for times other than U not yet implemented. Found time mode " + time_mode)
185182
flight_leg_records = list(map(lambda x: x.groupdict(), record_3))
186183
flight_leg_records = [_strip_dict_values(x) for x in flight_leg_records]
184+
185+
if record_2["time_mode"] == "U":
186+
[x.update({"scheduled_time_of_aircraft_arrival": x["scheduled_time_of_aircraft_arrival"] + "+0000"}) for x in flight_leg_records]
187+
[x.update({"scheduled_time_of_passenger_arrival": x["scheduled_time_of_passenger_arrival"] + "+0000"}) for x in flight_leg_records]
188+
[x.update({"scheduled_time_of_aircraft_departure": x["scheduled_time_of_aircraft_departure"] + "+0000"}) for x in flight_leg_records]
189+
[x.update({"scheduled_time_of_passenger_departure": x["scheduled_time_of_passenger_departure"] + "+0000"}) for x in flight_leg_records]
190+
191+
elif record_2["time_mode"] == "L":
192+
[x.update({"scheduled_time_of_aircraft_arrival": x["scheduled_time_of_aircraft_arrival"] + x["utc_local_time_variation_arrival"]}) for x in flight_leg_records]
193+
[x.update({"scheduled_time_of_passenger_arrival": x["scheduled_time_of_passenger_arrival"] + x["utc_local_time_variation_arrival"]}) for x in flight_leg_records]
194+
[x.update({"scheduled_time_of_aircraft_departure": x["scheduled_time_of_aircraft_departure"] + x["utc_local_time_variation_departure"]}) for x in flight_leg_records]
195+
[x.update({"scheduled_time_of_passenger_departure": x["scheduled_time_of_passenger_departure"] + x["utc_local_time_variation_departure"]}) for x in flight_leg_records]
196+
187197
# segment_data_records = list(map(lambda x: x.groupdict(), record_4))
188198

189199
return flight_leg_records

0 commit comments

Comments
 (0)