Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6dfd7c5
Interpolate arrays to pressure levels
sandorkertesz Dec 2, 2025
d17070c
Interpolate arrays to pressure levels
sandorkertesz Dec 2, 2025
ad21ce7
Rename
sandorkertesz Dec 3, 2025
fe19f05
Model levels
sandorkertesz Dec 5, 2025
43290b2
Tests
sandorkertesz Dec 8, 2025
fcad68c
Merge branch 'develop' into feature/array-pres-vert-interpolation
sandorkertesz Dec 8, 2025
5946a03
Pressure on hybrid levels
sandorkertesz Dec 8, 2025
e5b2945
Fix monotonic
sandorkertesz Dec 8, 2025
f88416d
Merge branch 'develop' into feature/array-vertical-interpolation
sandorkertesz Dec 11, 2025
e178ed6
Geopotential
sandorkertesz Dec 11, 2025
b154d27
Merge from develop
sandorkertesz Dec 11, 2025
6d92a30
Vertical
sandorkertesz Dec 16, 2025
84b33f5
Monotonic
sandorkertesz Dec 18, 2025
58f3144
Vertical interpolation
sandorkertesz Jan 5, 2026
e1b77bc
Vertical interpolation
sandorkertesz Jan 5, 2026
2cb263b
Vertical interpolation
sandorkertesz Jan 5, 2026
c4c8ad5
Vertical interpolation
sandorkertesz Jan 6, 2026
27c1e8a
Vertical interpolation
sandorkertesz Jan 6, 2026
ba7124d
Fix xr tests
sandorkertesz Jan 6, 2026
f8cd2ba
Add tests
sandorkertesz Jan 7, 2026
276bcd2
Docs
sandorkertesz Jan 7, 2026
36e42f9
Docs
sandorkertesz Jan 9, 2026
04f336c
Docs
sandorkertesz Jan 9, 2026
ea9a2b5
Ignore
sandorkertesz Jan 12, 2026
80d3880
Docs
sandorkertesz Jan 12, 2026
1495ca5
gpu
sandorkertesz Jan 14, 2026
e9215a4
gpu
sandorkertesz Jan 14, 2026
3629baf
Docs
sandorkertesz Jan 14, 2026
0dce20e
Docs and tests
sandorkertesz Jan 16, 2026
fd001f5
Docs
sandorkertesz Jan 16, 2026
5f3dfe6
Sample
sandorkertesz Jan 16, 2026
5d0fe03
CI
sandorkertesz Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Bolton, D., (1980). The computation of equivalent potential temperature. Mon. We

.. [DaviesJones1983]

Davies-Jones, R. P., (1983). An accurate theoretical approximation for adiabatic condensation temperature. Mon. Wea. Rev., 111 , 11191121.
Davies-Jones, R. P., (1983). An accurate theoretical approximation for adiabatic condensation temperature. Mon. Wea. Rev., 111 , 1119-1121.


.. [DaviesJones2008]
Expand Down
73 changes: 73 additions & 0 deletions docs/release_notes/deprecation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
Deprecations
=============


.. _deprecated-0.7.0:

Version 0.7.0
-----------------

.. _deprecated-hybrid-pressure-at-model-levels:

:func:`pressure_at_model_levels` is deprecated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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


.. list-table::
:header-rows: 0

* - Deprecated code
* -

.. literalinclude:: include/deprec_hybrid_pressure.py

* - New code
* -

.. literalinclude:: include/migrated_hybrid_pressure.py


.. _deprecated-hybrid-relative-geopotential-thickness:

:func:`relative_geopotential_thickness` is deprecated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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


.. list-table::
:header-rows: 0

* - Deprecated code
* -

.. literalinclude:: include/deprec_hybrid_geopotential_thickness.py

* - New code
* -

.. literalinclude:: include/migrated_hybrid_geopotential_thickness.py


.. _deprecated-hybrid-pressure-at-height-levels:

:func:`pressure_at_height_levels` is deprecated
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

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


.. list-table::
:header-rows: 0

* - Deprecated code
* -

.. literalinclude:: include/deprec_hybrid_pressure_at_height_levels.py

* - New code
* -

.. literalinclude:: include/migrated_hybrid_pressure_at_height_levels.py
21 changes: 21 additions & 0 deletions docs/release_notes/include/deprec_hybrid_geopotential_thickness.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.testing import hybrid_level_test_data

# 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 = hybrid_level_test_data()
t = np.array(DATA.t)
q = np.array(DATA.q)

# compute the relative geopotential thickness
z_thickness = vertical.relative_geopotential_thickness(alpha, delta, t, q)
11 changes: 11 additions & 0 deletions docs/release_notes/include/deprec_hybrid_pressure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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_at_model_levels(A, B, sp, alpha_top="ifs")
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.testing import hybrid_level_test_data

# 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 = hybrid_level_test_data()
t = np.array(DATA.t)
q = np.array(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")
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.testing import hybrid_level_test_data

# 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 = hybrid_level_test_data()
t = DATA.t
q = DATA.q

# compute the relative geopotential thickness
z_thickness = vertical.relative_geopotential_thickness_on_hybrid_levels(t, q, A, B, sp, alpha_top="ifs")
13 changes: 13 additions & 0 deletions docs/release_notes/include/migrated_hybrid_pressure.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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(
A, B, sp, alpha_top="ifs", output=["full", "half", "delta", "alpha"]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import numpy as np

import earthkit.meteo.vertical as vertical
from earthkit.meteo.utils.testing import hybrid_level_test_data

# 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 the pressure on full hybrid levels
p_full = vertical.pressure_on_hybrid_levels(A, B, sp, alpha_top="ifs", output="full")

# get temperature and specific humidity profiles on hybrid levels (example data)
DATA = hybrid_level_test_data()
t = np.array(DATA.t)
q = np.array(DATA.q)

# 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,
t,
q,
0,
A,
B,
sp,
target_h,
h_type="geopotential",
h_reference="ground",
interpolation="linear",
alpha_top="ifs",
)
1 change: 1 addition & 0 deletions docs/release_notes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Release notes
.. toctree::
:maxdepth: 1

version_0.7_updates
version_0.6_updates
version_0.5_updates
version_0.4_updates
Expand Down
24 changes: 24 additions & 0 deletions docs/release_notes/version_0.7_updates.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Version 0.7 Updates
/////////////////////////


Version 0.7.0
===============

Deprecations
+++++++++++++++++++

- :ref:`deprecated-hybrid-pressure-at-model-levels`
- :ref:`deprecated-hybrid-relative-geopotential-thickness`
- :ref:`deprecated-hybrid-pressure-at-height-levels`

Vertical coordinate functions
-------------------------------

TODO: add docs


Vertical interpolations
------------------------

TODO: add docs
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
]
dynamic = [ "version" ]
dependencies = [
"deprecation",
"earthkit-utils>=0.0.1",
"numpy",
]
Expand Down
40 changes: 32 additions & 8 deletions src/earthkit/meteo/utils/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,40 @@
# A collection of functions to support pytest testing

import os
import sys
from importlib import import_module

from earthkit.utils.testing import get_array_backend
# from earthkit.utils.testing import get_array_backend

ARRAY_BACKENDS = get_array_backend(["numpy", "torch", "cupy"], raise_on_missing=False)
NUMPY_BACKEND = get_array_backend("numpy")
# ARRAY_BACKENDS = get_array_backend(["numpy", "torch", "cupy"], raise_on_missing=False)
# NUMPY_BACKEND = get_array_backend("numpy")

ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
if not os.path.exists(os.path.join(ROOT_DIR, "tests")):
ROOT_DIR = "./"
_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
if not os.path.exists(os.path.join(_ROOT_DIR, "tests")):
_ROOT_DIR = "./"


def test_data_path(filename: str) -> str:
return os.path.join(ROOT_DIR, filename)
def earthkit_file(*args) -> str:
return os.path.join(_ROOT_DIR, *args)


def modules_installed(*modules) -> bool:
for module in modules:
try:
import_module(module)
except (ImportError, RuntimeError, SyntaxError):
return False
return True


def hybrid_level_test_data():
"""Import hybrid level test data from tests/vertical/_hybrid_core_data.py"""
name = "_hybrid_core_data"
path = earthkit_file("tests/vertical")
if path not in sys.path:
sys.path.insert(0, path)

return import_module(name)


NO_XARRAY = not modules_installed("xarray")
1 change: 1 addition & 0 deletions src/earthkit/meteo/vertical/array/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
Vertical computation functions operating on numpy arrays.
"""

from .hybrid import * # noqa
from .vertical import * # noqa
Loading
Loading