Nonlinear conversion between the Beaufort wind force scale and meters per second.
TR35 names this conversion special and does not define it: "The only
special conversion currently supported is for beaufort". It is done
here by interpolating between the midpoints of the WMO-defined speed
thresholds for each Beaufort number, as ICU does it, which gives the
value CLDR's unit test data has.
Registered as a :special custom unit so that the generic
conversion pipeline dispatches through forward/1 and inverse/1
rather than using factor-based arithmetic.
Summary
Functions
Converts a Beaufort scale value to meters per second.
Converts meters per second to a Beaufort scale value.
Functions
Converts a Beaufort scale value to meters per second.
Values are clamped to the range [0, 17]. Fractional Beaufort numbers are interpolated between adjacent midpoints.
Arguments
beaufortis a Beaufort scale number.
Returns
- The speed in meters per second, as a float.
Examples
iex> Localize.Unit.Conversion.Beaufort.forward(0)
0.15
iex> Localize.Unit.Conversion.Beaufort.forward(5)
9.4
Converts meters per second to a Beaufort scale value.
Finds the Beaufort band whose midpoint range contains the given
speed and interpolates within it. Negative speeds return 0.0.
Arguments
mpsis a speed in meters per second.
Returns
- The Beaufort scale value, as a float.
Examples
iex> Localize.Unit.Conversion.Beaufort.inverse(9.4)
5.0
iex> Localize.Unit.Conversion.Beaufort.inverse(-3)
0.0