Skip to content

Commit

Permalink
Allow deprecated regridding scheme unstructured_nearest in recipe c…
Browse files Browse the repository at this point in the history
…hecks (#2336)
  • Loading branch information
schlunma authored Feb 19, 2024
1 parent d936e4e commit 4d705ab
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
8 changes: 4 additions & 4 deletions esmvalcore/_recipe/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,10 +511,10 @@ def regridding_schemes(settings: dict):
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':
# Also allow deprecated 'linear_extrapolate' and 'unstructured_nearest'
# schemes (the corresponding deprecation warnings will be raised in the
# regrid() preprocessor) TODO: Remove in v2.13.0
if scheme in ('linear_extrapolate', 'unstructured_nearest'):
return

allowed_regridding_schemes = list(
Expand Down
28 changes: 27 additions & 1 deletion tests/integration/recipe/test_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3094,7 +3094,9 @@ def test_invalid_generic_regridding_scheme(
assert msg in str(rec_err_exp.value.failed_tasks[0].message)


def test_deprecated_regridding_scheme(tmp_path, patched_datafinder, session):
def test_deprecated_linear_extrapolate_scheme(
tmp_path, patched_datafinder, session
):
content = dedent("""
preprocessors:
test:
Expand All @@ -3114,3 +3116,27 @@ def test_deprecated_regridding_scheme(tmp_path, patched_datafinder, session):
scripts: null
""")
get_recipe(tmp_path, content, session)


def test_deprecated_unstructured_nearest_scheme(
tmp_path, patched_datafinder, session
):
content = dedent("""
preprocessors:
test:
regrid:
scheme: unstructured_nearest
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 4d705ab

Please sign in to comment.