Skip to content

Commit

Permalink
Allow deprecated regridding scheme linear_extrapolate in recipe che…
Browse files Browse the repository at this point in the history
…cks (#2324)
  • Loading branch information
schlunma authored Feb 5, 2024
1 parent 22e31c6 commit 0b2bd1a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
7 changes: 7 additions & 0 deletions esmvalcore/_recipe/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,13 @@ def regridding_schemes(settings: dict):
# Check built-in regridding schemes (given as str)
if isinstance(scheme, str):
scheme = settings['regrid']['scheme']

# Also allow deprecated 'linear_extrapolate' scheme (the corresponding
# deprecation warning will be raised in the regrid() preprocessor)
# TODO: Remove in v2.13.0
if scheme == 'linear_extrapolate':
return

allowed_regridding_schemes = list(
set(
list(HORIZONTAL_SCHEMES_IRREGULAR) +
Expand Down
25 changes: 25 additions & 0 deletions tests/integration/recipe/test_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2884,6 +2884,7 @@ def test_invalid_builtin_regridding_scheme(
test:
regrid:
scheme: INVALID
target_grid: 2x2
diagnostics:
diagnostic_name:
variables:
Expand Down Expand Up @@ -2914,6 +2915,7 @@ def test_generic_regridding_scheme_no_ref(
regrid:
scheme:
no_reference: given
target_grid: 2x2
diagnostics:
diagnostic_name:
variables:
Expand Down Expand Up @@ -2945,6 +2947,7 @@ def test_invalid_generic_regridding_scheme(
regrid:
scheme:
reference: invalid.module:and.function
target_grid: 2x2
diagnostics:
diagnostic_name:
variables:
Expand All @@ -2966,3 +2969,25 @@ def test_invalid_generic_regridding_scheme(
get_recipe(tmp_path, content, session)
assert str(rec_err_exp.value) == INITIALIZATION_ERROR_MSG
assert msg in str(rec_err_exp.value.failed_tasks[0].message)


def test_deprecated_regridding_scheme(tmp_path, patched_datafinder, session):
content = dedent("""
preprocessors:
test:
regrid:
scheme: linear_extrapolate
target_grid: 2x2
diagnostics:
diagnostic_name:
variables:
tas:
mip: Amon
preprocessor: test
timerange: '2000/2010'
additional_datasets:
- {project: CMIP5, dataset: CanESM2, exp: amip,
ensemble: r1i1p1}
scripts: null
""")
get_recipe(tmp_path, content, session)

0 comments on commit 0b2bd1a

Please sign in to comment.