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
The current libais tries to be helpful and convert values. However, I think that's a bad idea:
Units are sometimes changed, with no way for the user to know this except to examine the source code
Special values are not preserved; they are often scaled and offsetted too.
Here's an example from the processing for the 8:1:21 message.
Table 10.2 (WMO Weather observation report from ship) has the following for Ice deposit (thickness):
BUFR 020031
0 - 126 cm (offset = 0)
Thickness = (Integer value) for Integer = 0 - 126
127 = not available = default
However the code in ais8.cpp is converting this from the native centimeters to meters:
ice_thickness = bits.ToUnsignedInt(324, 7) / 100.; // m. Network is cm,
This illustrates a general problem: by processing the values, rather than just extracting them, the resulting values no longer follow the spec. 127 is no longer the N/A value, you need to know that it was divided by 100.0, so now you need to check for 1.27.
We should consider just returning the bitfields as either a signed or unsigned integer, and let client code do the conversion. Or, in cases where we manipulate the value, we should return both an ice_thickness_raw and ice_thickness_meters field.
The text was updated successfully, but these errors were encountered:
The current libais tries to be helpful and convert values. However, I think that's a bad idea:
Here's an example from the processing for the 8:1:21 message.
Table 10.2 (WMO Weather observation report from ship) has the following for Ice deposit (thickness):
However the code in ais8.cpp is converting this from the native centimeters to meters:
This illustrates a general problem: by processing the values, rather than just extracting them, the resulting values no longer follow the spec. 127 is no longer the N/A value, you need to know that it was divided by 100.0, so now you need to check for 1.27.
We should consider just returning the bitfields as either a signed or unsigned integer, and let client code do the conversion. Or, in cases where we manipulate the value, we should return both an ice_thickness_raw and ice_thickness_meters field.
The text was updated successfully, but these errors were encountered: