From 960f4c078a97f1fcfdfcc8fb4fcb9bdaebb562c2 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 00:05:46 +0100 Subject: [PATCH 1/7] ci: Build the mir-python wheel without the mirlib pin Co-Authored-By: Claude Opus 5.5 --- .ci/manifest.toml | 33 +++++++++++++++ .ci/packages/mir-python/CMakeLists.txt | 36 ++++++++++++++++ .ci/packages/mir-python/CMakePresets.json | 13 ++++++ .ci/runner/mir-python.sh.j2 | 9 ++++ .github/workflows/ci.yml | 50 ++++++++++++++++++++++- REUSE.toml | 2 +- python/mir/setup.py | 5 ++- 7 files changed, 144 insertions(+), 4 deletions(-) create mode 100644 .ci/packages/mir-python/CMakeLists.txt create mode 100644 .ci/packages/mir-python/CMakePresets.json create mode 100644 .ci/runner/mir-python.sh.j2 diff --git a/.ci/manifest.toml b/.ci/manifest.toml index 5a88589b8..142508477 100644 --- a/.ci/manifest.toml +++ b/.ci/manifest.toml @@ -61,6 +61,39 @@ options = "python" job-script = "./.ci/runner/python.sh.j2" python-version = "3.12" +[packages.mir-python] +compiler-inputs = ["cxx-compiler"] +allow-stale-deps = true + +[[packages.mir-python.deps]] +package = "mir" + +[matrix.python] +packages = ["mir-python"] +triggers = ["upstream-change", "rebuild-request"] + +[matrix.python.defaults] +job-script = "./.ci/runner/mir-python.sh.j2" +build-type = "RelWithDebInfo" +# runs-on = "arc-runner-normal" +runs-on = "ubuntu-latest" +cxx-compiler = "g++-13" +c-compiler = "gcc-13" +container = "eccr.ecmwf.int/public-ci-images/ubuntu24.04-gcc13-gfortran13" +platform = "ubuntu-24.04" + +[[matrix.python.include]] +python-version = "3.11" + +[[matrix.python.include]] +python-version = "3.12" + +[[matrix.python.include]] +python-version = "3.13" + +[[matrix.python.include]] +python-version = "3.14" + # HPC off along with the ARC runners (hpc-submit): lanes disabled until they are back. # [matrix.build-hpc] # execution = "hpc-atos" diff --git a/.ci/packages/mir-python/CMakeLists.txt b/.ci/packages/mir-python/CMakeLists.txt new file mode 100644 index 000000000..094c01730 --- /dev/null +++ b/.ci/packages/mir-python/CMakeLists.txt @@ -0,0 +1,36 @@ +# SPDX-FileCopyrightText: 1996- European Centre for Medium-Range Weather Forecasts (ECMWF) +# SPDX-License-Identifier: Apache-2.0 + +# The mir Python bindings (PyPI: mir-python) as a wheel, against an installed mir: +# cmake -S .ci/packages/mir-python -B build -DCMAKE_PREFIX_PATH= +# `cmake --install` writes the wheel to /wheels. Without VERSION_SUFFIX +# (set by the PyPI build) it does not require mirlib. + +cmake_minimum_required( VERSION 3.18 FATAL_ERROR ) + +project( mir-python LANGUAGES CXX ) + +set( CMAKE_CXX_STANDARD 17 ) +set( CMAKE_CXX_STANDARD_REQUIRED ON ) + +find_package( mir REQUIRED ) +find_package( Python3 3.11 REQUIRED COMPONENTS Interpreter Development.Module NumPy ) + +set( _repo "${CMAKE_CURRENT_SOURCE_DIR}/../../.." ) +set( _staging "${CMAKE_BINARY_DIR}/wheel-staging" ) + +file( REMOVE_RECURSE "${_staging}" ) +file( COPY "${_repo}/python/mir/" DESTINATION "${_staging}" + PATTERN "tests" EXCLUDE + PATTERN "VERSION" EXCLUDE ) +configure_file( "${_repo}/VERSION" "${_staging}/VERSION" COPYONLY ) + +set( PYTHONEXT_INSTALL_DIR "${_staging}/src" CACHE PATH "Install directory for Python extensions" FORCE ) +add_subdirectory( "${_repo}/python" python ) + +install( CODE " + execute_process( + COMMAND \"${Python3_EXECUTABLE}\" -m build --wheel --outdir \"\${CMAKE_INSTALL_PREFIX}/wheels\" \"${_staging}\" + COMMAND_ERROR_IS_FATAL ANY + ) +" ) diff --git a/.ci/packages/mir-python/CMakePresets.json b/.ci/packages/mir-python/CMakePresets.json new file mode 100644 index 000000000..6a588d367 --- /dev/null +++ b/.ci/packages/mir-python/CMakePresets.json @@ -0,0 +1,13 @@ +{ + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ci" + } + ], + "version": 3 +} diff --git a/.ci/runner/mir-python.sh.j2 b/.ci/runner/mir-python.sh.j2 new file mode 100644 index 000000000..9aa7e6cba --- /dev/null +++ b/.ci/runner/mir-python.sh.j2 @@ -0,0 +1,9 @@ +{# SPDX-FileCopyrightText: 1996- European Centre for Medium-Range Weather Forecasts (ECMWF) + SPDX-License-Identifier: Apache-2.0 #} +{% extends "ci-infrastructure/cmake-runner.sh.j2" %} +{% block set_environment %} +{% import "ci-infrastructure/python.j2" as py %} +{{ py.get_python_via_uv(python_version) }} +uv pip install build cython numpy +CI_SOURCE_DIR="$CI_SOURCE_DIR/.ci/packages/mir-python" +{% endblock %} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bffb7b46..57f6672d6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,7 +70,7 @@ jobs: - id: r uses: ecmwf/ci-infrastructure/actions/resolve-deps@main with: - matrix: build + matrix: build,python token: ${{ steps.mint.outputs.token }} rebuild-missing: 'true' - name: Wait for the deps of build @@ -140,10 +140,56 @@ jobs: install-path: ${{ steps.build.outputs.install-path }} artifact-name: ${{ matrix._resolved['own-artifact-name'] }} + python: + needs: [ci-approval, resolve, rebuild-producers, build] + name: python (${{ matrix._resolved['job-name'] }}) + runs-on: ${{ matrix['runs-on'] }} + container: + image: ${{ matrix.container || '' }} + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.resolve.outputs.matrices).python }} + steps: + - name: Announce image + uses: ecmwf/ci-infrastructure/actions/announce-image@main + - id: mint + uses: ecmwf/ci-infrastructure/actions/mint-token@main + with: + client-id: ${{ vars.CI_READER_APP_CLIENT_ID }} + private-key: ${{ secrets.CI_READER_APP_PRIVATE_KEY }} + repositories: atlas,ecbuild,eccodes,eckit,fckit,mir,stack-dependencies + permissions: contents:read actions:read + - uses: actions/checkout@v6 + with: + persist-credentials: false + - name: Fetch resolved deps + id: deps + uses: ecmwf/ci-infrastructure/actions/fetch-deps@main + with: + deps-json: ${{ toJSON(matrix._resolved.deps) }} + token: ${{ steps.mint.outputs.token }} + - name: Print dependency table + uses: ecmwf/ci-infrastructure/actions/print-dep-table@main + with: + resolved: ${{ toJSON(matrix._resolved) }} + - name: Build + id: build + uses: ecmwf/ci-infrastructure/actions/run-job-script@main + with: + job-script: ${{ matrix.job-script }} + matrix-leg: ${{ toJSON(matrix) }} + package: mir + cmake-prefix-path: ${{ steps.deps.outputs.cmake-prefix-path }} + - name: Publish + uses: ecmwf/ci-infrastructure/actions/publish-artifact@main + with: + install-path: ${{ steps.build.outputs.install-path }} + artifact-name: ${{ matrix._resolved['own-artifact-name'] }} + ci-result: name: collect results if: always() - needs: [ci-approval, pre-commit, resolve, build] + needs: [ci-approval, pre-commit, resolve, build, python] runs-on: ubuntu-latest permissions: statuses: write diff --git a/REUSE.toml b/REUSE.toml index 1019469d1..35839bc1a 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -25,7 +25,7 @@ SPDX-License-Identifier = "Apache-2.0" # as a bare version string by setup.py and by ecbuild; mir.sublime-project and # CMakePresets.json are JSON. [[annotations]] -path = ["VERSION", "mir.sublime-project", "CMakePresets.json"] +path = ["VERSION", "mir.sublime-project", "CMakePresets.json", ".ci/packages/*/CMakePresets.json"] precedence = "closest" SPDX-FileCopyrightText = "1996- European Centre for Medium-Range Weather Forecasts (ECMWF)" SPDX-License-Identifier = "Apache-2.0" diff --git a/python/mir/setup.py b/python/mir/setup.py index 78dd29900..955195b5f 100644 --- a/python/mir/setup.py +++ b/python/mir/setup.py @@ -1,6 +1,7 @@ # SPDX-FileCopyrightText: 1996- European Centre for Medium-Range Weather Forecasts (ECMWF) # SPDX-License-Identifier: Apache-2.0 +import os import platform import sys @@ -11,13 +12,15 @@ version = fVersion.readlines()[0].strip() install_requires = [ - f"mirlib=={version}", "eckit", # NOTE we don't pin here, because mirlib is exactly pinned, which in turn exactly pins eckitlib, which in turn constraints eckit "findlibs", "numpy>=2.0,<3.0", # NOTE may need tighter range in case of ABI issues. Dont forget to keep in sync with pre-compile.sh (or cmake files if numpy install refactored) "scipy", "pyyaml", ] +# Set by the PyPI build (wheelmaker); other builds use a mir installed alongside. +if os.environ.get("VERSION_SUFFIX"): + install_requires.insert(0, f"mirlib=={version}") # NOTE see ci-utils/wheelmaker/buildscripts/setup_utils, we need to get the right abi compat tag From c29028721f759c8b956302b2e34584b1c810df45 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 16:07:48 +0100 Subject: [PATCH 2/7] ci: Drop the old Python build leg Co-Authored-By: Claude Opus 5.5 --- .ci/manifest.toml | 5 ----- .ci/runner/python.sh.j2 | 9 --------- CMakePresets.json | 7 ------- 3 files changed, 21 deletions(-) delete mode 100644 .ci/runner/python.sh.j2 diff --git a/.ci/manifest.toml b/.ci/manifest.toml index 142508477..20bd7fcfe 100644 --- a/.ci/manifest.toml +++ b/.ci/manifest.toml @@ -56,11 +56,6 @@ cxx-compiler = "clang++-18" c-compiler = "clang-18" container = "eccr.ecmwf.int/public-ci-images/ubuntu24.04-clang18" -[[matrix.build.include]] -options = "python" -job-script = "./.ci/runner/python.sh.j2" -python-version = "3.12" - [packages.mir-python] compiler-inputs = ["cxx-compiler"] allow-stale-deps = true diff --git a/.ci/runner/python.sh.j2 b/.ci/runner/python.sh.j2 deleted file mode 100644 index 678d3f875..000000000 --- a/.ci/runner/python.sh.j2 +++ /dev/null @@ -1,9 +0,0 @@ -{# SPDX-FileCopyrightText: 1996- European Centre for Medium-Range Weather Forecasts (ECMWF) - SPDX-License-Identifier: Apache-2.0 #} -{% extends "ci-infrastructure/cmake-runner.sh.j2" %} -{% block set_environment %} -{% import "ci-infrastructure/python.j2" as py %} -{{ py.get_python_via_uv(python_version) }} -# Until the images provide them, ecmwf/ci-infrastructure#134. -uv pip install cython numpy -{% endblock %} diff --git a/CMakePresets.json b/CMakePresets.json index 9bb66bab7..1f8e8c5f8 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,13 +11,6 @@ "ENABLE_TESTS": "ON" }, "name": "ci" - }, - { - "cacheVariables": { - "ENABLE_PYTHON": "ON" - }, - "inherits": "ci", - "name": "python" } ], "version": 3 From cde707ed38a0e4e3372c442a2d3cce06fe8c7cca Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 16:12:32 +0100 Subject: [PATCH 3/7] ci: Run the Python bindings' tests Co-Authored-By: Claude Opus 5.5 --- .ci/packages/mir-python/CMakeLists.txt | 10 ++++++++++ .ci/runner/mir-python.sh.j2 | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.ci/packages/mir-python/CMakeLists.txt b/.ci/packages/mir-python/CMakeLists.txt index 094c01730..b778decc1 100644 --- a/.ci/packages/mir-python/CMakeLists.txt +++ b/.ci/packages/mir-python/CMakeLists.txt @@ -28,6 +28,16 @@ configure_file( "${_repo}/VERSION" "${_staging}/VERSION" COPYONLY ) set( PYTHONEXT_INSTALL_DIR "${_staging}/src" CACHE PATH "Install directory for Python extensions" FORCE ) add_subdirectory( "${_repo}/python" python ) +# The extensions reach the staging directory only on install, which runs after the tests. +enable_testing() +add_test( NAME mir-python_stage + COMMAND ${CMAKE_COMMAND} --install ${CMAKE_BINARY_DIR} --component python --prefix ${CMAKE_BINARY_DIR}/test-prefix ) +add_test( NAME mir-python_pytest + COMMAND ${Python3_EXECUTABLE} -m pytest -vv -p no:cacheprovider --basetemp ${CMAKE_BINARY_DIR}/pytest-tmp "${_repo}/python/mir/tests" ) +set_tests_properties( mir-python_stage PROPERTIES FIXTURES_SETUP mir-python_staged ) +set_tests_properties( mir-python_pytest PROPERTIES FIXTURES_REQUIRED mir-python_staged + ENVIRONMENT "PYTHONPATH=${_staging}/src" ) + install( CODE " execute_process( COMMAND \"${Python3_EXECUTABLE}\" -m build --wheel --outdir \"\${CMAKE_INSTALL_PREFIX}/wheels\" \"${_staging}\" diff --git a/.ci/runner/mir-python.sh.j2 b/.ci/runner/mir-python.sh.j2 index 9aa7e6cba..202388751 100644 --- a/.ci/runner/mir-python.sh.j2 +++ b/.ci/runner/mir-python.sh.j2 @@ -4,6 +4,6 @@ {% block set_environment %} {% import "ci-infrastructure/python.j2" as py %} {{ py.get_python_via_uv(python_version) }} -uv pip install build cython numpy +uv pip install build -r "$CI_SOURCE_DIR/python/mir/requirements.txt" CI_SOURCE_DIR="$CI_SOURCE_DIR/.ci/packages/mir-python" {% endblock %} From 03da5fccfcbd423bc434e9bb4e125aed1e768b8b Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 16:27:21 +0100 Subject: [PATCH 4/7] ci: Install the bindings' runtime dependencies for their tests Co-Authored-By: Claude Opus 5.5 --- .ci/manifest.toml | 7 +++++++ .ci/runner/mir-python.sh.j2 | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.ci/manifest.toml b/.ci/manifest.toml index 20bd7fcfe..951f43195 100644 --- a/.ci/manifest.toml +++ b/.ci/manifest.toml @@ -63,6 +63,13 @@ allow-stale-deps = true [[packages.mir-python.deps]] package = "mir" +[[packages.mir-python.deps]] +repo = "ecmwf/eckit" +package = "eckit-python" +ref = "develop" +compiler-inputs = ["cxx-compiler"] +python-version-input = "python-version" + [matrix.python] packages = ["mir-python"] triggers = ["upstream-change", "rebuild-request"] diff --git a/.ci/runner/mir-python.sh.j2 b/.ci/runner/mir-python.sh.j2 index 202388751..71f4d0512 100644 --- a/.ci/runner/mir-python.sh.j2 +++ b/.ci/runner/mir-python.sh.j2 @@ -4,6 +4,14 @@ {% block set_environment %} {% import "ci-infrastructure/python.j2" as py %} {{ py.get_python_via_uv(python_version) }} -uv pip install build -r "$CI_SOURCE_DIR/python/mir/requirements.txt" +# The eckit bindings come from eckit's CI wheel; PyPI's would bring a second eckit (eckitlib). +dep_wheels=() +IFS=';:' read -ra dep_prefixes <<<"${CMAKE_PREFIX_PATH:-}" +for prefix in ${dep_prefixes[@]+"${dep_prefixes[@]}"}; do + for whl in "$prefix"/wheels/*.whl; do + if [ -e "$whl" ]; then dep_wheels+=("$whl"); fi + done +done +uv pip install build ${dep_wheels[@]+"${dep_wheels[@]}"} -r "$CI_SOURCE_DIR/python/mir/requirements.txt" -r "$CI_SOURCE_DIR/python/mir/setup.py" CI_SOURCE_DIR="$CI_SOURCE_DIR/.ci/packages/mir-python" {% endblock %} From 0208dd8436a3b64841e5af524ab3f92cae471418 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 17:09:57 +0100 Subject: [PATCH 5/7] ci: Give the Python tests build-tree cache paths Co-Authored-By: Claude Opus 5.5 --- .ci/packages/mir-python/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/packages/mir-python/CMakeLists.txt b/.ci/packages/mir-python/CMakeLists.txt index b778decc1..22ee2f82f 100644 --- a/.ci/packages/mir-python/CMakeLists.txt +++ b/.ci/packages/mir-python/CMakeLists.txt @@ -35,8 +35,10 @@ add_test( NAME mir-python_stage add_test( NAME mir-python_pytest COMMAND ${Python3_EXECUTABLE} -m pytest -vv -p no:cacheprovider --basetemp ${CMAKE_BINARY_DIR}/pytest-tmp "${_repo}/python/mir/tests" ) set_tests_properties( mir-python_stage PROPERTIES FIXTURES_SETUP mir-python_staged ) +# Caches in the build tree, as the C++ tests do (tests/CMakeLists.txt). +file( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cache/eckit-geo" "${CMAKE_BINARY_DIR}/cache/mir" ) set_tests_properties( mir-python_pytest PROPERTIES FIXTURES_REQUIRED mir-python_staged - ENVIRONMENT "PYTHONPATH=${_staging}/src" ) + ENVIRONMENT "PYTHONPATH=${_staging}/src;ECKIT_GEO_CACHE_PATH=${CMAKE_BINARY_DIR}/cache/eckit-geo;MIR_CACHE_PATH=${CMAKE_BINARY_DIR}/cache/mir" ) install( CODE " execute_process( From ba149f81123702b1811cef09d12a4c6a918e0d60 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 17:12:31 +0100 Subject: [PATCH 6/7] Revert "ci: Give the Python tests build-tree cache paths" This reverts commit 0208dd8436a3b64841e5af524ab3f92cae471418. --- .ci/packages/mir-python/CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/packages/mir-python/CMakeLists.txt b/.ci/packages/mir-python/CMakeLists.txt index 22ee2f82f..b778decc1 100644 --- a/.ci/packages/mir-python/CMakeLists.txt +++ b/.ci/packages/mir-python/CMakeLists.txt @@ -35,10 +35,8 @@ add_test( NAME mir-python_stage add_test( NAME mir-python_pytest COMMAND ${Python3_EXECUTABLE} -m pytest -vv -p no:cacheprovider --basetemp ${CMAKE_BINARY_DIR}/pytest-tmp "${_repo}/python/mir/tests" ) set_tests_properties( mir-python_stage PROPERTIES FIXTURES_SETUP mir-python_staged ) -# Caches in the build tree, as the C++ tests do (tests/CMakeLists.txt). -file( MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/cache/eckit-geo" "${CMAKE_BINARY_DIR}/cache/mir" ) set_tests_properties( mir-python_pytest PROPERTIES FIXTURES_REQUIRED mir-python_staged - ENVIRONMENT "PYTHONPATH=${_staging}/src;ECKIT_GEO_CACHE_PATH=${CMAKE_BINARY_DIR}/cache/eckit-geo;MIR_CACHE_PATH=${CMAKE_BINARY_DIR}/cache/mir" ) + ENVIRONMENT "PYTHONPATH=${_staging}/src" ) install( CODE " execute_process( From b2de783e7a41c3ebcbef14522678dabc24a0cb07 Mon Sep 17 00:00:00 2001 From: Oskar Weser Date: Thu, 26 Nov 2026 17:13:18 +0100 Subject: [PATCH 7/7] Make the Python tests set their caches and skip PROJ cases as eckit's do Co-Authored-By: Claude Opus 5.5 --- python/mir/tests/conftest.py | 22 +++++++++++++++++++ python/mir/tests/test_interpolation_matrix.py | 19 +++++++--------- 2 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 python/mir/tests/conftest.py diff --git a/python/mir/tests/conftest.py b/python/mir/tests/conftest.py new file mode 100644 index 000000000..581279e51 --- /dev/null +++ b/python/mir/tests/conftest.py @@ -0,0 +1,22 @@ +# SPDX-FileCopyrightText: 1996- European Centre for Medium-Range Weather Forecasts (ECMWF) +# SPDX-License-Identifier: Apache-2.0 + + +import os +import shutil +import tempfile + +_cache_path = None + + +def pytest_configure(config): + """eckit::geo and mir cache to a temporary directory, not the runtime cache (set before it is resolved, on first use)""" + global _cache_path + _cache_path = tempfile.mkdtemp(prefix="mir_cache.") + os.environ["ECKIT_GEO_CACHE_PATH"] = os.path.join(_cache_path, "eckit-geo") + os.environ["MIR_CACHE_PATH"] = os.path.join(_cache_path, "mir") + + +def pytest_unconfigure(config): + if _cache_path is not None: + shutil.rmtree(_cache_path, ignore_errors=True) diff --git a/python/mir/tests/test_interpolation_matrix.py b/python/mir/tests/test_interpolation_matrix.py index e56525ef7..758409fdf 100644 --- a/python/mir/tests/test_interpolation_matrix.py +++ b/python/mir/tests/test_interpolation_matrix.py @@ -12,6 +12,7 @@ import numpy as np import pytest +from eckit.geo import projdb_is_available import mir @@ -52,13 +53,6 @@ def _works(input_grid, output_grid, interpolation) -> bool: return True -def _has_grid(spec) -> bool: - try: - return len(mir.Grid(spec)) > 0 - except RuntimeError: - return False - - def _cases(): for input_grid, output_grid, interpolation in product(INPUT, OUTPUT, INTERPOLATIONS): if reason := SHOULD_WORK.get((input_grid, output_grid, interpolation)): @@ -79,7 +73,7 @@ def _interpolate(input_spec, output_spec, interpolation): @pytest.mark.parametrize("input_grid, output_grid, interpolation, works", list(_cases())) def test_interpolation_matrix(input_grid, output_grid, interpolation, works): - if "swisslv95" in (input_grid, output_grid) and not _has_grid(INPUT["swisslv95"]): + if "swisslv95" in (input_grid, output_grid) and not projdb_is_available(): pytest.skip("swisslv95 requires PROJ") if not works and mir.Grid(INPUT[input_grid]) == mir.Grid(OUTPUT[output_grid]): @@ -167,7 +161,7 @@ def _contains(a, b) -> bool: @pytest.mark.parametrize("input_grid, output_grid", REGIONAL_CASES) def test_interpolation_regional(input_grid, output_grid): - if "swisslv95" in (input_grid, output_grid) and not _has_grid(REGIONAL["swisslv95"]): + if "swisslv95" in (input_grid, output_grid) and not projdb_is_available(): pytest.skip("swisslv95 requires PROJ") grid = mir.Grid(REGIONAL[output_grid]) @@ -183,7 +177,7 @@ def test_interpolation_regional(input_grid, output_grid): # projected output grids are kept as such (not described as unstructured_ll, by coordinates) @pytest.mark.parametrize("input_grid", ["swisslv95", "regular_ll"]) def test_interpolation_projected_output(input_grid): - if not _has_grid(REGIONAL["swisslv95"]): + if not projdb_is_available(): pytest.skip("swisslv95 requires PROJ") output = _interpolate(REGIONAL[input_grid], REGIONAL["swisslv95"], "nn") @@ -195,7 +189,7 @@ def test_interpolation_projected_output(input_grid): # output points outside the projected input domain are missing (not projected onto its boundary) @pytest.mark.parametrize("output_spec, size, missing", [(dict(grid="O320"), 57, 1), (dict(grid=[0.1, 0.1]), 960, 12)]) def test_interpolation_projected_outside(output_spec, size, missing): - if not _has_grid(INPUT["swisslv95"]): + if not projdb_is_available(): pytest.skip("swisslv95 requires PROJ") output = _interpolate(INPUT["swisslv95"], output_spec, "linear") @@ -213,6 +207,9 @@ def test_interpolation_projected_outside(output_spec, size, missing): ], ) def test_interpolation_matrix_grib(input_grid, output_spec, interpolation, size, missing): + if input_grid == "swisslv95" and not projdb_is_available(): + pytest.skip("swisslv95 requires PROJ") + from yaml import dump # output with missing values introduced by the interpolation (input has none)