Skip to content

BUG: Iris coords bounds indexing broken with multiple ellipsis #2425

@cpelley

Description

@cpelley

In numpy v1.12.0 it is no longer simply deprecated to index with a double ellipsis, it is now enforced by an IndexError exception raised. Here is the relevant numpy change.

This exposes a bug in iris as iris.util.column_slices_generator can return an ellipsis, then an additional ellipsis is also appended here.

>>> import numpy as np
>>> import iris.coords.DimCoord as DimCoord
>>> np.__version__
'1.12.0'
>>> coord = DimCoord([-1,  0,  1,  2])
>>> coord.guess_bounds()
>>> coord[np.array([0, 3])]
*** IndexError: an index can only have a single ellipsis ('...')

Here is a partial traceback:

...
    coord = super(DimCoord, self).__getitem__(key)
  File "/path/to/iris/coords.py", line 496, in __getitem__
    bounds = bounds[keys + (Ellipsis, )]
IndexError: an index can only have a single ellipsis ('...')

Workaround is to explicitly specify numpy as one of our dependencies and pin its version to 1.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions