From 457a948879eed7831ca709cccf4f9c8145b06a5f Mon Sep 17 00:00:00 2001 From: JoseAndresMR Date: Fri, 22 Jun 2018 12:31:19 +0200 Subject: [PATCH 1/2] Uncertainty and Accuracy parameters --- pyModeS/decoder/adsb.py | 266 +++++++++++++++++++++++++++++++++++++ pyModeS/streamer/stream.py | 50 ++++++- 2 files changed, 314 insertions(+), 2 deletions(-) diff --git a/pyModeS/decoder/adsb.py b/pyModeS/decoder/adsb.py index e509fce..0421d65 100644 --- a/pyModeS/decoder/adsb.py +++ b/pyModeS/decoder/adsb.py @@ -222,3 +222,269 @@ def oe_flag(msg): """ msgbin = common.hex2bin(msg) return int(msgbin[53]) + +# Uncertainty & accuracy + +def nic_v1(msg,nic_sup_b): + """Calculate NIC, navigation integrity category + + Args: + msg (string): 28 bytes hexadecimal message string, nic_sup_b (int): NIC supplement + + Returns: + int: NIC number (from 0 to 11), -1 if not applicable + """ + if typecode(msg) < 5 or typecode(msg) > 22: + raise RuntimeError("%s: Not a surface position message (5 22: + raise RuntimeError("%s: Not a surface position message (5 18: + raise RuntimeError("%s: Not a airborne position message, expecting 8 Date: Fri, 22 Jun 2018 22:52:11 +0200 Subject: [PATCH 2/2] fixing code --- pyModeS/decoder/adsb.py | 201 ++++++++++++++++++------------------- pyModeS/streamer/stream.py | 24 ++--- 2 files changed, 108 insertions(+), 117 deletions(-) diff --git a/pyModeS/decoder/adsb.py b/pyModeS/decoder/adsb.py index 0421d65..dacce31 100644 --- a/pyModeS/decoder/adsb.py +++ b/pyModeS/decoder/adsb.py @@ -166,53 +166,6 @@ def speed_heading(msg): return spd, trk_or_hdg -def nic(msg): - """Calculate NIC, navigation integrity category - - Args: - msg (string): 28 bytes hexadecimal message string - - Returns: - int: NIC number (from 0 to 11), -1 if not applicable - """ - if typecode(msg) < 9 or typecode(msg) > 18: - raise RuntimeError("%s: Not a airborne position message, expecting 8 22: - raise RuntimeError("%s: Not a surface position message (5 22: - raise RuntimeError("%s: Not a surface position message (5 18: - raise RuntimeError("%s: Not a airborne position message, expecting 8 18: + raise RuntimeError("%s: Not a airborne position message, expecting 8