From b7afd841ff96bc44e872ca9e0a13adadaff46b77 Mon Sep 17 00:00:00 2001 From: forta Date: Wed, 16 May 2018 17:41:19 +0200 Subject: [PATCH 1/3] Import of 'util' module substituted with 'common'. --- tests/sample_run_adsb.py | 2 +- tests/sample_run_ehs.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sample_run_adsb.py b/tests/sample_run_adsb.py index 6289cb3..8b8ecfb 100644 --- a/tests/sample_run_adsb.py +++ b/tests/sample_run_adsb.py @@ -1,5 +1,5 @@ from __future__ import print_function -from pyModeS import adsb, ehs, util +from pyModeS import adsb, ehs # === Decode sample data file === diff --git a/tests/sample_run_ehs.py b/tests/sample_run_ehs.py index 2636729..180562a 100644 --- a/tests/sample_run_ehs.py +++ b/tests/sample_run_ehs.py @@ -1,5 +1,5 @@ from __future__ import print_function -from pyModeS import adsb, ehs, util +from pyModeS import adsb, ehs, common # === Decode sample data file === @@ -50,10 +50,10 @@ 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) + code = common.altcode(m) if df == 20 else common.idcode(m) if not BDS: print(ts, m, icao, df, '%5s'%code, 'UNKNOWN') From 14a537030dd3716e650037b883b08eb78ee2ce99 Mon Sep 17 00:00:00 2001 From: forta Date: Wed, 16 May 2018 19:09:02 +0200 Subject: [PATCH 2/3] Sample run of EHS decoding has been fixed. --- pyModeS/decoder/ehs.py | 5 +++++ tests/sample_run_ehs.py | 20 +++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/pyModeS/decoder/ehs.py b/pyModeS/decoder/ehs.py index 05451d2..2bc2d7b 100644 --- a/pyModeS/decoder/ehs.py +++ b/pyModeS/decoder/ehs.py @@ -2,8 +2,13 @@ from __future__ import absolute_import, print_function, division import warnings warnings.simplefilter('once', DeprecationWarning) +from pyModeS.decoder.bds.bds10 import * +from pyModeS.decoder.bds.bds17 import * +from pyModeS.decoder.bds.bds20 import * from pyModeS.decoder.bds.bds40 import * +from pyModeS.decoder.bds.bds44 import * from pyModeS.decoder.bds.bds50 import * +from pyModeS.decoder.bds.bds53 import * from pyModeS.decoder.bds.bds60 import * from pyModeS.decoder.bds import infer diff --git a/tests/sample_run_ehs.py b/tests/sample_run_ehs.py index 180562a..fa63e8e 100644 --- a/tests/sample_run_ehs.py +++ b/tests/sample_run_ehs.py @@ -1,15 +1,17 @@ from __future__ import print_function -from pyModeS import adsb, ehs, common - +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)) @@ -52,20 +54,20 @@ def ehs_decode_all(df, n=None): df = common.df(m) icao = ehs.icao(m) - BDS = ehs.BDS(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): - print(ts, m, icao, df, '%5s'%code, end=' ') - for i, bds in enumerate(BDS): + if len(BDS.split(",")) > 1: + print(ts, m, icao, df, '%5s' % code, end=' ') + for i, bds in enumerate(BDS.split(",")): if i == 0: print(bds, *bds_info(bds, m)) else: - print(' '*55, bds, *bds_info(bds, m)) + print(' ' * 55, bds, *bds_info(bds, m)) else: print(ts, m, icao, df, '%5s'%code, BDS, *bds_info(BDS, m)) From f221c672955bb24b6fd69261e703f8470a9d57cf Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Thu, 17 May 2018 09:24:31 +0200 Subject: [PATCH 3/3] keep only bds 40 50 60 Other bds code does not belong to Enhanced Mode-S definition. --- pyModeS/decoder/ehs.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyModeS/decoder/ehs.py b/pyModeS/decoder/ehs.py index 2bc2d7b..05451d2 100644 --- a/pyModeS/decoder/ehs.py +++ b/pyModeS/decoder/ehs.py @@ -2,13 +2,8 @@ from __future__ import absolute_import, print_function, division import warnings warnings.simplefilter('once', DeprecationWarning) -from pyModeS.decoder.bds.bds10 import * -from pyModeS.decoder.bds.bds17 import * -from pyModeS.decoder.bds.bds20 import * from pyModeS.decoder.bds.bds40 import * -from pyModeS.decoder.bds.bds44 import * from pyModeS.decoder.bds.bds50 import * -from pyModeS.decoder.bds.bds53 import * from pyModeS.decoder.bds.bds60 import * from pyModeS.decoder.bds import infer