Units¶
- convert_distance(distance, from_unit, to_unit)[source]¶
Convert distance between specified units.
- Parameters:
- Returns:
Distance converted to the target unit.
- Return type:
- altitude_to_flight_level(altitude, pressure=1013.25)[source]¶
Converts altitude to flight level (FL), considering atmospheric pressure.
- Parameters:
altitude (float or pint.Quantity) – Altitude to convert. If a float, it is assumed to be in meters.
pressure (float or pint.Quantity) – Atmospheric pressure. If a float, it is assumed to be in hPa.
- Returns:
Flight level (FL) as a string (e.g., “FL030”, “FL350”).
- Return type:
- Raises:
ValueError – If altitude is not a float or a pint length.
ValueError – If pressure is not a float or a pint pressure unit.