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