pycontrails.physics.units¶
Unit conversion support.
Functions
|
Convert from degrees to radians. |
|
Convert a time delta to seconds as a float with specified |
|
Convert length from feet to meter. |
|
Convert from altitude (ft) to pressure level (hPa). |
|
Convert temperature from Kelvin to Celsius. |
|
Convert speed from knots to meters per second (m/s). |
|
Convert latitude degrees distance between two points to cartesian distances in meters. |
|
Convert mass from pounds (lbs) to kilograms (kg). |
|
Convert longitude degrees distance between two points to cartesian distances in meters. |
|
Convert speed from meters per second (m/s) to knots. |
|
Calculate the ambient temperature (K) for a given altitude (m). |
|
Convert length from meters to feet. |
|
Convert cartesian distance (meters) to differences in latitude degrees. |
|
Convert cartesian distance (meters) to differences in longitude degrees. |
|
Convert from altitude (m) to pressure level (hPa). |
|
Calculate true airspeed from the Mach number at a specified ambient temperature. |
|
Convert from pressure level (hPa) to altitude (ft). |
|
Convert from pressure level (hPa) to altitude (m). |
|
Convert from radians to degrees. |
|
Calculate Mach number from true airspeed at a specified ambient temperature. |
- pycontrails.physics.units.degrees_to_radians(degrees)¶
Convert from degrees to radians.
- Parameters:
degrees (
ArrayScalarLike
) – Degrees values, [\(\deg\)]- Returns:
ArrayScalarLike
– Radians values
- pycontrails.physics.units.dt_to_seconds(dt, dtype=<class 'numpy.float64'>)¶
Convert a time delta to seconds as a float with specified
dtype
precision.- Parameters:
dt (
numpy.ndarray
) – Time delta for each waypointdtype (
np.dtype
) – Data type of the output array
- Returns:
numpy.ndarray
– Time delta in seconds as a float
- pycontrails.physics.units.ft_to_m(ft)¶
Convert length from feet to meter.
- Parameters:
ft (
ArrayScalarLike
) – length, [\(ft\)]- Returns:
ArrayScalarLike
– length, [\(m\)]
- pycontrails.physics.units.ft_to_pl(h)¶
Convert from altitude (ft) to pressure level (hPa).
Assumes the ICAO standard atmosphere.
- Parameters:
h (
ArrayScalarLike
) – altitude, [\(ft\)]- Returns:
ArrayScalarLike
– pressure level, [\(hPa\)], [\(mbar\)]
See also
- pycontrails.physics.units.kelvin_to_celsius(kelvin)¶
Convert temperature from Kelvin to Celsius.
- Parameters:
kelvin (
ArrayScalarLike
) – temperature [\(K\)]- Returns:
ArrayScalarLike
– temperature [\(C\)]
- pycontrails.physics.units.knots_to_m_per_s(knots)¶
Convert speed from knots to meters per second (m/s).
- Parameters:
knots (
ArrayScalarLike
) – Speed, [\(knots\)]- Returns:
ArrayScalarLike
– Speed, [\(m \ s^{-1}\)]
- pycontrails.physics.units.latitude_distance_to_m(distance_degrees)¶
Convert latitude degrees distance between two points to cartesian distances in meters.
- Parameters:
distance_degrees (
ArrayScalarLike
) – latitude distance, [\(\deg\)]- Returns:
ArrayScalarLike
– Cartesian distance along the latitude axis, [\(m\)]
- pycontrails.physics.units.lbs_to_kg(lbs)¶
Convert mass from pounds (lbs) to kilograms (kg).
- Parameters:
lbs (
ArrayScalarLike
) – mass, pounds [\(lbs\)]- Returns:
ArrayScalarLike
– mass, kilograms [\(kg\)]
- pycontrails.physics.units.longitude_distance_to_m(distance_degrees, latitude_mean)¶
Convert longitude degrees distance between two points to cartesian distances in meters.
- Parameters:
distance_degrees (
ArrayScalarLike
) – longitude distance, [\(\deg\)]latitude_mean (
ArrayScalarLike
, optional) – mean latitude betweenlongitude_1
andlongitude_2
, [\(\deg\)]
- Returns:
ArrayScalarLike
– cartesian distance along the longitude axis, [\(m\)]
- pycontrails.physics.units.m_per_s_to_knots(m_per_s)¶
Convert speed from meters per second (m/s) to knots.
- Parameters:
m_per_s (
ArrayScalarLike
) – Speed, [\(m \ s^{-1}\)]- Returns:
ArrayScalarLike
– Speed, [\(knots\)]
- pycontrails.physics.units.m_to_T_isa(h)¶
Calculate the ambient temperature (K) for a given altitude (m).
Assumes the ICAO standard atmosphere.
- Parameters:
h (
ArrayScalarLike
) – altitude, [\(m\)]- Returns:
ArrayScalarLike
– ICAO standard atmosphere ambient temperature, [\(K\)]
References
Notes
See https://en.wikipedia.org/wiki/International_Standard_Atmosphere
- pycontrails.physics.units.m_to_ft(m)¶
Convert length from meters to feet.
- Parameters:
m (
ArrayScalarLike
) – length, [\(m\)]- Returns:
ArrayScalarLike
– length, [\(ft\)]
- pycontrails.physics.units.m_to_latitude_distance(distance_m)¶
Convert cartesian distance (meters) to differences in latitude degrees.
Small angle approximation for
distance_m
<<constants.radius_earth
- Parameters:
distance_m (
ArrayScalarLike
) – cartesian distance along latitude axis, [\(m\)]- Returns:
ArrayScalarLike
– latitude distance, [\(\deg\)]
- pycontrails.physics.units.m_to_longitude_distance(distance_m, latitude_mean)¶
Convert cartesian distance (meters) to differences in longitude degrees.
Small angle approximation for
distance_m
<<constants.radius_earth
- Parameters:
distance_m (
ArrayScalarLike
) – cartesian distance along longitude axis, [\(m\)]latitude_mean (
ArrayScalarLike
) – mean latitude betweenlongitude_1
andlongitude_2
, [\(\deg\)]
- Returns:
ArrayScalarLike
– longitude distance, [\(\deg\)]
- pycontrails.physics.units.m_to_pl(h)¶
Convert from altitude (m) to pressure level (hPa).
- Parameters:
h (
npt.NDArray[np.float64]
) – altitude, [\(m\)]- Returns:
npt.NDArray[np.float64]
– pressure level, [\(hPa\)], [\(mbar\)]
References
Notes
See https://en.wikipedia.org/wiki/Barometric_formula
See also
- pycontrails.physics.units.mach_number_to_tas(mach_number, T)¶
Calculate true airspeed from the Mach number at a specified ambient temperature.
- Parameters:
mach_number (
float | npt.NDArray[np.float64]
) – Mach number, [:math: Ma]T (
npt.NDArray[np.float64]
) – Ambient temperature, [\(K\)]
- Returns:
npt.NDArray[np.float64]
– True airspeed, [\(m \ s^{-1}\)]
References
- pycontrails.physics.units.pl_to_ft(pl)¶
Convert from pressure level (hPa) to altitude (ft).
Assumes the ICAO standard atmosphere.
- Parameters:
pl (
ArrayScalarLike
) – pressure level, [\(hPa\)], [\(mbar\)]- Returns:
ArrayScalarLike
– altitude, [\(ft\)]
See also
- pycontrails.physics.units.pl_to_m(pl)¶
Convert from pressure level (hPa) to altitude (m).
Function is slightly different from the classical formula:
constants.T_msl / 0.0065) * (1 - (pl_pa / constants.p_surface) ** (1 / 5.255)
in order to provide a mathematical inverse tom_to_pl()
.For low altitudes (below the tropopause), this implementation closely agrees to classical formula.
- Parameters:
pl (
ArrayLike
) – pressure level, [\(hPa\)], [\(mbar\)]- Returns:
ArrayLike
– altitude, [\(m\)]
References
Notes
See https://en.wikipedia.org/wiki/Barometric_formula
See also
- pycontrails.physics.units.radians_to_degrees(radians)¶
Convert from radians to degrees.
- Parameters:
radians (
ArrayScalarLike
) – degrees values, [\(\rad\)]- Returns:
ArrayScalarLike
– Radian values
- pycontrails.physics.units.tas_to_mach_number(true_airspeed, T)¶
Calculate Mach number from true airspeed at a specified ambient temperature.
- Parameters:
true_airspeed (
ArrayScalarLike
) – True airspeed, [\(m \ s^{-1}\)]T (
ArrayScalarLike
) – Ambient temperature, [\(K\)]
- Returns:
ArrayScalarLike
– Mach number, [:math: Ma]
References