From 457a948879eed7831ca709cccf4f9c8145b06a5f Mon Sep 17 00:00:00 2001 From: JoseAndresMR Date: Fri, 22 Jun 2018 12:31:19 +0200 Subject: [PATCH] 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