Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecation warning for regrid schemes already deprecated for v2.7.0 #1753

Merged
merged 7 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 0 additions & 9 deletions doc/recipe/preprocessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -394,15 +394,6 @@ The vertical interpolation currently supports the following schemes:
* ``nearest_extrapolate``: Nearest-neighbour interpolation with nearest-neighbour
extrapolation, i.e., extrapolation points will take their value from the
nearest source point.

.. note::
Previous versions of ESMValCore (<2.5.0) supported the schemes
``linear_horizontal_extrapolate_vertical`` and
``nearest_horizontal_extrapolate_vertical``. These schemes have been renamed
to ``linear_extrapolate`` and ``nearest_extrapolate``, respectively, in
version 2.5.0 and are identical to the new schemes. Support for the old
names will be removed in version 2.7.0.

* See also :func:`esmvalcore.preprocessor.extract_levels`.
* See also :func:`esmvalcore.preprocessor.get_cmor_levels`.

Expand Down
18 changes: 0 additions & 18 deletions esmvalcore/preprocessor/_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import logging
import os
import re
import warnings
from copy import deepcopy
from decimal import Decimal
from typing import Dict
Expand All @@ -17,8 +16,6 @@
from iris.analysis import AreaWeighted, Linear, Nearest, UnstructuredNearest
from iris.util import broadcast_to_shape

from esmvalcore.exceptions import ESMValCoreDeprecationWarning

from ..cmor._fixes.shared import add_altitude_from_plev, add_plev_from_altitude
from ..cmor.fix import fix_file, fix_metadata
from ..cmor.table import CMOR_TABLES
Expand Down Expand Up @@ -860,21 +857,6 @@ def parse_vertical_scheme(scheme):
(str, str)
A tuple containing the interpolation and extrapolation scheme.
"""
# Issue warning when deprecated schemes are used
deprecated_schemes = {
'linear_horizontal_extrapolate_vertical': 'linear_extrapolate',
'nearest_horizontal_extrapolate_vertical': 'nearest_extrapolate',
}
if scheme in deprecated_schemes:
new_scheme = deprecated_schemes[scheme]
deprecation_msg = (
f"The vertical regridding scheme ``{scheme}`` has been deprecated "
f"in ESMValCore version 2.5.0 and is scheduled for removal in "
f"version 2.7.0. It has been renamed to the identical scheme "
f"``{new_scheme}`` without any change in functionality.")
warnings.warn(deprecation_msg, ESMValCoreDeprecationWarning)
scheme = new_scheme

# Check if valid scheme is given
if scheme not in VERTICAL_SCHEMES:
raise ValueError(
Expand Down
16 changes: 0 additions & 16 deletions tests/unit/preprocessor/_regrid/test_extract_levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@

import iris
import numpy as np
import pytest
from numpy import ma

import tests
from esmvalcore.exceptions import ESMValCoreDeprecationWarning
from esmvalcore.preprocessor._regrid import (
_MDI,
VERTICAL_SCHEMES,
Expand Down Expand Up @@ -61,20 +59,6 @@ def test_parse_vertical_schemes(self):
interpolation, extrapolation = parse_vertical_scheme(scheme)
assert interpolation, extrapolation == reference[scheme]

# Deprecated schemes (remove in v2.7)
deprecated_references = {
'linear_horizontal_extrapolate_vertical': ('linear', 'nearest'),
'nearest_horizontal_extrapolate_vertical': ('nearest', 'nearest'),
}
for scheme in deprecated_references:
warn_msg = (
"`` has been deprecated in ESMValCore version 2.5.0 and is "
"scheduled for removal in version 2.7.0. It has been renamed "
"to the identical scheme ``")
with pytest.warns(ESMValCoreDeprecationWarning, match=warn_msg):
interp, extrap = parse_vertical_scheme(scheme)
assert interp, extrap == deprecated_references[scheme]

def test_nop__levels_match(self):
vcoord = _make_vcoord(self.z, dtype=self.dtype)
self.assertEqual(self.cube.coord(axis='z', dim_coords=True), vcoord)
Expand Down