diff --git a/ndsl/stencils/__init__.py b/ndsl/stencils/__init__.py index f173d931..08a180a0 100644 --- a/ndsl/stencils/__init__.py +++ b/ndsl/stencils/__init__.py @@ -10,11 +10,10 @@ set_value_2D, sign, ) -from .corners import CopyCornersXY, FillCornersBGrid +from .corners import FillCornersBGrid __all__ = [ - "CopyCornersXY", "FillCornersBGrid", "copy", "adjustmentfactor_stencil", diff --git a/ndsl/stencils/corners.py b/ndsl/stencils/corners.py index d3fd2c0d..646c01ff 100644 --- a/ndsl/stencils/corners.py +++ b/ndsl/stencils/corners.py @@ -1,6 +1,3 @@ -import warnings -from collections.abc import Sequence - from gt4py.cartesian import gtscript from gt4py.cartesian.gtscript import PARALLEL, computation, horizontal, interval, region @@ -10,69 +7,6 @@ from ndsl.dsl.typing import FloatField -class CopyCornersXY: - """ - Helper-class to copy corners corresponding to the Fortran functions - copy_corners_x and copy_corners_y - """ - - def __init__( - self, - stencil_factory: StencilFactory, - dims: Sequence[str], - y_field, - ) -> None: - """ - Args: - stencil_factory: creates stencils - dims: dimensionality of the data to be copied - y_field: 3D gt4py storage to use for y-differenceable field - (x-differenceable field uses same memory as base field) - """ - warnings.warn( - "Usage of CopyCornersXY is deprecated and will be removed in the next release. " - "Use `CopyCornersX` and `CopyCornersY` in PyFV3 for a more future-proof " - "implementation of the corner code.", - DeprecationWarning, - stacklevel=2, - ) - grid_indexing = stencil_factory.grid_indexing - origin, domain = grid_indexing.get_origin_domain( - dims=dims, halos=(grid_indexing.n_halo, grid_indexing.n_halo) - ) - - self._y_field = y_field - - ax_offsets = grid_indexing.axis_offsets(origin, domain) - self._copy_corners_xy = stencil_factory.from_origin_domain( - func=copy_corners_xy_stencil_defn, - origin=origin, - domain=domain, - externals={ - **ax_offsets, - }, - ) - - def __call__(self, field: FloatField): - """ - Fills cell quantity field using corners from itself. - - Args: - field: field to fill corners - - Returns: - x_differenceable: input field, updated so it can be differenced - in x-direction - y_differenceable: copy of input field which can be differenced - in y-direction - """ - # we could avoid aliasing field for the x-differenceable output, but this - # requires selectively validating the halos, since the Fortran code does the - # final (x-direction) corners copy directly on the base field - self._copy_corners_xy(field, field, self._y_field) - return field, self._y_field - - def kslice_from_inputs( kstart: int, nk: int | None, grid_indexer: GridIndexing ) -> tuple[slice, int]: diff --git a/tests/stencils/test_stencils.py b/tests/stencils/test_stencils.py index 4163b320..194a956e 100644 --- a/tests/stencils/test_stencils.py +++ b/tests/stencils/test_stencils.py @@ -6,7 +6,6 @@ from ndsl.constants import X_DIM, Y_DIM, Z_DIM from ndsl.dsl.gt4py import FORWARD, computation, interval from ndsl.dsl.typing import Float, FloatField, FloatFieldIJ, set_4d_field_size -from ndsl.stencils import CopyCornersXY from ndsl.stencils.column_operations import ( column_max, column_max_ddim, @@ -165,10 +164,3 @@ def test_column_operations(boilerplate): assert min_index_ddim.field[:] == 5 + np.argmin( data_ddim.field[:, :, 5:, 1], axis=2 ) - - -def test_CopyCornersXY_deprecation(boilerplate) -> None: - stencil_factory, _ = boilerplate - - with pytest.deprecated_call(match="Usage of CopyCornersXY is deprecated"): - CopyCornersXY(stencil_factory, [X_DIM, Y_DIM, Z_DIM], None)