Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ice Thickness units changed from centimeters to meters #228

Open
andyvan-trabus opened this issue Sep 9, 2021 · 0 comments
Open

Ice Thickness units changed from centimeters to meters #228

andyvan-trabus opened this issue Sep 9, 2021 · 0 comments

Comments

@andyvan-trabus
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant