Giter Site home page Giter Site logo

Comments (1)

andyvan-trabus avatar andyvan-trabus commented on August 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.