From db57d7419fd79f18c2a9af4d793f7ba6b0cb7fd6 Mon Sep 17 00:00:00 2001 From: wrobell Date: Wed, 11 Mar 2020 21:08:04 +0000 Subject: [PATCH 1/3] Improve doc for surface position decoding --- pyModeS/decoder/adsb.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pyModeS/decoder/adsb.py b/pyModeS/decoder/adsb.py index 41a92ca..15d6467 100644 --- a/pyModeS/decoder/adsb.py +++ b/pyModeS/decoder/adsb.py @@ -49,14 +49,19 @@ def typecode(msg): def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None): - """Decode position from a pair of even and odd position message - (works with both airborne and surface position messages) + """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. Args: msg0 (string): even message (28 bytes hexadecimal string) msg1 (string): odd message (28 bytes hexadecimal string) 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: (float, float): (latitude, longitude) of the aircraft @@ -65,11 +70,10 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None): tc1 = typecode(msg1) if 5 <= tc0 <= 8 and 5 <= tc1 <= 8: - if (not lat_ref) or (not lon_ref): + if lat_ref is None or lon_ref is None: raise RuntimeError( - "Surface position encountered, a reference \ - position lat/lon required. Location of \ - receiver can be used." + "Surface position encountered, a reference position" + " lat/lon required. Location of receiver can be used." ) else: return surface_position(msg0, msg1, t0, t1, lat_ref, lon_ref) @@ -83,7 +87,7 @@ def position(msg0, msg1, t0, t1, lat_ref=None, lon_ref=None): return airborne_position(msg0, msg1, t0, t1) else: - raise RuntimeError("incorrect or inconsistent message types") + raise RuntimeError("Incorrect or inconsistent message types") def position_with_ref(msg, lat_ref, lon_ref): From aa64d4e7a9bde3ceb46008fa1b6d0195069dd917 Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Sat, 4 Apr 2020 20:44:46 +0200 Subject: [PATCH 2/3] update README --- README.rst | 71 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 34 deletions(-) diff --git a/README.rst b/README.rst index 4e88878..b0bddba 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,43 @@ The Python ADS-B/Mode-S Decoder =============================== +PyModeS is a Python library designed to decode Mode-S (including ADS-B) message. It can be imported to your python project or used as a standalone tool to view and save live traffic data. + +This is a projected created by Junzi Sun, who works at `TU Delft `_, `Aerospace Engineering Faculty `_, `CNS/ATM research group `_. It is supported by a number of `contributors `_ from different institutions. + + +Introduction +------------ + +pyModeS supports the decoding of following types of messages: + +- DF4 / DF20: Altitude code +- DF5 / DF21: Identity code (squawk code) + +- DF17 / DF18: Automatic Dependent Surveillance-Broadcast (ADS-B) + + - TC=1-4 / BDS 0,8: Aircraft identification and category + - TC=5-8 / BDS 0,6: Surface position + - TC=9-18 / BDS 0,5: Airborne position + - TC=19 / BDS 0,9: Airborne velocity + - TC=28 / BDS 6,1: Airborne status [to be implemented] + - TC=29 / BDS 6,2: Target state and status information [to be implemented] + - TC=31 / BDS 6,5: Aircraft operational status [to be implemented] + +- DF20 / DF21: Mode-S Comm-B messages + + - BDS 1,0: Data link capability report + - BDS 1,7: Common usage GICB capability report + - BDS 2,0: Aircraft identification + - BDS 3,0: ACAS active resolution advisory + - BDS 4,0: Selected vertical intention + - BDS 4,4: Meteorological routine air report (experimental) + - BDS 4,5: Meteorological hazard report (experimental) + - BDS 5,0: Track and turn report + - BDS 6,0: Heading and speed report + + + If you find this project useful for your research, please considering cite this tool as:: @article{sun2019pymodes, @@ -14,40 +51,6 @@ If you find this project useful for your research, please considering cite this -Introduction ---------------------- -PyModeS is a Python library designed to decode Mode-S (including ADS-B) message. It can be imported to your python project or be used as a standalone tool to view and save live traffic data. - -Messages with following Downlink Formats (DF) are supported: - -**DF17 / DF18: Automatic Dependent Surveillance-Broadcast (ADS-B)** - -- TC=1-4 / BDS 0,8: Aircraft identification and category -- TC=5-8 / BDS 0,6: Surface position -- TC=9-18 / BDS 0,5: Airborne position -- TC=19 / BDS 0,9: Airborne velocity -- TC=28 / BDS 6,1: Airborne status [to be implemented] -- TC=29 / BDS 6,2: Target state and status information [to be implemented] -- TC=31 / BDS 6,5: Aircraft operational status [to be implemented] - - -**DF20 / DF21: Mode-S Comm-B replies** - -- BDS 1,0: Data link capability report -- BDS 1,7: Common usage GICB capability report -- BDS 2,0: Aircraft identification -- BDS 3,0: ACAS active resolution advisory -- BDS 4,0: Selected vertical intention -- BDS 4,4: Meteorological routine air report (experimental) -- BDS 4,5: Meteorological hazard report (experimental) -- BDS 5,0: Track and turn report -- BDS 6,0: Heading and speed report - - -**DF4 / DF20: Altitude code** - -**DF5 / DF21: Identity code (squawk code)** - Resources ----------- From 6571fe6fc0dd4bd651eba7702a25cce0e4422c09 Mon Sep 17 00:00:00 2001 From: Junzi Sun Date: Sat, 4 Apr 2020 20:48:23 +0200 Subject: [PATCH 3/3] Update README.rst --- README.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.rst b/README.rst index b0bddba..fa14a34 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,7 @@ The Python ADS-B/Mode-S Decoder PyModeS is a Python library designed to decode Mode-S (including ADS-B) message. It can be imported to your python project or used as a standalone tool to view and save live traffic data. -This is a projected created by Junzi Sun, who works at `TU Delft `_, `Aerospace Engineering Faculty `_, `CNS/ATM research group `_. It is supported by a number of `contributors `_ from different institutions. - +This is a project created by Junzi Sun, who works at `TU Delft `_, `Aerospace Engineering Faculty `_, `CNS/ATM research group `_. It is supported by many `contributors `_ from different institutions. Introduction ------------