pyModeS.decoder.adsb module

ADS-B module.

The ADS-B module also imports functions from the following modules:

  • pyModeS.decoder.bds.bds05: airborne_position(), airborne_position_with_ref(), altitude()

  • pyModeS.decoder.bds.bds06: surface_position(), surface_position_with_ref(), surface_velocity()

  • pyModeS.decoder.bds.bds08: category(), callsign()

  • pyModeS.decoder.bds.bds09: airborne_velocity(), altitude_diff()

pyModeS.decoder.adsb.altitude(msg)[source]

Decode aircraft altitude.

Parameters

msg (str) – 28 hexdigits string

Returns

altitude in feet

Return type

int

pyModeS.decoder.adsb.df(msg)[source]
pyModeS.decoder.adsb.icao(msg)[source]
pyModeS.decoder.adsb.nac_p(msg)[source]

Calculate NACp, Navigation Accuracy Category - Position

Parameters

msg (str) – 28 hexdigits string, TC = 29 or 31

Returns

95% horizontal accuracy bounds, Estimated Position Uncertainty int or string: 95% vertical accuracy bounds, Vertical Estimated Position Uncertainty

Return type

int or string

pyModeS.decoder.adsb.nac_v(msg)[source]

Calculate NACv, Navigation Accuracy Category - Velocity

Parameters

msg (str) – 28 hexdigits string, TC = 19

Returns

95% horizontal accuracy bounds for velocity, Horizontal Figure of Merit int or string: 95% vertical accuracy bounds for velocity, Vertical Figure of Merit

Return type

int or string

pyModeS.decoder.adsb.nic_a_c(msg)[source]

Obtain NICa/c, navigation integrity category supplements a and c

Parameters

msg (str) – 28 hexdigits string

Returns

NICa and NICc number (0 or 1)

Return type

(int, int)

pyModeS.decoder.adsb.nic_b(msg)[source]

Obtain NICb, navigation integrity category supplement-b

Parameters

msg (str) – 28 hexdigits string

Returns

NICb number (0 or 1)

Return type

int

pyModeS.decoder.adsb.nic_s(msg)[source]

Obtain NIC supplement bit, TC=31 message

Parameters

msg (str) – 28 hexdigits string

Returns

NICs number (0 or 1)

Return type

int

pyModeS.decoder.adsb.nic_v1(msg, NICs)[source]

Calculate NIC, navigation integrity category, for ADS-B version 1

Parameters
  • msg (str) – 28 hexdigits string

  • NICs (int or string) – NIC supplement

Returns

Horizontal Radius of Containment int or string: Vertical Protection Limit

Return type

int or string

pyModeS.decoder.adsb.nic_v2(msg, NICa, NICbc)[source]

Calculate NIC, navigation integrity category, for ADS-B version 2

Parameters
  • msg (str) – 28 hexdigits string

  • NICa (int or string) – NIC supplement - A

  • NICbc (int or srting) – NIC supplement - B or C

Returns

Horizontal Radius of Containment

Return type

int or string

pyModeS.decoder.adsb.nuc_p(msg)[source]

Calculate NUCp, Navigation Uncertainty Category - Position (ADS-B version 1)

Parameters

msg (str) – 28 hexdigits string,

Returns

Horizontal Protection Limit int: 95% Containment Radius - Horizontal (meters) int: 95% Containment Radius - Vertical (meters)

Return type

int

pyModeS.decoder.adsb.nuc_v(msg)[source]

Calculate NUCv, Navigation Uncertainty Category - Velocity (ADS-B version 1)

Parameters

msg (str) – 28 hexdigits string,

Returns

95% Horizontal Velocity Error int or string: 95% Vertical Velocity Error

Return type

int or string

pyModeS.decoder.adsb.oe_flag(msg)[source]

Check the odd/even flag. Bit 54, 0 for even, 1 for odd. :param msg: 28 hexdigits string :type msg: str

Returns

0 or 1, for even or odd frame

Return type

int

pyModeS.decoder.adsb.position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None)[source]

Decode surface or airborne position from a pair of even and odd position messages.

Note, that to decode surface position using the position message pair, the reference position has to be provided.

Parameters
  • msg0 (string) – even message (28 hexdigits)

  • msg1 (string) – odd message (28 hexdigits)

  • t0 (int) – timestamps for the even message

  • t1 (int) – timestamps for the odd message

  • lat_ref (float) – latitude of reference position

  • lon_ref (float) – longitude of reference position

Returns

(latitude, longitude) of the aircraft

Return type

(float, float)

pyModeS.decoder.adsb.position_with_ref(msg, lat_ref, lon_ref)[source]

Decode position with only one message.

A reference position is required, which can be previously 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) of the true position.

Parameters
  • msg (str) – even message (28 hexdigits)

  • lat_ref – previous known latitude

  • lon_ref – previous known longitude

Returns

(latitude, longitude) of the aircraft

Return type

(float, float)

pyModeS.decoder.adsb.sil(msg, version)[source]

Calculate SIL, Surveillance Integrity Level

Parameters

msg (str) – 28 hexdigits string with TC = 29, 31

Returns

Probability of exceeding Horizontal Radius of Containment RCu int or string: Probability of exceeding Vertical Integrity Containment Region VPL string: SIL supplement based on per “hour” or “sample”, or ‘unknown’

Return type

int or string

pyModeS.decoder.adsb.speed_heading(msg)[source]

Get speed and ground track (or heading) from the velocity message (handles both airborne or surface message)

Parameters

msg (str) – 28 hexdigits string

Returns

speed (kt), ground track or heading (degree)

Return type

(int, float)

pyModeS.decoder.adsb.typecode(msg)[source]
pyModeS.decoder.adsb.velocity(msg, source=False)[source]

Calculate the speed, heading, and vertical rate (handles both airborne or surface message).

Parameters
  • msg (str) – 28 hexdigits string

  • source (boolean) – Include direction and vertical rate sources in return. Default to False. If set to True, the function will return six value instead of four.

Returns

Four or six parameters, including:
  • Speed (kt)

  • Angle (degree), either ground track or heading

  • Vertical rate (ft/min)

  • Speed type (‘GS’ for ground speed, ‘AS’ for airspeed)

  • [Optional] Direction source (‘TRUE_NORTH’ or ‘MAGENTIC_NORTH’)

  • [Optional] Vertical rate source (‘BARO’ or ‘GNSS’)

For surface messages, vertical rate and its respective sources are set to None.

Return type

int, float, int, string, [string], [string]

pyModeS.decoder.adsb.version(msg)[source]

ADS-B Version

Parameters

msg (str) – 28 hexdigits string, TC = 31

Returns

version number

Return type

int