earthkit.meteo.vertical.array.pressure_on_hybrid_levels¶
- earthkit.meteo.vertical.array.pressure_on_hybrid_levels(sp, A, B, levels=None, alpha_top='ifs', output='full', vertical_dim=0)¶
Compute pressure and related parameters on hybrid (IFS model) levels.
This function replaces the deprecated
pressure_at_model_levels().- Parameters:
sp (
ArrayLike) – Surface pressure (Pa).A (
ArrayLike) – A-coefficients defining the hybrid levels. Must contain all the half-levels in ascending order with respect to the model level number (from the top of the atmosphere toward the surface). If the total number of (full) model levels is \(NLEV\),Amust contain \(NLEV+1\) values, one for each half-level. See [IFS-CY49R1-Dynamics] Chapter 2, Section 2.2.1. for details.B (
ArrayLike) – B-coefficients defining the hybrid levels. Must contain all the half-levels in ascending order with respect to the model level number. Must have the same size and ordering asA. See [IFS-CY49R1-Dynamics] Chapter 2, Section 2.2.1. for details.levels (
ArrayLike | None) – Specify the hybrid full-levels to return. Must be contiguous range of levels in either ascending or descending order. Following the IFS convention model level numbering starts at 1 at the top of the atmosphere and increasing toward the surface. If None (default), all the levels are returned in the order defined by the A and B coefficients (i.e. ascending order with respect to the model level number). If only half-levels are requested inoutputthelevelsare interpreted as half-level numbers (so 0 is a valid half-level number corresponding to the top of the atmosphere).alpha_top (
{"ifs", "arpege"}) –Option to initialise the alpha parameters (for details see below) on the top of the model atmosphere (first half-level in the vertical coordinate system). The possible values are:
”ifs”: alpha is set to log(2). See [IFS-CY49R1-Dynamics] Chapter 2, Section 2.2.1. for details.
”arpege”: alpha is set to 1.0
output (
{"full", "half", "delta", "alpha", "level"}| list | tuple) –Specify which outputs to return. Possible values are “full”, “half”, “delta”, “alpha” and “level”. Can be a single string or a list/tuple of strings. Default is “full”. The outputs are:
”full”: pressure (Pa) on full-levels
”half”: pressure (Pa) on half-levels. When
levelsis None, returns all the half-levels. Whenlevelsis not None, returns all the half-levels enveloping the requested full-levels. Ifoutputonly includes “half”, (bar “levels”) thelevelsare interpreted as half-level numbers.”delta”: logarithm of pressure difference between two adjacent half-levels. Uses the same indexing as the full-levels.
”alpha”: alpha parameter defined for layers (i.e. for full-levels). Uses the same indexing as the full-levels. Used for the calculation of the relative geopotential thickness on full-levels. See
relative_geopotential_thickness_on_hybrid_levels()for details.”level”: dict with full and half level numbers related to the returned data. The keys are “full” and “half”. The values are the corresponding level numbers. Cannot be used on its own, must be used together with at least one of the other output types. Both keys are always present, even if no data on full or half levels are returned.
vertical_dim (
int) – Axis corresponding to the vertical coordinate (hybrid levels) in the output arrays. Default is 0 (first axis).
- Returns:
Pressure and/or related parameters on hybrid levels. When a single
outputtype is requested, a single array is returned. When multipleoutputtypes are requested, a tuple of arrays is returned, one for each requested output type, in the same order as specified in the input. See theoutputparameter for details. The axis corresponding to the vertical coordinate (hybrid levels) in the output arrays is defined by thevertical_dimparameter. Whenoutputincludes “level”, a dict with the returned full and half levels numbers is also returned in the output tuple.- Return type:
ArrayLike|tuple[ArrayLike,]
Notes
The hybrid model levels divide the atmosphere into \(NLEV\) layers. These layers are defined by the pressures at the interfaces between them for \(0 \leq k \leq NLEV\), which are the half-levels \(p_{k+1/2}\) (indices increase from the top of the atmosphere towards the surface). The half-levels are defined by the
AandBcoefficients in such a way that at the top of the atmosphere the first half-level pressure \(p_{0+1/2}\) is a constant, while at the surface \(p_{NLEV+1/2}\) is the surface pressure.The full-level pressure \(p_{k}\) associated with each model level is defined as the middle of the layer for \(1 \leq k \leq NLEV\).
The level definitions can be written as:
\[ \begin{align}\begin{aligned}p_{k+1/2} = A_{k+1/2} + p_{s} B_{k+1/2} \quad k=0, 1, ..., NLEV\\p_{k} = \frac{1}{2} (p_{k-1/2} + p_{k+1/2}) \quad k=1, 2, ..., NLEV\end{aligned}\end{align} \]where
\(p_{s}\) is the surface pressure
\(p_{k+1/2}\) is the pressure at the half-levelss
\(p_{k}\) is the pressure at the full-levels
\(A_{k+1/2}\) and \(B_{k+1/2}\) are the A- and B-coefficients defining the model levels.
For more details see [IFS-CY49R3-Dynamics] Chapter 2, Section 2.2.1.
Examples
/how-tos/hybrid_levels.ipynb