Open wrobell opened 3 years ago
I am looking into implementation of altitude
function. I can see that pyModeS
has three functions.
IMHO, this is bit problematic. For an array of messages, I would prefer to have single API function to calculate altitude for all types of messages.
Would you be OK with pyModeS
API changes? Probably, these would be needed if you accept the direction I am taking in this pull request - df
and typecode
functions are overloaded and accept a string message or array of messages.
I am looking into implementation of
altitude
function. I can see thatpyModeS
has three functions.IMHO, this is bit problematic. For an array of messages, I would prefer to have single API function to calculate altitude for all types of messages.
Would you be OK with
pyModeS
API changes? Probably, these would be needed if you accept the direction I am taking in this pull request -df
andtypecode
functions are overloaded and accept a string message or array of messages.
Yes, we can change API if it makes the code cleaner and easier to use. Let's try to consolidate these functions:
gray2alt()
can be removed and merged into altitude()
directly. altcode()
can also be merged into altitude, but then we have to handle multiple input types, ie.14-digit and 28-digit hexadcimal string, and 13-digit binary string. This is because altitude bits are located in different places for Mode S and ADS-B messages. Any suggestions?Regarding the 12-bit vs 13-bit altitude data parsing
13-bit version can be converted into 12-bit with bit mask&shift, then use one implementation to get the result?
Regarding 14/28 digit messages. 28-digit messages are always df=(17, 18), so it is easy to distinguish between them?
DF 20 and 21 also have 28 hex digits.
This is work in progress to start discussion to add vectorized versions of the pyModeS functions.
This pull request adds vectorized
df
andtypecode
functions.Overloaded functions are exposed via
pyModeS.common
module, because the original functions are defined as common. This is bit messy at the moment and requires further discussion about the structure of submodules of the library.