From 3c14579040bcbe88bc4b5219eebc8de4aab339ab Mon Sep 17 00:00:00 2001 From: Alexander Hirsch Date: Fri, 17 May 2019 09:45:16 -0700 Subject: [PATCH] velocity default argument for backwards compatibility --- pyModeS/decoder/adsb.py | 12 ++++++++---- pyModeS/decoder/bds/bds06.py | 13 ++++++++++--- pyModeS/decoder/bds/bds09.py | 12 ++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/pyModeS/decoder/adsb.py b/pyModeS/decoder/adsb.py index 521ce1d..9253ee5 100644 --- a/pyModeS/decoder/adsb.py +++ b/pyModeS/decoder/adsb.py @@ -143,12 +143,16 @@ def altitude(msg): return None -def velocity(msg): +def velocity(msg, rtn_sources=False): """Calculate the speed, heading, and vertical rate (handles both airborne or surface message) Args: msg (string): 28 bytes hexadecimal message string + rtn_source (boolean): If the function will return + the sources for direction of travel and vertical + rate. This will change the return value from a four + element array to a six element array. Returns: (int, float, int, string, string, string): speed (kt), @@ -160,14 +164,14 @@ def velocity(msg): barometer, 'GNSS' for GNSS constellation). In the case of surface messages, None will be put in place - for direction, vertical rate, and their respective sources. + for vertical rate and its respective sources. """ if 5 <= typecode(msg) <= 8: - return surface_velocity(msg) + return surface_velocity(msg, rtn_sources) elif typecode(msg) == 19: - return airborne_velocity(msg) + return airborne_velocity(msg, rtn_sources) else: raise RuntimeError("incorrect or inconsistant message types, expecting 4