Deprecations

Version 1.0.0rc0

pressure_at_model_levels() is deprecated

It is replaced by the more generic pressure_on_hybrid_levels(). The old method is still available for backward compatibility but will be removed in a future release.

Deprecated code

import numpy as np

import earthkit.meteo.vertical.array as vertical

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

p_full, p_half, delta, alpha = vertical.pressure_at_model_levels(A, B, sp, alpha_top="ifs")

New code

import numpy as np

import earthkit.meteo.vertical as vertical

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

p_full, p_half, delta, alpha = vertical.pressure_on_hybrid_levels(
    sp, A=A, B=B, alpha_top="ifs", output=["full", "half", "delta", "alpha"]
)

relative_geopotential_thickness() is deprecated

It is replaced by the more generic relative_geopotential_thickness_on_hybrid_levels(). The old method is still available for backward compatibility but will be removed in a future release.

Deprecated code

import numpy as np

import earthkit.meteo.vertical.array as vertical
from earthkit.meteo.utils.sample import get_sample

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

# compute alpha and delta
_, _, delta, alpha = vertical.pressure_at_model_levels(A, B, sp, alpha_top="ifs")

# get temperature and specific humidity profiles on hybrid levels (example data)
DATA = get_sample("vertical_hybrid_data")
t = DATA.t
q = DATA.q

# compute the relative geopotential thickness
z_thickness = vertical.relative_geopotential_thickness(alpha, delta, t, q)

New code

import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.sample import get_sample

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

# get temperature and specific humidity profiles on hybrid levels (example data)
DATA = get_sample("vertical_hybrid_data")
t = DATA.t
q = DATA.q


# compute the relative geopotential thickness
z_thickness = vertical.relative_geopotential_thickness_on_hybrid_levels(t, q, sp, A, B, alpha_top="ifs")

pressure_at_height_levels() is deprecated

It is replaced by the combined usage of pressure_on_hybrid_levels() and interpolate_hybrid_to_height_levels(). The old method is still available for backward compatibility but will be removed in a future release.

Deprecated code

import numpy as np

import earthkit.meteo.vertical.array as vertical
from earthkit.meteo.utils.sample import get_sample

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

# get temperature and specific humidity profiles on hybrid levels (example data)
DATA = get_sample("vertical_hybrid_data")
t = DATA.t
q = DATA.q

# compute the pressure on geopotential height levels above the
# ground using linear interpolation
h_target = 10.0
p = vertical.pressure_at_height_levels(h_target, t, q, sp, A, B, alpha_top="ifs")

New code

import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.sample import get_sample

# get hybrid (IFS model) level definition
A, B = vertical.hybrid_level_parameters(137, model="ifs")

# define surface pressures
sp = np.array([100000.0, 90000.0])

# get temperature and specific humidity profiles on hybrid levels (example data)
DATA = get_sample("vertical_hybrid_data")
t = DATA.t
q = DATA.q

# Option 1

# compute the pressure on full hybrid levels
p_full = vertical.pressure_on_hybrid_levels(sp, A=A, B=B, alpha_top="ifs", output="full")

# interpolate the pressure to geopotential height levels above the ground
# using linear interpolation
target_h = [10.0]
p_h = vertical.interpolate_hybrid_to_height_levels(
    p_full,
    target_h,
    t,
    q,
    0,
    sp,
    A,
    B,
    h_type="geopotential",
    h_reference="ground",
    interpolation="linear",
    alpha_top="ifs",
)

# Option 2

# compute the pressure on full hybrid levels
p_full, alpha, delta = vertical.pressure_on_hybrid_levels(
    sp, A=A, B=B, alpha_top="ifs", output=("full", "alpha", "delta")
)

z = vertical.relative_geopotential_thickness_on_hybrid_levels_from_alpha_delta(t, q, alpha, delta)
h = vertical.geopotential_height_from_geopotential(z)

# interpolate the pressure to geopotential height levels above the ground
# using linear interpolation
target_h = [10.0]
p_h = vertical.interpolate_monotonic(
    p_full,
    h,
    target_h,
    interpolation="linear",
)