Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions GA_Detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import multiprocessing as mp
from OS_Airports import VABB
import OS_Funcs as OSF
import os
import glob


Expand Down Expand Up @@ -39,6 +40,8 @@ def main(start_n, fidder, do_write):
odir_da_ga = top_dir + 'OUT_DATA/PSGA/'

odirs = [odir_pl_nm, odir_pl_ga, odir_da_nm, odir_da_ga]
for odir in odirs:
os.makedirs(odir, exist_ok=True)

# Output filenames for saving data about go-arounds
out_file_ga = 'GA_MET_NEW.csv'
Expand All @@ -60,12 +63,12 @@ def main(start_n, fidder, do_write):
Temp, Dewp, Wind_Spd, Wind_Gust, Wind_Dir,Cld_Base,\
CB, Vis, Pressure\n')
files = []
files = glob.glob(indir+'**.pkl')
files = glob.glob(indir+'*.pkl') + glob.glob(indir+'*/*.pkl')
files.sort()

fli_len = len(files)

colormap = {'GND': 'black', 'CL': 'green', 'CR': 'blue',
colormap = {'GND': 'black', 'GN': 'black', 'CL': 'green', 'CR': 'blue',
'DE': 'orange', 'LVL': 'purple', 'NA': 'red'}

# Number of files to open in one go
Expand Down
19 changes: 10 additions & 9 deletions OS_Funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def proc_fl(flight, check_rwys, odirs, colormap, do_save, verbose):
# Correct barometric altitudes
t_alt = fd['alts']
l_time = fd['strt'] + (fd['dura'] / 2)
l_time = pd.Timestamp(l_time, tz='UTC')
l_time = pd.Timestamp(l_time)
bmet, tdiff = find_closest_metar(l_time, metars)
if (bmet is not None):
t_alt = correct_baro(t_alt, bmet.temp, bmet.pres)
Expand All @@ -363,16 +363,17 @@ def proc_fl(flight, check_rwys, odirs, colormap, do_save, verbose):
# Now the actual go-around check
ga_flag, gapt = check_ga(fd, True)

if (ga_flag):
odir_pl = odirs[1]
odir_np = odirs[3]
else:
odir_pl = odirs[0]
odir_np = odirs[2]

# Make some plots if required, this needs a spline to smooth output
if do_save:
spldict = create_spline(fd, bpos=None)
# Choose output directory based upon go-around flag
if (ga_flag):
odir_pl = odirs[1]
odir_np = odirs[3]
else:
odir_pl = odirs[0]
odir_np = odirs[2]
OSO.do_plots(fd,
spldict,
colormap,
Expand All @@ -381,8 +382,7 @@ def proc_fl(flight, check_rwys, odirs, colormap, do_save, verbose):
bpos=None)
if (ga_flag):
ga_time = pd.Timestamp(fd['strt'] +
pd.Timedelta(seconds=fd['time'][gapt]),
tz='UTC')
pd.Timedelta(seconds=fd['time'][gapt]))
else:
gapt = 0
ga_time = fd['strt']
Expand Down Expand Up @@ -679,6 +679,7 @@ def do_labels(fd):
try:
labels = flph.fuzzylabels(fd['time'], fd['alts'],
fd['spds'], fd['rocs'], twindow=15)
labels = np.array(labels)
except Exception as e:
print("Error creating spline", e, fd['call'])
quit()
Expand Down