update docstring
This commit is contained in:
parent
5286355bf6
commit
d77d1f7f6b
@ -15,8 +15,6 @@ from .decoder import bds
|
|||||||
from .extra import aero
|
from .extra import aero
|
||||||
from .extra import tcpclient
|
from .extra import tcpclient
|
||||||
|
|
||||||
from .encoder import encode_adsb
|
|
||||||
|
|
||||||
|
|
||||||
warnings.simplefilter("once", DeprecationWarning)
|
warnings.simplefilter("once", DeprecationWarning)
|
||||||
|
|
||||||
|
@ -47,8 +47,9 @@ def typecode(msg):
|
|||||||
|
|
||||||
|
|
||||||
def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
||||||
"""Decode position from a pair of even and odd position message
|
"""Decode position from a pair of even and odd position message.
|
||||||
(works with both airborne and surface position messages)
|
|
||||||
|
Works with both airborne and surface position messages.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg0 (string): even message (28 hexdigits)
|
msg0 (string): even message (28 hexdigits)
|
||||||
@ -58,6 +59,7 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
|||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(float, float): (latitude, longitude) of the aircraft
|
(float, float): (latitude, longitude) of the aircraft
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tc0 = typecode(msg0)
|
tc0 = typecode(msg0)
|
||||||
tc1 = typecode(msg1)
|
tc1 = typecode(msg1)
|
||||||
@ -85,15 +87,16 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None):
|
|||||||
|
|
||||||
|
|
||||||
def position_with_ref(msg, lat_ref, lon_ref):
|
def position_with_ref(msg, lat_ref, lon_ref):
|
||||||
"""Decode position with only one message,
|
"""Decode position with only one message.
|
||||||
knowing reference nearby location, such as previously
|
|
||||||
calculated location, ground station, or airport location, etc.
|
A reference position is required, which can be previously
|
||||||
Works with both airborne and surface position messages.
|
calculated location, ground station, or airport location.
|
||||||
|
The function works with both airborne and surface position messages.
|
||||||
The reference position shall be with in 180NM (airborne) or 45NM (surface)
|
The reference position shall be with in 180NM (airborne) or 45NM (surface)
|
||||||
of the true position.
|
of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): even message (28 hexdigits)
|
msg (str): even message (28 hexdigits)
|
||||||
lat_ref: previous known latitude
|
lat_ref: previous known latitude
|
||||||
lon_ref: previous known longitude
|
lon_ref: previous known longitude
|
||||||
|
|
||||||
@ -114,15 +117,15 @@ def position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
|
|
||||||
|
|
||||||
def altitude(msg):
|
def altitude(msg):
|
||||||
"""Decode aircraft altitude
|
"""Decode aircraft altitude.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: altitude in feet
|
int: altitude in feet
|
||||||
"""
|
|
||||||
|
|
||||||
|
"""
|
||||||
tc = typecode(msg)
|
tc = typecode(msg)
|
||||||
|
|
||||||
if tc < 5 or tc == 19 or tc > 22:
|
if tc < 5 or tc == 19 or tc > 22:
|
||||||
@ -137,36 +140,31 @@ def altitude(msg):
|
|||||||
return altitude05(msg)
|
return altitude05(msg)
|
||||||
|
|
||||||
|
|
||||||
def velocity(msg, rtn_sources=False):
|
def velocity(msg, source=False):
|
||||||
"""Calculate the speed, heading, and vertical rate
|
"""Calculate the speed, heading, and vertical rate (handles both airborne or surface message).
|
||||||
(handles both airborne or surface message)
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
rtn_source (boolean): If the function will return
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
the sources for direction of travel and vertical
|
If set to True, the function will return six value instead of four.
|
||||||
rate. This will change the return value from a four
|
|
||||||
element array to a six element array.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, float, int, string, string, string): speed (kt),
|
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||||
ground track or heading (degree),
|
- Speed (kt)
|
||||||
rate of climb/descent (ft/min), speed type
|
- Angle (degree), either ground track or heading
|
||||||
('GS' for ground speed, 'AS' for airspeed),
|
- Vertical rate (ft/min)
|
||||||
direction source ('true_north' for ground track / true north
|
- Speed type ('GS' for ground speed, 'AS' for airspeed)
|
||||||
as reference, 'mag_north' for magnetic north as reference),
|
- [Optional] Direction source ('TRUE_NORTH' or 'MAGENTIC_NORTH')
|
||||||
rate of climb/descent source ('Baro' for barometer, 'GNSS'
|
- [Optional] Vertical rate source ('BARO' or 'GNSS')
|
||||||
for GNSS constellation).
|
|
||||||
|
For surface messages, vertical rate and its respective sources are set to None.
|
||||||
|
|
||||||
In the case of surface messages, None will be put in place
|
|
||||||
for vertical rate and its respective sources.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if 5 <= typecode(msg) <= 8:
|
if 5 <= typecode(msg) <= 8:
|
||||||
return surface_velocity(msg, rtn_sources)
|
return surface_velocity(msg, source)
|
||||||
|
|
||||||
elif typecode(msg) == 19:
|
elif typecode(msg) == 19:
|
||||||
return airborne_velocity(msg, rtn_sources)
|
return airborne_velocity(msg, source)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
@ -179,7 +177,7 @@ def speed_heading(msg):
|
|||||||
(handles both airborne or surface message)
|
(handles both airborne or surface message)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, float): speed (kt), ground track or heading (degree)
|
(int, float): speed (kt), ground track or heading (degree)
|
||||||
@ -191,7 +189,7 @@ def speed_heading(msg):
|
|||||||
def oe_flag(msg):
|
def oe_flag(msg):
|
||||||
"""Check the odd/even flag. Bit 54, 0 for even, 1 for odd.
|
"""Check the odd/even flag. Bit 54, 0 for even, 1 for odd.
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
Returns:
|
Returns:
|
||||||
int: 0 or 1, for even or odd frame
|
int: 0 or 1, for even or odd frame
|
||||||
"""
|
"""
|
||||||
@ -203,7 +201,7 @@ def version(msg):
|
|||||||
"""ADS-B Version
|
"""ADS-B Version
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string, TC = 31
|
msg (str): 28 hexdigits string, TC = 31
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: version number
|
int: version number
|
||||||
@ -225,7 +223,7 @@ def nuc_p(msg):
|
|||||||
"""Calculate NUCp, Navigation Uncertainty Category - Position (ADS-B version 1)
|
"""Calculate NUCp, Navigation Uncertainty Category - Position (ADS-B version 1)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string,
|
msg (str): 28 hexdigits string,
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Horizontal Protection Limit
|
int: Horizontal Protection Limit
|
||||||
@ -261,7 +259,7 @@ def nuc_v(msg):
|
|||||||
"""Calculate NUCv, Navigation Uncertainty Category - Velocity (ADS-B version 1)
|
"""Calculate NUCv, Navigation Uncertainty Category - Velocity (ADS-B version 1)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string,
|
msg (str): 28 hexdigits string,
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int or string: 95% Horizontal Velocity Error
|
int or string: 95% Horizontal Velocity Error
|
||||||
@ -290,7 +288,7 @@ def nic_v1(msg, NICs):
|
|||||||
"""Calculate NIC, navigation integrity category, for ADS-B version 1
|
"""Calculate NIC, navigation integrity category, for ADS-B version 1
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
NICs (int or string): NIC supplement
|
NICs (int or string): NIC supplement
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
@ -324,7 +322,7 @@ def nic_v2(msg, NICa, NICbc):
|
|||||||
"""Calculate NIC, navigation integrity category, for ADS-B version 2
|
"""Calculate NIC, navigation integrity category, for ADS-B version 2
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
NICa (int or string): NIC supplement - A
|
NICa (int or string): NIC supplement - A
|
||||||
NICbc (int or srting): NIC supplement - B or C
|
NICbc (int or srting): NIC supplement - B or C
|
||||||
|
|
||||||
@ -362,7 +360,7 @@ def nic_s(msg):
|
|||||||
"""Obtain NIC supplement bit, TC=31 message
|
"""Obtain NIC supplement bit, TC=31 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: NICs number (0 or 1)
|
int: NICs number (0 or 1)
|
||||||
@ -384,7 +382,7 @@ def nic_a_c(msg):
|
|||||||
"""Obtain NICa/c, navigation integrity category supplements a and c
|
"""Obtain NICa/c, navigation integrity category supplements a and c
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, int): NICa and NICc number (0 or 1)
|
(int, int): NICa and NICc number (0 or 1)
|
||||||
@ -407,7 +405,7 @@ def nic_b(msg):
|
|||||||
"""Obtain NICb, navigation integrity category supplement-b
|
"""Obtain NICb, navigation integrity category supplement-b
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: NICb number (0 or 1)
|
int: NICb number (0 or 1)
|
||||||
@ -429,7 +427,7 @@ def nac_p(msg):
|
|||||||
"""Calculate NACp, Navigation Accuracy Category - Position
|
"""Calculate NACp, Navigation Accuracy Category - Position
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string, TC = 29 or 31
|
msg (str): 28 hexdigits string, TC = 29 or 31
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
|
int or string: 95% horizontal accuracy bounds, Estimated Position Uncertainty
|
||||||
@ -464,7 +462,7 @@ def nac_v(msg):
|
|||||||
"""Calculate NACv, Navigation Accuracy Category - Velocity
|
"""Calculate NACv, Navigation Accuracy Category - Velocity
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string, TC = 19
|
msg (str): 28 hexdigits string, TC = 19
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
|
int or string: 95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit
|
||||||
@ -493,7 +491,7 @@ def sil(msg, version):
|
|||||||
"""Calculate SIL, Surveillance Integrity Level
|
"""Calculate SIL, Surveillance Integrity Level
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string with TC = 29, 31
|
msg (str): 28 hexdigits string with TC = 29, 31
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int or string: Probability of exceeding Horizontal Radius of Containment RCu
|
int or string: Probability of exceeding Horizontal Radius of Containment RCu
|
||||||
|
@ -45,7 +45,7 @@ def is50or60(msg, spd_ref, trk_ref, alt_ref):
|
|||||||
"""Use reference ground speed and trk to determine BDS50 and DBS60.
|
"""Use reference ground speed and trk to determine BDS50 and DBS60.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
spd_ref (float): reference speed (ADS-B ground speed), kts
|
spd_ref (float): reference speed (ADS-B ground speed), kts
|
||||||
trk_ref (float): reference track (ADS-B track angle), deg
|
trk_ref (float): reference track (ADS-B track angle), deg
|
||||||
alt_ref (float): reference altitude (ADS-B altitude), ft
|
alt_ref (float): reference altitude (ADS-B altitude), ft
|
||||||
@ -108,7 +108,7 @@ def infer(msg, mrar=False):
|
|||||||
"""Estimate the most likely BDS code of an message.
|
"""Estimate the most likely BDS code of an message.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
|
mrar (bool): Also infer MRAR (BDS 44) and MHR (BDS 45). Defaults to False.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
|
@ -85,7 +85,7 @@ def airborne_position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
be with in 180NM of the true position.
|
be with in 180NM of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): even message (28 hexdigits)
|
msg (str): even message (28 hexdigits)
|
||||||
lat_ref: previous known latitude
|
lat_ref: previous known latitude
|
||||||
lon_ref: previous known longitude
|
lon_ref: previous known longitude
|
||||||
|
|
||||||
@ -127,7 +127,7 @@ def altitude(msg):
|
|||||||
"""Decode aircraft altitude
|
"""Decode aircraft altitude
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: altitude in feet
|
int: altitude in feet
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
# BDS 0,6
|
# BDS 0,6
|
||||||
# ADS-B TC=5-8
|
# ADS-B TC=5-8
|
||||||
# Surface position
|
# Surface movment
|
||||||
# ------------------------------------------
|
# ------------------------------------------
|
||||||
|
|
||||||
from pyModeS import common
|
from pyModeS import common
|
||||||
@ -89,7 +89,7 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
be with in 45NM of the true position.
|
be with in 45NM of the true position.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): even message (28 hexdigits)
|
msg (str): even message (28 hexdigits)
|
||||||
lat_ref: previous known latitude
|
lat_ref: previous known latitude
|
||||||
lon_ref: previous known longitude
|
lon_ref: previous known longitude
|
||||||
|
|
||||||
@ -127,23 +127,24 @@ def surface_position_with_ref(msg, lat_ref, lon_ref):
|
|||||||
return round(lat, 5), round(lon, 5)
|
return round(lat, 5), round(lon, 5)
|
||||||
|
|
||||||
|
|
||||||
def surface_velocity(msg, rtn_sources=False):
|
def surface_velocity(msg, source=False):
|
||||||
"""Decode surface velocity from from a surface position message
|
"""Decode surface velocity from a surface position message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
rtn_source (boolean): If the function will return
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
the sources for direction of travel and vertical
|
If set to True, the function will return six value instead of four.
|
||||||
rate. This will change the return value from a four
|
|
||||||
element array to a six element array.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, float, int, string, string, None): speed (kt),
|
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||||
ground track (degree), None for rate of climb/descend (ft/min),
|
- Speed (kt)
|
||||||
and speed type ('GS' for ground speed), direction source
|
- Angle (degree), ground track
|
||||||
('true_north' for ground track / true north as reference),
|
- Vertical rate, always 0
|
||||||
None rate of climb/descent source.
|
- Speed type ('GS' for ground speed, 'AS' for airspeed)
|
||||||
"""
|
- [Optional] Direction source ('TRUE_NORTH')
|
||||||
|
- [Optional] Vertical rate source (None)
|
||||||
|
|
||||||
|
"""
|
||||||
if common.typecode(msg) < 5 or common.typecode(msg) > 8:
|
if common.typecode(msg) < 5 or common.typecode(msg) > 8:
|
||||||
raise RuntimeError("%s: Not a surface message, expecting 5<TC<8" % msg)
|
raise RuntimeError("%s: Not a surface message, expecting 5<TC<8" % msg)
|
||||||
|
|
||||||
@ -174,7 +175,7 @@ def surface_velocity(msg, rtn_sources=False):
|
|||||||
spd = kts[i - 1] + (mov - movs[i - 1]) * step
|
spd = kts[i - 1] + (mov - movs[i - 1]) * step
|
||||||
spd = round(spd, 2)
|
spd = round(spd, 2)
|
||||||
|
|
||||||
if rtn_sources:
|
if source:
|
||||||
return spd, trk, 0, "GS", "true_north", None
|
return spd, trk, 0, "GS", "TRUE_NORTH", None
|
||||||
else:
|
else:
|
||||||
return spd, trk, 0, "GS"
|
return spd, trk, 0, "GS"
|
||||||
|
@ -11,7 +11,7 @@ def category(msg):
|
|||||||
"""Aircraft category number
|
"""Aircraft category number
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: category number
|
int: category number
|
||||||
@ -29,7 +29,7 @@ def callsign(msg):
|
|||||||
"""Aircraft callsign
|
"""Aircraft callsign
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
string: callsign
|
string: callsign
|
||||||
|
@ -10,27 +10,24 @@ from pyModeS import common
|
|||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
def airborne_velocity(msg, rtn_sources=False):
|
def airborne_velocity(msg, source=False):
|
||||||
"""Calculate the speed, track (or heading), and vertical rate
|
"""Decode airborne velocity.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
rtn_source (boolean): If the function will return
|
source (boolean): Include direction and vertical rate sources in return. Default to False.
|
||||||
the sources for direction of travel and vertical
|
If set to True, the function will return six value instead of four.
|
||||||
rate. This will change the return value from a four
|
|
||||||
element array to a six element array.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, float, int, string, string, string): speed (kt),
|
int, float, int, string, [string], [string]: Four or six parameters, including:
|
||||||
ground track or heading (degree),
|
- Speed (kt)
|
||||||
rate of climb/descent (ft/min), speed type
|
- Angle (degree), either ground track or heading
|
||||||
('GS' for ground speed, 'AS' for airspeed),
|
- Vertical rate (ft/min)
|
||||||
direction source ('true_north' for ground track / true north
|
- Speed type ('GS' for ground speed, 'AS' for airspeed)
|
||||||
as reference, 'mag_north' for magnetic north as reference),
|
- [Optional] Direction source ('TRUE_NORTH' or 'MAGENTIC_NORTH')
|
||||||
rate of climb/descent source ('Baro' for barometer, 'GNSS'
|
- [Optional] Vertical rate source ('BARO' or 'GNSS')
|
||||||
for GNSS constellation).
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
"""
|
||||||
if common.typecode(msg) != 19:
|
if common.typecode(msg) != 19:
|
||||||
raise RuntimeError("%s: Not a airborne velocity message, expecting TC=19" % msg)
|
raise RuntimeError("%s: Not a airborne velocity message, expecting TC=19" % msg)
|
||||||
|
|
||||||
@ -62,9 +59,9 @@ def airborne_velocity(msg, rtn_sources=False):
|
|||||||
trk = math.degrees(trk) # convert to degrees
|
trk = math.degrees(trk) # convert to degrees
|
||||||
trk = trk if trk >= 0 else trk + 360 # no negative val
|
trk = trk if trk >= 0 else trk + 360 # no negative val
|
||||||
|
|
||||||
tag = "GS"
|
spd_type = "GS"
|
||||||
trk_or_hdg = round(trk, 2)
|
trk_or_hdg = round(trk, 2)
|
||||||
dir_type = "true_north"
|
dir_type = "TRUE_NORTH"
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if mb[13] == "0":
|
if mb[13] == "0":
|
||||||
@ -81,32 +78,33 @@ def airborne_velocity(msg, rtn_sources=False):
|
|||||||
spd *= 4
|
spd *= 4
|
||||||
|
|
||||||
if mb[24] == "0":
|
if mb[24] == "0":
|
||||||
tag = "IAS"
|
spd_type = "IAS"
|
||||||
else:
|
else:
|
||||||
tag = "TAS"
|
spd_type = "TAS"
|
||||||
|
|
||||||
dir_type = "mag_north"
|
dir_type = "MAGENTIC_NORTH"
|
||||||
|
|
||||||
vr_source = "GNSS" if mb[35] == "0" else "Baro"
|
vr_source = "GNSS" if mb[35] == "0" else "BARO"
|
||||||
vr_sign = -1 if mb[36] == "1" else 1
|
vr_sign = -1 if mb[36] == "1" else 1
|
||||||
vr = common.bin2int(mb[37:46])
|
vr = common.bin2int(mb[37:46])
|
||||||
rocd = None if vr == 0 else int(vr_sign * (vr - 1) * 64)
|
vs = None if vr == 0 else int(vr_sign * (vr - 1) * 64)
|
||||||
|
|
||||||
if rtn_sources:
|
if source:
|
||||||
return spd, trk_or_hdg, rocd, tag, dir_type, vr_source
|
return spd, trk_or_hdg, vs, spd_type, dir_type, vr_source
|
||||||
else:
|
else:
|
||||||
return spd, trk_or_hdg, rocd, tag
|
return spd, trk_or_hdg, vs, spd_type
|
||||||
|
|
||||||
|
|
||||||
def altitude_diff(msg):
|
def altitude_diff(msg):
|
||||||
"""Decode the differece between GNSS and barometric altitude
|
"""Decode the differece between GNSS and barometric altitude.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (string): 28 bytes hexadecimal message string, TC=19
|
msg (str): 28 hexdigits string, TC=19
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Altitude difference in ft. Negative value indicates GNSS altitude
|
int: Altitude difference in feet. Negative value indicates GNSS altitude
|
||||||
below barometric altitude.
|
below barometric altitude.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tc = common.typecode(msg)
|
tc = common.typecode(msg)
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ def is10(msg):
|
|||||||
"""Check if a message is likely to be BDS code 1,0
|
"""Check if a message is likely to be BDS code 1,0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -42,7 +42,7 @@ def ovc10(msg):
|
|||||||
"""Return the overlay control capability
|
"""Return the overlay control capability
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Whether the transponder is OVC capable
|
int: Whether the transponder is OVC capable
|
||||||
|
@ -10,7 +10,7 @@ def is17(msg):
|
|||||||
"""Check if a message is likely to be BDS code 1,7
|
"""Check if a message is likely to be BDS code 1,7
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -42,7 +42,7 @@ def cap17(msg):
|
|||||||
"""Extract capacities from BDS 1,7 message
|
"""Extract capacities from BDS 1,7 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
list: list of support BDS codes
|
list: list of support BDS codes
|
||||||
|
@ -10,7 +10,7 @@ def is20(msg):
|
|||||||
"""Check if a message is likely to be BDS code 2,0
|
"""Check if a message is likely to be BDS code 2,0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -36,7 +36,7 @@ def cs20(msg):
|
|||||||
"""Aircraft callsign
|
"""Aircraft callsign
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS40) string
|
msg (str): 28 hexdigits (BDS40) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
string: callsign, max. 8 chars
|
string: callsign, max. 8 chars
|
||||||
|
@ -10,7 +10,7 @@ def is30(msg):
|
|||||||
"""Check if a message is likely to be BDS code 2,0
|
"""Check if a message is likely to be BDS code 2,0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
|
@ -11,7 +11,7 @@ def is40(msg):
|
|||||||
"""Check if a message is likely to be BDS code 4,0
|
"""Check if a message is likely to be BDS code 4,0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -54,7 +54,7 @@ def selalt40mcp(msg):
|
|||||||
"""Selected altitude, MCP/FCU
|
"""Selected altitude, MCP/FCU
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS40) string
|
msg (str): 28 hexdigits (BDS40) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: altitude in feet
|
int: altitude in feet
|
||||||
@ -72,7 +72,7 @@ def selalt40fms(msg):
|
|||||||
"""Selected altitude, FMS
|
"""Selected altitude, FMS
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS40) string
|
msg (str): 28 hexdigits (BDS40) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: altitude in feet
|
int: altitude in feet
|
||||||
@ -90,7 +90,7 @@ def p40baro(msg):
|
|||||||
"""Barometric pressure setting
|
"""Barometric pressure setting
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS40) string
|
msg (str): 28 hexdigits (BDS40) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: pressure in millibar
|
float: pressure in millibar
|
||||||
|
@ -12,7 +12,7 @@ def is44(msg):
|
|||||||
Meteorological routine air report
|
Meteorological routine air report
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -55,7 +55,7 @@ def wind44(msg):
|
|||||||
"""Wind speed and direction.
|
"""Wind speed and direction.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(int, float): speed (kt), direction (degree)
|
(int, float): speed (kt), direction (degree)
|
||||||
@ -77,7 +77,7 @@ def temp44(msg):
|
|||||||
"""Static air temperature.
|
"""Static air temperature.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float, float: temperature and alternative temperature in Celsius degree.
|
float, float: temperature and alternative temperature in Celsius degree.
|
||||||
@ -106,7 +106,7 @@ def p44(msg):
|
|||||||
"""Static pressure.
|
"""Static pressure.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: static pressure in hPa
|
int: static pressure in hPa
|
||||||
@ -126,7 +126,7 @@ def hum44(msg):
|
|||||||
"""humidity
|
"""humidity
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: percentage of humidity, [0 - 100] %
|
float: percentage of humidity, [0 - 100] %
|
||||||
@ -145,7 +145,7 @@ def turb44(msg):
|
|||||||
"""Turblence.
|
"""Turblence.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: turbulence level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: turbulence level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
|
@ -12,7 +12,7 @@ def is45(msg):
|
|||||||
Meteorological hazard report
|
Meteorological hazard report
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -64,7 +64,7 @@ def turb45(msg):
|
|||||||
"""Turbulence.
|
"""Turbulence.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Turbulence level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: Turbulence level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
@ -82,7 +82,7 @@ def ws45(msg):
|
|||||||
"""Wind shear.
|
"""Wind shear.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Wind shear level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: Wind shear level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
@ -100,7 +100,7 @@ def mb45(msg):
|
|||||||
"""Microburst.
|
"""Microburst.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Microburst level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: Microburst level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
@ -118,7 +118,7 @@ def ic45(msg):
|
|||||||
"""Icing.
|
"""Icing.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Icing level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: Icing level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
@ -136,7 +136,7 @@ def wv45(msg):
|
|||||||
"""Wake vortex.
|
"""Wake vortex.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: Wake vortex level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
int: Wake vortex level. 0=NIL, 1=Light, 2=Moderate, 3=Severe
|
||||||
@ -154,7 +154,7 @@ def temp45(msg):
|
|||||||
"""Static air temperature.
|
"""Static air temperature.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: tmeperature in Celsius degree
|
float: tmeperature in Celsius degree
|
||||||
@ -178,7 +178,7 @@ def p45(msg):
|
|||||||
"""Average static pressure.
|
"""Average static pressure.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: static pressure in hPa
|
int: static pressure in hPa
|
||||||
@ -195,7 +195,7 @@ def rh45(msg):
|
|||||||
"""Radio height.
|
"""Radio height.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: radio height in ft
|
int: radio height in ft
|
||||||
|
@ -11,7 +11,7 @@ def is50(msg):
|
|||||||
(Track and turn report)
|
(Track and turn report)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -61,7 +61,7 @@ def roll50(msg):
|
|||||||
"""Roll angle, BDS 5,0 message
|
"""Roll angle, BDS 5,0 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS50) string
|
msg (str): 28 hexdigits (BDS50) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: angle in degrees,
|
float: angle in degrees,
|
||||||
@ -86,7 +86,7 @@ def trk50(msg):
|
|||||||
"""True track angle, BDS 5,0 message
|
"""True track angle, BDS 5,0 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS50) string
|
msg (str): 28 hexdigits (BDS50) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: angle in degrees to true north (from 0 to 360)
|
float: angle in degrees to true north (from 0 to 360)
|
||||||
@ -115,7 +115,7 @@ def gs50(msg):
|
|||||||
"""Ground speed, BDS 5,0 message
|
"""Ground speed, BDS 5,0 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS50) string
|
msg (str): 28 hexdigits (BDS50) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: ground speed in knots
|
int: ground speed in knots
|
||||||
@ -133,7 +133,7 @@ def rtrk50(msg):
|
|||||||
"""Track angle rate, BDS 5,0 message
|
"""Track angle rate, BDS 5,0 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS50) string
|
msg (str): 28 hexdigits (BDS50) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: angle rate in degrees/second
|
float: angle rate in degrees/second
|
||||||
@ -159,7 +159,7 @@ def tas50(msg):
|
|||||||
"""Aircraft true airspeed, BDS 5,0 message
|
"""Aircraft true airspeed, BDS 5,0 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS50) string
|
msg (str): 28 hexdigits (BDS50) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: true airspeed in knots
|
int: true airspeed in knots
|
||||||
|
@ -11,7 +11,7 @@ def is53(msg):
|
|||||||
(Air-referenced state vector)
|
(Air-referenced state vector)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -62,7 +62,7 @@ def hdg53(msg):
|
|||||||
"""Magnetic heading, BDS 5,3 message
|
"""Magnetic heading, BDS 5,3 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS53) string
|
msg (str): 28 hexdigits (BDS53) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: angle in degrees to true north (from 0 to 360)
|
float: angle in degrees to true north (from 0 to 360)
|
||||||
@ -91,7 +91,7 @@ def ias53(msg):
|
|||||||
"""Indicated airspeed, DBS 5,3 message
|
"""Indicated airspeed, DBS 5,3 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message
|
msg (str): 28 hexdigits
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: indicated arispeed in knots
|
int: indicated arispeed in knots
|
||||||
@ -109,7 +109,7 @@ def mach53(msg):
|
|||||||
"""MACH number, DBS 5,3 message
|
"""MACH number, DBS 5,3 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message
|
msg (str): 28 hexdigits
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: MACH number
|
float: MACH number
|
||||||
@ -127,7 +127,7 @@ def tas53(msg):
|
|||||||
"""Aircraft true airspeed, BDS 5,3 message
|
"""Aircraft true airspeed, BDS 5,3 message
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message
|
msg (str): 28 hexdigits
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: true airspeed in knots
|
float: true airspeed in knots
|
||||||
@ -145,7 +145,7 @@ def vr53(msg):
|
|||||||
"""Vertical rate
|
"""Vertical rate
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: vertical rate in feet/minutes
|
int: vertical rate in feet/minutes
|
||||||
|
@ -10,7 +10,7 @@ def is60(msg):
|
|||||||
"""Check if a message is likely to be BDS code 6,0
|
"""Check if a message is likely to be BDS code 6,0
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message string
|
msg (str): 28 hexdigits string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
bool: True or False
|
bool: True or False
|
||||||
@ -61,7 +61,7 @@ def hdg60(msg):
|
|||||||
"""Megnetic heading of aircraft
|
"""Megnetic heading of aircraft
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: heading in degrees to megnetic north (from 0 to 360)
|
float: heading in degrees to megnetic north (from 0 to 360)
|
||||||
@ -90,7 +90,7 @@ def ias60(msg):
|
|||||||
"""Indicated airspeed
|
"""Indicated airspeed
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: indicated airspeed in knots
|
int: indicated airspeed in knots
|
||||||
@ -108,7 +108,7 @@ def mach60(msg):
|
|||||||
"""Aircraft MACH number
|
"""Aircraft MACH number
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
float: MACH number
|
float: MACH number
|
||||||
@ -126,7 +126,7 @@ def vr60baro(msg):
|
|||||||
"""Vertical rate from barometric measurement, this value may be very noisy.
|
"""Vertical rate from barometric measurement, this value may be very noisy.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: vertical rate in feet/minutes
|
int: vertical rate in feet/minutes
|
||||||
@ -152,7 +152,7 @@ def vr60ins(msg):
|
|||||||
"""Vertical rate measurd by onbard equiments (IRS, AHRS)
|
"""Vertical rate measurd by onbard equiments (IRS, AHRS)
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
msg (String): 28 bytes hexadecimal message (BDS60) string
|
msg (str): 28 hexdigits (BDS60) string
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
int: vertical rate in feet/minutes
|
int: vertical rate in feet/minutes
|
||||||
|
Loading…
Reference in New Issue
Block a user