improver.standard_geopotential_height.standard_geopotential_height module#

Module containing plugin to calculate standard geopotential height on pressure levels.

class StandardGeopotentialHeight(model_id_attr=None, pressure_min_hpa=10.0, pressure_max_hpa=1000.0)[source]#

Bases: PostProcessingPlugin

Calculate standard geopotential height on the pressure levels of an input cube.

The input cube is used as a template. The output values depend only on the pressure coordinate points and are broadcast across the remaining dimensions.

Any pressure levels outside the configured range (default 10–1000 hPa) are excluded from the output cube (i.e. the pressure dimension is reduced).

Standard Geopotential Height Calculation

The standard geopotential height calculation is based on the International Civil Aviation Organisation (ICAO) Standard Atmosphere definitions, which vary depending on the layer of the atmosphere.

The standard atmosphere definition can be taken from a look up table, whereby the standard constants for a layer are dependent on the pressure level of interest (e.g. 500 hPa).

Layer

Vertical temperature gradient, β [K m⁻¹]

Geopotential height at base Zb [m]

Temperature at base Tb [K]

Pressure at base, Pb [hPa]

Troposphere

-0.0065

0

288.15

1013.25

Stratosphere

0.0000

11,000

216.65

226.32

Mesosphere

0.0010

20,000

216.65

54.75

Thermosphere

0.0028

32,000

228.65

8.68

The formulae based on the table above are:

If \(\beta = 0\):

\[Z_{\mathrm{std}}(p) = Z_b - \frac{R T_b}{g} \ln\left(\frac{p}{p_b}\right)\]

If \(\beta \ne 0\):

\[Z_{\mathrm{std}}(p) = Z_b + \frac{T_b}{\beta} \left[ \left(\frac{p}{p_b}\right)^{-\frac{\beta R}{g}} - 1 \right]\]

where:

\(\beta\) is the vertical temperature gradient (Km⁻¹)

\(Z_b\) is the geopotential height at base (m)

\(T_b\) is the temperature at base (T)

\(p_b\) is the pressure at base (hPa)

\(p\) is the input pressure (hPa)

\(R\) is the universal gas constant (287.0 Jkg⁻¹K⁻¹)

\(g\) is the standard gravitational acceleration (9.81 ms⁻²)

__init__(model_id_attr=None, pressure_min_hpa=10.0, pressure_max_hpa=1000.0)[source]#

Initialise the class :type model_id_attr: Optional[str] :param model_id_attr: Name of the attribute used to identify the source model. If provided,

mandatory attributes will be generated consistently.

Parameters:
  • pressure_min_hpa (float) – Minimum pressure processed (hPa). Defaults to 10 hPa.

  • pressure_max_hpa (float) – Maximum pressure processed (hPa). Defaults to 1000 hPa.

_abc_impl = <_abc._abc_data object>#
static _add_masking_by_pressure(geopotential_height_cube, p_hpa_min, p_hpa_max)[source]#

Add masking by pressure levels, any existing masking is preserved

Parameters:
  • geopotential_height_cube (Cube) – cube to be masked

  • p_hpa_min (float) – miniumum valid pressure for D-factors computation

  • p_hpa_max (float) – maximum valid pressure for D-factors computation

Return type:

Cube

Returns:

masked cube (same as input cube)

static _broadcast_to_template(z_1d, template, pressure_coord)[source]#

Broadcast 1D values along the pressure dimension to match template shape. :type z_1d: ndarray :param z_1d: 1D array of values to broadcast :type template: Cube :param template: template cube :type pressure_coord: Coord :param pressure_coord: pressure coordinates

Return type:

ndarray

Returns:

broadcast 1D array of values

static _get_pressure_coord(cube)[source]#

Return the pressure coordinate from the cube.

Raises:

ValueError – If a suitable pressure coordinate is not found.

Return type:

Coord

static _layer_params_for_pressure(p_hpa)[source]#

Return arrays of Pb, Zb, Tb, beta corresponding to each pressure level.

Return type:

Tuple[ndarray, ndarray, ndarray, ndarray]

Layer selection follows D-Factors design conditional logic:

p <= 8.68 -> thermosphere p <= 54.75 -> mesosphere p <= 226.32 -> stratosphere else -> troposphere

Args:

p_hpa: array of input pressure levels

Returns:

pb, Zb, Tb, beta corresponding to each pressure level

static _standard_geopotential_height_1d(p_hpa)[source]#

Compute 1D standard geopotential height (m) for pressure levels (hPa). :type p_hpa: ndarray :param p_hpa: array of pressure levels (hPa)

Return type:

ndarray

Returns:

corresponding array of standard geopotential height (m)

static _to_hpa(pressure_coord)[source]#

Return a copy of the pressure coordinate points converted to hPa.

Return type:

ndarray

process(geopotential_height_cube)[source]#

Create standard geopotential height cube using a pressure-filtered template.

Pressure levels within the configured expected range are included in the output cube. Out-of-range pressure levels are masked out.

Args:

geopotential_height_cube: cube filled with geopotential heights

Returns:

standard geopotential height cube: cube filled with standard geopotential heights

Return type:

Cube

class _LayerParams(pb_hpa, zb_m, tb_k, beta_k_m)[source]#

Bases: object

ICAO Standard Atmosphere layer parameters.

Pressures in hPa; temperatures in K; heights in m; beta in K m-1.

beta_k_m: float#
pb_hpa: float#
tb_k: float#
zb_m: float#