Exemple #1
0
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 ehs_decode_all(df, n=None):
    import csv

    print("===== Decode EHS sample data (DF=%s)=====" % df)

    f = open('tests/data/sample_data_ehs_df%s.csv' % df, 'rt')

    for i, r in enumerate(csv.reader(f)):
        if n and i > n:
            break

        ts = r[0]
        m = r[2]

        df = util.df(m)
        icao = ehs.icao(m)
        BDS = ehs.BDS(m)
        code = ehs.df20alt(m) if df == 20 else ehs.df21id(m)

        if not BDS:
            print(ts, m, icao, df, '%5s' % code, 'UNKNOWN')
            continue

        if isinstance(BDS, list):
            print(ts, m, icao, df, '%5s' % code, end=' ')
            for i, bds in enumerate(BDS):
                if i == 0:
                    print(bds, *bds_info(bds, m))
                else:
                    print(' ' * 55, bds, *bds_info(bds, m))

        else:
            print(ts, m, icao, df, '%5s' % code, BDS, *bds_info(BDS, m))
Exemple #3
0
def test_ehs_BDS():
    assert ehs.BDS("A0001838201584F23468207CDFA5") == 'BDS20'
    assert ehs.BDS("A0001839CA3800315800007448D9") == 'BDS40'
    assert ehs.BDS("A000139381951536E024D4CCF6B5") == 'BDS50'
    assert ehs.BDS("A000029CFFBAA11E2004727281F1") == 'BDS60'
    assert ehs.BDS("A0281838CAE9E12FA03FFF2DDDE5") == 'BDS44'
    assert ehs.BDS("A00017B0C8480030A4000024512F") is None
Exemple #4
0
def test_ehs_BDS():
    assert ehs.BDS("A0001838201584F23468207CDFA5") == 'BDS20'
    assert ehs.BDS("A0001839CA3800315800007448D9") == 'BDS40'
    # assert ehs.BDS("A000031DBAA9DD18622C441330E9") == 'BDS44'
    assert ehs.BDS("A000139381951536E024D4CCF6B5") == 'BDS50'
    assert ehs.BDS("A00004128F39F91A7E27C46ADC21") == 'BDS60'