这是indexloc提供的服务,不要输入任何密码
Skip to content

Ice Thickness units changed from centimeters to meters #228

@andyvan-trabus

Description

@andyvan-trabus

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions