Skip to content

Commit

Permalink
add loading function for runway thresholds from airport surface file
Browse files Browse the repository at this point in the history
  • Loading branch information
jooste committed Apr 7, 2016
1 parent 62cf35b commit 3ebc7f8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion bluesky/navdb/navdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self,subfolder):
self.wpseg.append(361*[[]])
self.apseg.append(361*[[]])

wptdata, aptdata, firdata = load_navdata()
wptdata, aptdata, firdata, rwythresholds = load_navdata()
self.wpid = wptdata['wpid'] # identifier (string)
self.wplat = wptdata['wplat'] # latitude [deg]
self.wplon = wptdata['wplon'] # longitude [deg]
Expand All @@ -71,6 +71,8 @@ def __init__(self,subfolder):
self.firlat1 = firdata['firlat1']
self.firlon1 = firdata['firlon1']

self.rwythresholds = rwythresholds

def getwpidx(self,txt,lat=999999.,lon=999999):
"""Get waypoint index to access data"""
name = txt.upper()
Expand Down
3 changes: 2 additions & 1 deletion bluesky/tools/load_visuals_txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def load_aptsurface_txt():
pb.show()

REARTH_INV = 1.56961231e-7
rwythresholds = dict()
runways = []
asphalt = PolygonSet()
concrete = PolygonSet()
Expand Down Expand Up @@ -288,4 +289,4 @@ def load_aptsurface_txt():
pb.close()

# return the data
return vbuf_asphalt, vbuf_concrete, vbuf_runways, apt_ctr_lat, apt_ctr_lon, apt_indices
return vbuf_asphalt, vbuf_concrete, vbuf_runways, apt_ctr_lat, apt_ctr_lon, apt_indices, rwythresholds
10 changes: 8 additions & 2 deletions bluesky/tools/loaddata.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ def load_coastlines():
def load_aptsurface():
if not os.path.isfile(cachedir + '/aptsurface.p'):
vbuf_asphalt, vbuf_concrete, vbuf_runways, apt_ctr_lat, apt_ctr_lon, \
apt_indices = load_aptsurface_txt()
apt_indices, rwythresholds = load_aptsurface_txt()
with open(cachedir + '/aptsurface.p', 'wb') as f:
pickle.dump(vbuf_asphalt, f, pickle.HIGHEST_PROTOCOL)
pickle.dump(vbuf_concrete, f, pickle.HIGHEST_PROTOCOL)
pickle.dump(vbuf_runways , f, pickle.HIGHEST_PROTOCOL)
pickle.dump(apt_ctr_lat , f, pickle.HIGHEST_PROTOCOL)
pickle.dump(apt_ctr_lon , f, pickle.HIGHEST_PROTOCOL)
pickle.dump(apt_indices , f, pickle.HIGHEST_PROTOCOL)
with open(cachedir + '/rwythresholds.p', 'wb') as f:
pickle.dump(rwythresholds, f, pickle.HIGHEST_PROTOCOL)
else:
with open(cachedir + '/aptsurface.p', 'rb') as f:
vbuf_asphalt = pickle.load(f)
Expand All @@ -66,4 +68,8 @@ def load_navdata():
wptdata = pickle.load(f)
aptdata = pickle.load(f)
firdata = pickle.load(f)
return wptdata, aptdata, firdata
if not os.path.isfile(cachedir + '/rwythresholds.p'):
load_aptsurface()
with open(cachedir + '/rwythresholds.p', 'rb') as f:
rwythresholds = pickle.load(f)
return wptdata, aptdata, firdata, rwythresholds

0 comments on commit 3ebc7f8

Please sign in to comment.