You are viewing the latest unreleased documentation 3.10.0.dev17. You can switch to a stable version.

iris.iterate#

Cube functions for iteration in step.

iris.iterate.izip(*cubes, **kwargs)[source]#

Return an iterator for iterating over a collection of cubes in step.

If the input cubes have dimensions for which there are no common coordinates, those dimensions will be treated as orthogonal. The resulting iterator will step through combinations of the associated coordinates.

Parameters:
  • cubes (iris.cube.Cube) – One or more iris.cube.Cube instances over which to iterate in step. Each cube should be provided as a separate argument e.g. iris.iterate.izip(cube_a, cube_b, cube_c, ...).

  • coords (str, coord or a list of strings/coords) – Coordinate names/coordinates of the desired subcubes (i.e. those that are not iterated over). They must all be orthogonal (i.e. point to different dimensions).

  • ordered (bool, optional) – If True (default), the order of the coordinates in the resulting subcubes will match the order of the coordinates in the coords keyword argument. If False, the order of the coordinates will be preserved and will match that of the input cubes.

Return type:

An iterator over a collection of tuples that contain the resulting subcubes.

Examples

>>> e_content, e_density = iris.load_cubes(
...     iris.sample_data_path('space_weather.nc'),
...     ['total electron content', 'electron density'])
>>> for tslice, hslice in iris.iterate.izip(e_content, e_density,
...                                         coords=['grid_latitude',
...                                                 'grid_longitude']):
...    pass

Notes

This function maintains laziness when called; it does not realise data. See more at Real and Lazy Data.