Thermodynamic Calculations¶
-
metpy.calc.thermo.
potential_temperature
(pressure, temperature)¶ Calculate the potential temperature.
Uses the Poisson equation to calculation the potential temperature given pressure and temperature.
Parameters: - pressure (array_like) – The total atmospheric pressure
- temperature (array_like) – The temperature
Returns: array_like – The potential temperature corresponding to the the temperature and pressure.
See also
Notes
Formula:
\[\Theta = T (P_0 / P)^\kappa\]Examples
>>> from metpy.units import units >>> metpy.calc.potential_temperature(800. * units.mbar, 273. * units.kelvin) 290.9814150577374
-
metpy.calc.thermo.
dry_lapse
(pressure, temperature)¶ Calculate the temperature at a level assuming only dry processes operating from the starting point.
This function lifts a parcel starting at temperature, conserving potential temperature. The starting pressure should be the first item in the pressure array.
Parameters: - pressure (array_like) – The atmospheric pressure level(s) of interest
- temperature (array_like) – The starting temperature
Returns: array_like – The resulting parcel temperature at levels given by pressure
See also
moist_lapse()
- Calculate parcel temperature assuming liquid saturation processes
parcel_profile()
- Calculate complete parcel profile
-
metpy.calc.thermo.
moist_lapse
(pressure, temperature)¶ Calculate the temperature at a level assuming liquid saturation processes operating from the starting point.
This function lifts a parcel starting at temperature. The starting pressure should be the first item in the pressure array. Essentially, this function is calculating moist pseudo-adiabats.
Parameters: - pressure (array_like) – The atmospheric pressure level(s) of interest
- temperature (array_like) – The starting temperature
Returns: array_like – The temperature corresponding to the the starting temperature and pressure levels.
See also
dry_lapse()
- Calculate parcel temperature assuming dry adiabatic processes
parcel_profile()
- Calculate complete parcel profile
Notes
This function is implemented by integrating the following differential equation:
\[\frac{dT}{dP} = \frac{1}{P} \frac{R_d T + L_v r_s} {C_{pd} + \frac{L_v^2 r_s \epsilon}{R_d T^2}}\]This equation comes from [1].
References
[1] Bakhshaii, A. and R. Stull, 2013: Saturated Pseudoadiabats–A Noniterative Approximation. J. Appl. Meteor. Clim., 52, 5-15.
-
metpy.calc.thermo.
lcl
(pressure, temperature, dewpt, max_iters=50, eps=0.01)¶ Calculate the lifted condensation level (LCL) using from the starting point.
The starting state for the parcel is defined by temperature, dewpoint, and pressure.
Parameters: - pressure (array_like) – The starting atmospheric pressure
- temperature (array_like) – The starting temperature
- dewpt (array_like) – The starting dew point
Returns: array_like – The LCL
Other Parameters: - max_iters (int, optional) – The maximum number of iterations to use in calculation, defaults to 50.
- eps (float, optional) – The desired absolute error in the calculated value, defaults to 1e-2.
See also
Notes
This function is implemented using an iterative approach to solve for the LCL. The basic algorithm is: 1. Find the dew point from the LCL pressure and starting mixing ratio 2. Find the LCL pressure from the starting temperature and dewpoint 3. Iterate until convergence
The function is guaranteed to finish by virtue of the maxIters counter.
-
metpy.calc.thermo.
parcel_profile
(pressure, temperature, dewpt)¶ Calculate the profile a parcel takes through the atmosphere, lifting from the starting point.
The parcel starts at temperature, and dewpt, lifted up dry adiabatically to the LCL, and then moist adiabatically from there. pressure specifies the pressure levels for the profile.
Parameters: - pressure (array_like) – The atmospheric pressure level(s) of interest. The first entry should be the starting point pressure.
- temperature (array_like) – The starting temperature
- dewpt (array_like) – The starting dew point
Returns: array_like – The parcel temperatures at the specified pressure levels.
See also
-
metpy.calc.thermo.
vapor_pressure
(pressure, mixing)¶ Calculate water vapor (partial) pressure
Given total pressure and water vapor mixing ratio, calculates the partial pressure of water vapor.
Parameters: - pressure (array_like) – total atmospheric pressure
- mixing (array_like) – dimensionless mass mixing ratio
Returns: array_like – The ambient water vapor (partial) pressure in the same units as pressure.
See also
-
metpy.calc.thermo.
saturation_vapor_pressure
(temperature)¶ Calculate the saturation water vapor (partial) pressure
Parameters: temperature (array_like) – The temperature Returns: array_like – The saturation water vapor (partial) pressure See also
Notes
Instead of temperature, dewpoint may be used in order to calculate the actual (ambient) water vapor (partial) pressure.
The formula used is that from Bolton 1980 [2] for T in degrees Celsius:
\[6.112 e^\frac{17.67T}{T + 243.5}\]References
[2] Bolton, D., 1980: The Computation of Equivalent Potential Temperature. Mon. Wea. Rev., 108, 1046-1053.
-
metpy.calc.thermo.
dewpoint_rh
(temperature, rh)¶ Calculate the ambient dewpoint given air temperature and relative humidity.
Parameters: - temperature (array_like) – Air temperature
- rh (array_like) – Relative humidity expressed as a ratio in the range [0, 1]
Returns: array_like – The dew point temperature
See also
-
metpy.calc.thermo.
dewpoint
(e)¶ Calculate the ambient dewpoint given the vapor pressure.
Parameters: e (array_like) – Water vapor partial pressure Returns: array_like – Dew point temperature Notes
This function inverts the Bolton 1980 [3] formula for saturation vapor pressure to instead calculate the temperature. This yield the following formula for dewpoint in degrees Celsius:
\[T = \frac{243.5 log(e / 6.112)}{17.67 - log(e / 6.112)}\]References
[3] Bolton, D., 1980: The Computation of Equivalent Potential Temperature. Mon. Wea. Rev., 108, 1046-1053.
-
metpy.calc.thermo.
mixing_ratio
(part_press, tot_press)¶ Calculates the mixing ratio of gas given its partial pressure and the total pressure of the air.
There are no required units for the input arrays, other than that they have the same units.
Parameters: - part_press (array_like) – Partial pressure of the constituent gas
- tot_press (array_like) – Total air pressure
Returns: array_like – The (mass) mixing ratio, dimensionless (e.g. Kg/Kg or g/g)
See also