Comments (1)
Okay, my suggested solution won't work, in that the values presented to a C++ client won't be correct. I didn't realize that this library was able to be used directly from C code, I thought it was only for use with Python.
Alternate suggestion:
Add checking code for special values in the bit-extraction routines, and if the value is out of range (e.g. N/A value), then if it's a float, set it to a NAN value. If it's an int value, we have a bool that we set to indicate that it's valid/invalid.
Example for 8:367:24. Pressure field is defined as follows:
Air pressure, defined as pressure reduced to sea level, in 1
hPa increments.
0 = pressure <800 hPa; 1 - 401 = 800 – 1200 hPa;
402 = pressure of 1201 hPa or greater;
403 = data unavailable = default;
404-510 = reserved; 511 = not to be used.
If int value is in 0..402, add 799 to the value, resulting in a valid pressure, and set pressure_valid to true;
else leave value alone (don't add 799) and set new instance member pressure_valid to false;
This allows C++ code to tell whether a value is valid or not (pressure_valid field), and if not they actually have the value available in case that's useful.
The Python mapping code in ais_py.cpp would check the value, and if pressure_valid is false, it would set the pressure field to Py_None. Alternatively, you could duplicate the C++ functionality and add a pressure_valid field to the Python dictionary.
from libais.
Related Issues (20)
- Cannot do "pip install libais" on Windows 10
- Getting utm coordinates instead of latitude and longitude HOT 1
- Question, what is the SECOND argument in ais.decode() HOT 6
- Memory leak 'ais.decode' method HOT 2
- AIS Weather message decode causes exception HOT 3
- Update CI testing - github actions HOT 2
- Possibly missing calls to ais8_1_26_append_pydict_sensor_hdr in ais_py.cpp
- Status not set when processing 367_22 in ais8_to_pydict in ais_py.cpp.
- Exception tag_block parsing bad message if no line_number passed in
- HandlsAds/TimeUTC doesn't handle missing fields
- Ice Thickness units changed from centimeters to meters
- "currents" list attached in wrong place
- air_pressor_type is an odd name
- cppcheck is seeing issues
- KeyError: 'decoded' in DecodeTagMultiple HOT 1
- Timestamp not decoded ("\\c:1628097600") HOT 1
- Message not decoded using tag_block queue, but does decode when calling ais.decode directly
- AttributeError: 'NoneType' object has no attribute 'upper' when parsing using tag_block
- Minor version differs between Python and C++
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libais.