-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.py
38 lines (25 loc) · 1.25 KB
/
calculator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from geopy.distance import vincenty
def td_distance(final_df):
runway_start = [[final_df.runwayLat[i], final_df.runwayLong[i]]
for i in range(len(final_df))]
plane_land = [[final_df.touchdownLat[i], final_df.touchdownLong[i]]
for i in range(len(final_df))]
td_dist = [vincenty(runway_start[i], plane_land[i]).meters
for i in range(len(runway_start))]
return td_dist
def exit_distance(runway_info_df, exit_info_df):
all_dist = []
for i in runway_info_df.runway:
exits_on_runway = exit_info_df[exit_info_df.runway.str.contains(i)]
exit_loc = [[exits_on_runway.lat[w], exits_on_runway.long[w]]
for w in exits_on_runway.axes[0]]
runway_start = [float(runway_info_df.lat[runway_info_df.runway == i]),
float(runway_info_df.long[runway_info_df.runway == i])]
distance = [vincenty(runway_start, exit_loc[j]).meters
for j in range(len(exit_loc))]
# Matches exit label with distance
dist_dict = dict(zip(exits_on_runway.exit, distance))
all_dist.append(dist_dict)
# Matches runways with their exits
all_dict = dict(zip(runway_info_df.runway, all_dist))
return all_dict