Skip to content
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
5 changes: 5 additions & 0 deletions docs/iris/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ This document explains the changes made to Iris for this release
``int``. The deprecated attributes ``flag1``, ``flag2`` etc. have been
removed from it. (:pull:`3461`)

* `@bjlittle`_ deprecated :func:`~iris.util.as_compatible_shape` in preference
for :class:`~iris.common.resolve.Resolve` e.g., ``Resolve(src, tgt)(tgt.core_data())``.
The :func:`~iris.util.as_compatible_shape` function will be removed in a future
release of Iris. (:pull:`3892`)


🔗 Dependencies
===============
Expand Down
13 changes: 13 additions & 0 deletions lib/iris/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import numpy.ma as ma

import iris
from iris._deprecation import warn_deprecated
import iris.coords
import iris.exceptions
import iris.cube
Expand Down Expand Up @@ -1222,6 +1223,12 @@ def as_compatible_shape(src_cube, target_cube):

.. note:: This function will load and copy the data payload of `src_cube`.

.. deprecated:: 3.0.0

Instead use :class:`~iris.common.resolve.Resolve`. For example, rather
than calling ``as_compatible_shape(src_cube, target_cube)`` replace
with ``Resolve(src_cube, target_cube)(target_cube.core_data())``.

Args:

* src_cube:
Expand All @@ -1236,6 +1243,12 @@ def as_compatible_shape(src_cube, target_cube):
suitably reshaped to fit.

"""
wmsg = (
"iris.util.as_compatible_shape has been deprecated and will be "
"removed, please use iris.common.resolve.Resolve instead."
)
warn_deprecated(wmsg)

dim_mapping = {}
for coord in target_cube.aux_coords + target_cube.dim_coords:
dims = target_cube.coord_dims(coord)
Expand Down