From a67df21a72867f822aad3e89e1edf7db22d7ea88 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:28:01 +0100 Subject: [PATCH 1/7] implement 2.7.0 deprecation --- esmvalcore/preprocessor/_regrid.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/esmvalcore/preprocessor/_regrid.py b/esmvalcore/preprocessor/_regrid.py index ad5d8b9b39..f7e09b14dc 100644 --- a/esmvalcore/preprocessor/_regrid.py +++ b/esmvalcore/preprocessor/_regrid.py @@ -860,21 +860,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( From 0891ef09984e11588f30aecb247e2023e88d1c17 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:33:26 +0100 Subject: [PATCH 2/7] remove test bit associated with deprec mssg --- .../preprocessor/_regrid/test_extract_levels.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/unit/preprocessor/_regrid/test_extract_levels.py b/tests/unit/preprocessor/_regrid/test_extract_levels.py index 43bf715164..47438ede0f 100644 --- a/tests/unit/preprocessor/_regrid/test_extract_levels.py +++ b/tests/unit/preprocessor/_regrid/test_extract_levels.py @@ -61,19 +61,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) From cc6c8f6cfb75f75df1c8e3867a93a0381c7eb181 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:36:49 +0100 Subject: [PATCH 3/7] unimport module --- esmvalcore/preprocessor/_regrid.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/esmvalcore/preprocessor/_regrid.py b/esmvalcore/preprocessor/_regrid.py index f7e09b14dc..fa4e04f205 100644 --- a/esmvalcore/preprocessor/_regrid.py +++ b/esmvalcore/preprocessor/_regrid.py @@ -17,8 +17,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 From dc1d9f120f08a809700fa0a5f269f3b7a95032d5 Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:37:36 +0100 Subject: [PATCH 4/7] unimport module --- esmvalcore/preprocessor/_regrid.py | 1 - 1 file changed, 1 deletion(-) diff --git a/esmvalcore/preprocessor/_regrid.py b/esmvalcore/preprocessor/_regrid.py index fa4e04f205..3cf0e057de 100644 --- a/esmvalcore/preprocessor/_regrid.py +++ b/esmvalcore/preprocessor/_regrid.py @@ -4,7 +4,6 @@ import logging import os import re -import warnings from copy import deepcopy from decimal import Decimal from typing import Dict From 9fe905fa516184eb7cb60665840e05ff90c5acaa Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:38:53 +0100 Subject: [PATCH 5/7] unimport module and fix flaker --- tests/unit/preprocessor/_regrid/test_extract_levels.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/unit/preprocessor/_regrid/test_extract_levels.py b/tests/unit/preprocessor/_regrid/test_extract_levels.py index 47438ede0f..dc25b5c6f5 100644 --- a/tests/unit/preprocessor/_regrid/test_extract_levels.py +++ b/tests/unit/preprocessor/_regrid/test_extract_levels.py @@ -10,7 +10,6 @@ from numpy import ma import tests -from esmvalcore.exceptions import ESMValCoreDeprecationWarning from esmvalcore.preprocessor._regrid import ( _MDI, VERTICAL_SCHEMES, @@ -61,7 +60,6 @@ def test_parse_vertical_schemes(self): interpolation, extrapolation = parse_vertical_scheme(scheme) assert interpolation, extrapolation == reference[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) From feeef441e265e60576ffbc20a2c02f2a5cec0e6b Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Mon, 10 Oct 2022 15:45:43 +0100 Subject: [PATCH 6/7] OK flake bugger off --- tests/unit/preprocessor/_regrid/test_extract_levels.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/unit/preprocessor/_regrid/test_extract_levels.py b/tests/unit/preprocessor/_regrid/test_extract_levels.py index dc25b5c6f5..638d61fbcd 100644 --- a/tests/unit/preprocessor/_regrid/test_extract_levels.py +++ b/tests/unit/preprocessor/_regrid/test_extract_levels.py @@ -6,7 +6,6 @@ import iris import numpy as np -import pytest from numpy import ma import tests From 12d492f4e3a811b238b03171374de57a0626895a Mon Sep 17 00:00:00 2001 From: Valeriu Predoi Date: Tue, 11 Oct 2022 11:22:54 +0100 Subject: [PATCH 7/7] remove deprecation note from doc --- doc/recipe/preprocessor.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/doc/recipe/preprocessor.rst b/doc/recipe/preprocessor.rst index dd057c3f58..6b372b9143 100644 --- a/doc/recipe/preprocessor.rst +++ b/doc/recipe/preprocessor.rst @@ -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`.