improver.psychrometric_calculations.condensation_trails module#
Module to contain Condensation trail formation calculations.
- class CondensationTrailFormation(engine_contrail_factors=[3e-05, 3.4e-05, 3.9e-05])[source]#
Bases:
BasePluginPlugin to calculate whether a condensation trail (contrail) will form based on a given set of atmospheric conditions.
The calculations require the following data:
Temperature on pressure levels.
Relative Humidity on pressure levels.
Alongside constants including the ratio of the molecular masses of water and air (EARTH_REPSILON), and defined values for the engine contrail factor.
The range of atmospheric conditions under which condensation trails may form are summarised by an Appleman diagram:
References
Schrader, M.L., 1997. Calculations of aircraft contrail formation critical temperatures. Journal of Applied Meteorology, 36(12), pp.1725-1729.
- __init__(engine_contrail_factors=[3e-05, 3.4e-05, 3.9e-05])[source]#
Initialises the Class
- Parameters:
engine_contrail_factors (list, optional) – List of engine contrail factors to use in the calculations. Defaults to [3e-5, 3.4e-5, 3.9e-5]. These values are for Non-, Low-, and High-Bypass engines from Schrader (1997). The units are kg/kg/K.
- _abc_impl = <_abc._abc_data object>#
- _boolean_to_categorical()[source]#
Combine two boolean arrays of contrail persistency into a single categorical array of contrail formation.
- Return type:
- Returns:
Array of categorical (integer) data, where 0 = no contrails, 1 = non-persistent contrails and 2 = persistent contrails.
- _calculate_contrail_persistency()[source]#
Apply four conditions to determine whether non-persistent or persistent contrails will form.
Condition 1
The local vapour pressure sits above the tangent to the saturated vapour pressure curve,
\[C_1 = e_{local} - mT > I_{critical} \ \ \text{,}\]where \(e_{local}\) is the local vapour pressure, \(m\) is the engine mixing ratio, \(T\) is the ambient air temperature, and \(I_{critical}\) is the critical intercept.
Condition 2
The air temperature is below the critical temperature,
\[C_2 = T < T_{critical} \ \ \text{.}\]Condition 3
The local vapour pressure is higher than the atmospheric saturated vapour pressure (with respect to ice),
\[C_3 = e_{local} > e_{s,ice}(T, P) \ \ \text{.}\]Condition 4
The air temperature is below the freezing point of water,
\[C_4 = T < 273.15 \ \text{K} \ \ \text{.}\]Will contrails form?
\[\begin{split}\begin{aligned} \text{Any} &= C_1 \land C_2 \\ \text{Persistent} &= \text{Any} \land C_3 \land C_4 \\ \text{Non-persistent} &= \text{Any} \land \lnot \ \text{Persistent} \ \ \text{.} \end{aligned}\end{split}\]- Return type:
- _calculate_critical_temperatures_and_intercepts()[source]#
Calculate the critical temperatures and intercepts on pressure levels for all engine contrail factors.
- Return type:
- _calculate_engine_mixing_ratios(pressure_levels)[source]#
Calculate the mixing ratio of the atmosphere and aircraft exhaust (Schrader, 1997). This calculation uses EARTH_REPSILON, which is the ratio of the molecular weights of water and air on Earth.
- Returns:
The mixing ratio of the atmosphere and aircraft exhaust, provided in units: Pa/K.
- Return type:
np.ndarray
- _create_contrail_formation_cube(categorical_data, template_cube)[source]#
Create a contrail formation cube, populated with categorical data.
- Parameters:
- Return type:
- Returns:
Categorical cube of contrail formation, where 0 = no contrails, 1 = non-persistent contrails and 2 = persistent contrails. Has the same shape as categorical_data.
- _critical_temperatures_and_intercepts_for_given_contrail_factor(engine_mixing_ratio_for_contrail_factor, svp_table, svp_derivative_table)[source]#
Calculate the critical temperatures and critical intercepts on pressure levels for a single engine contrail factor.
These are calculated at each pressure level by drawing a tangent to the saturation vapour pressure curve with respect to water. The tangent gradient is equal to the engine mixing ratio.
The variation of critical temperature with relative humidity has a characteristic curve:
- Parameters:
engine_mixing_ratio_for_contrail_factor (np.ndarray) – Engine mixing ratios on pressure levels for a single contrail factor. Array axis is [pressure levels] (Pa/K).
svp_table (iris.cube.Cube) – Lookup table of saturation vapour pressure with respect to water (Pa).
svp_derivative_table (iris.cube.Cube) – Lookup table of the first derivative of saturation vapour pressure with respect to water (Pa/K).
- Returns:
Critical temperatures on pressure levels. Array axes are [pressure levels, latitude, longitude] (K).
Critical intercepts on pressure levels. Array axis is [pressure levels] (Pa).
- Return type:
Tuple[np.ndarray, np.ndarray]
- _find_local_vapour_pressure(pressure_levels)[source]#
Calculate the local vapour pressure with respect to water at the given pressure levels using the temperature and pressure data.
- Parameters:
pressure_levels (np.ndarray) – Pressure levels (Pa).
- Returns:
The localised vapour pressure at the given pressure levels (Pa).
- Return type:
np.ndarray
- critical_intercepts = None#
- critical_temperatures = None#
- engine_mixing_ratios = None#
- humidity = None#
- nonpersistent_contrails = None#
- persistent_contrails = None#
- pressure_levels = None#
- process(*cubes)[source]#
Main entry point of this class for data as iris.Cubes
- Parameters:
cubes (
Union[Cube,CubeList]) –- air_temperature:
Cube of the temperature on pressure levels.
- relative_humidity:
Cube of the relative humidity on pressure levels.
- Return type:
- Returns:
Categorical (integer) cube of contrail formation
0 = no contrails
1 = non-persistent contrails
2 = persistent contrails
Cube dimensions are [contrail factor, pressure level, latitude, longitude], where latitude and longitude are only included if present in the input cubes.
- process_from_arrays(temperature, relative_humidity, pressure_levels)[source]#
Main entry point of this class for data as Numpy arrays.
Process the temperature, humidity and pressure data to calculate the contrails data.
- Parameters:
temperature (np.ndarray) – Temperature data on pressure levels where pressure is the leading axis (K).
relative_humidity (np.ndarray) – Relative humidity data on pressure levels where pressure is the leading axis (kg/kg).
pressure_levels (np.ndarray) – Pressure levels (Pa).
- Return type:
- Returns:
Categorical (integer) array of contrail formation
0 = no contrails
1 = non-persistent contrails
2 = persistent contrails
Array axes are [contrail factor, pressure level, latitude, longitude], where latitude and longitude are only included if present in the temperature and relative humidity input arrays.
- temperature = None#
- class ContrailHeightExtractor(use_max=True)[source]#
Bases:
BasePluginPlugin to extract contrail formation heights by category. It extracts the maximum or minimum height where contrail formation is Non-persistent or Persistent.
- __init__(use_max=True)[source]#
Initialize the Class
- Parameters:
use_max (
bool) – If True, extract maximum heights; if False, extract minimum heights.
- _abc_impl = <_abc._abc_data object>#
- _contrail_values_from_meaning_attribute(formation_cube)[source]#
Extract the integer values corresponding to non-persistent or persistent contrails from the ‘contrail_type_meaning’ attribute of the categorical contrail formation cube.
- _create_max_min_height_cubes(formation_cube, height_cube, non_persistent_result, persistent_result)[source]#
Create new cubes containing the max or min heights for persistent or non-persistent contrail formation.
- Parameters:
formation_cube (
Cube) – Categorical cube of shape (contrail_factor, pressure_level, lat (optional), lon (optional))height_cube (
Cube) – Height cube of shape (pressure_level, lat (optional), lon (optional))non_persistent_result (
ndarray) – Extracted height data for non-persistent contrails.persistent_result (
ndarray) – Extracted height data for persistent contrails.
- Return type:
- Returns:
Cube of extracted heights for non-persistent contrails
Cube of extracted heights for persistent contrails
- process(formation_cube, height_cube)[source]#
Main entry point for this class to extract the maximum or minimum height where contrail formation is categorized as Non-persistent or Persistent.
- Parameters:
- Return type:
- Returns:
Cube of extracted height values for non-persistent contrails
Cube of extracted height values for persistent contrails
Each cube has dimensions (engine_contrail_factor, lat (optional), lon (optional)).
- process_from_arrays(contrail_formation, height, non_persistent_value=1, persistent_value=2)[source]#
Main entry point of this class for data as Numpy arrays.
Extract the maximum or minimum height where contrail formation is categorized as Non-persistent or Persistent.
- Parameters:
contrail_formation (
ndarray) – Integer array of contrail category with shape (engine_contrail_factor, pressure_level, lat (optional), lon (optional)).height (
ndarray) – Float array of height above sea level with shape (pressure_level, lat (optional), lon (optional)) (m).non_persistent_value (
int) – Integer corresponding to non-persistent contrail data.persistent_value (
int) – Integer corresponding to the persistent contrail data.
- Return type:
- Returns:
Array of extracted height values for non-persistent contrails
Array of extracted height values for persistent contrails
Array dimensions are (engine_contrail_factor, lat (optional), lon (optional)).