def ehs_decode_all(n=None): print "===== Decode all Mode-S EHS sample data=====" import csv f = open('ehs.csv', 'rt') for i, r in enumerate(csv.reader(f)): if n and i > n: break ts = r[1] m = r[2] icao = ehs.icao(m) vBDS = ehs.BDS(m) if vBDS: if vBDS == "BDS20": print ts, m, icao, vBDS, ehs.callsign(m) if vBDS == "BDS40": print ts, m, icao, vBDS, ehs.alt_mcp(m), \ ehs.alt_fms(m), ehs.pbaro(m) if vBDS == "BDS50": print ts, m, icao, vBDS, ehs.roll(m), ehs.track(m), \ ehs.gs(m), ehs.rtrack(m), ehs.tas(m) if vBDS == "BDS60": print ts, m, icao, vBDS, ehs.heading(m), ehs.ias(m), \ ehs.mach(m), ehs.baro_vr(m), ehs.ins_vr(m) else: print ts, m, icao, vBDS
def test_ehs_BDS50_functions(): assert ehs.roll("A000139381951536E024D4CCF6B5") == 2.1 assert ehs.track("A000139381951536E024D4CCF6B5") == 114.3 assert ehs.gs("A000139381951536E024D4CCF6B5") == 438 assert ehs.rtrack("A000139381951536E024D4CCF6B5") == 0.125 assert ehs.tas("A000139381951536E024D4CCF6B5") == 424