You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a bit of KLV metadata that I'm trying to parse, but I've run into an edge case that needs handled. Basically, since my sensor isn't actually flying, it's returning dummy data. For instance, it's first value is b'\x02\x08\x00\x00\x00\x00\x00\x00\x00\x00', which is a precision timestamp corresponding to the UTC epoch. That's fine, but when the parser gets to sensor latitude, the corresponding bytes are b'\x0D\x04\x80\x00\x00\x00'. That '\x80\x00\x00\x00' becomes an integer of -2147483648, which is outside the allowed domain of (-(2**31-1), 2**31-1). Providing such an extreme value is the sensor's way of signaling that it doesn't exist, but unfortunately this raises a generic ValueError (which was really difficult to trace down, requiring me to understand the code and go through it step by step). When such a domain error is encountered, I would propose that instead of raising a ValueError, the value is reported as None.
The text was updated successfully, but these errors were encountered:
For reference, from the table on page 17 in the standard here:
Sensor Latitude. Based on WGS84 ellipsoid.
Map -(2^31-1)..(2^31-1) to +/-90.
Use -(2^31) as an "error" indicator.
-(2^31) = 0x80000000.
Resolution: ~42 nano degrees.
I've got a bit of KLV metadata that I'm trying to parse, but I've run into an edge case that needs handled. Basically, since my sensor isn't actually flying, it's returning dummy data. For instance, it's first value is b'\x02\x08\x00\x00\x00\x00\x00\x00\x00\x00', which is a precision timestamp corresponding to the UTC epoch. That's fine, but when the parser gets to sensor latitude, the corresponding bytes are b'\x0D\x04\x80\x00\x00\x00'. That '\x80\x00\x00\x00' becomes an integer of -2147483648, which is outside the allowed domain of (-(2**31-1), 2**31-1). Providing such an extreme value is the sensor's way of signaling that it doesn't exist, but unfortunately this raises a generic ValueError (which was really difficult to trace down, requiring me to understand the code and go through it step by step). When such a domain error is encountered, I would propose that instead of raising a ValueError, the value is reported as None.
The text was updated successfully, but these errors were encountered: