Merge pull request #21 from federicoorta/dev-2.0

Run samples updated in dev-2.0
This commit is contained in:
Junzi Sun 2018-05-17 09:32:12 +02:00 committed by GitHub
commit 72c1a9f645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View File

@ -1,5 +1,5 @@
from __future__ import print_function
from pyModeS import adsb, ehs, util
from pyModeS import adsb, ehs
# === Decode sample data file ===

View File

@ -1,15 +1,17 @@
from __future__ import print_function
from pyModeS import adsb, ehs, util
from pyModeS import adsb, ehs, common, bds as _bds
# === Decode sample data file ===
def bds_info(BDS, m):
if BDS == "BDS17":
if BDS == "BDS10":
info = [ehs.ovc10(m)]
elif BDS == "BDS17":
info = ([i[-2:] for i in ehs.cap17(m)])
elif BDS == "BDS20":
info = ehs.callsign(m)
info = [ehs.cs20(m)]
elif BDS == "BDS40":
info = (ehs.alt40mcp(m), ehs.alt40fms(m), ehs.p40baro(m))
@ -50,18 +52,18 @@ def ehs_decode_all(df, n=None):
ts = r[0]
m = r[2]
df = util.df(m)
df = common.df(m)
icao = ehs.icao(m)
BDS = ehs.BDS(m)
code = ehs.df20alt(m) if df==20 else ehs.df21id(m)
BDS = _bds.infer(m)
code = common.altcode(m) if df == 20 else common.idcode(m)
if not BDS:
print(ts, m, icao, df, '%5s'%code, 'UNKNOWN')
continue
if isinstance(BDS, list):
if len(BDS.split(",")) > 1:
print(ts, m, icao, df, '%5s' % code, end=' ')
for i, bds in enumerate(BDS):
for i, bds in enumerate(BDS.split(",")):
if i == 0:
print(bds, *bds_info(bds, m))
else: