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: 4 additions & 1 deletion docs/src/whatsnew/latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ This document explains the changes made to Iris for this release
💣 Incompatible Changes
=======================

#. N/A
#. `@rcomer`_ removed the *target* parameter from
:func:`~iris.fileformats.pp.as_fields` and
:func:`~iris.fileformats.pp.save_pairs_from_cube` because it had no effect.
(:pull:`5783`)


🚀 Performance Enhancements
Expand Down
27 changes: 10 additions & 17 deletions lib/iris/fileformats/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -2177,15 +2177,12 @@ def save(cube, target, append=False, field_coords=None):
of cubes to be saved to a PP file.

"""
fields = as_fields(cube, field_coords, target)
fields = as_fields(cube, field_coords)
save_fields(fields, target, append=append)


def save_pairs_from_cube(cube, field_coords=None, target=None):
"""Use the PP saving rules to convert a cube.

Use the PP saving rules to convert a cube or
iterable of cubes to an iterable of (2D cube, PP field) pairs.
def save_pairs_from_cube(cube, field_coords=None):
"""Use the PP saving rules to generate (2D cube, PP field) pairs from a cube.

Parameters
----------
Expand All @@ -2196,8 +2193,11 @@ def save_pairs_from_cube(cube, field_coords=None, target=None):
reducing the given cube into 2d slices, which will ultimately
determine the x and y coordinates of the resulting fields.
If None, the final two dimensions are chosen for slicing.
target : optional
A filename or open file handle.

Yields
------
:class:`iris.cube.Cube`, :class:`iris.fileformats.pp.PPField`.
2-dimensional slices of the input cube together with their associated pp-fields.

"""
# Open issues
Expand Down Expand Up @@ -2298,7 +2298,7 @@ def save_pairs_from_cube(cube, field_coords=None, target=None):
yield (slice2D, pp_field)


def as_fields(cube, field_coords=None, target=None):
def as_fields(cube, field_coords=None):
"""Use the PP saving rules to convert a cube to an iterable of PP fields.

Use the PP saving rules (and any user rules) to convert a cube to
Expand All @@ -2312,16 +2312,9 @@ def as_fields(cube, field_coords=None, target=None):
reducing the given cube into 2d slices, which will ultimately
determine the x and y coordinates of the resulting fields.
If None, the final two dimensions are chosen for slicing.
target : optional
A filename or open file handle.

"""
return (
field
for cube, field in save_pairs_from_cube(
cube, field_coords=field_coords, target=target
)
)
return (field for _, field in save_pairs_from_cube(cube, field_coords=field_coords))


def save_fields(fields, target, append: bool = False):
Expand Down