Skip to content

cube.transpose is an in-place operation #2615

Closed
@pp-mo

Description

@pp-mo

I think it's pretty nasty and unexpected to have cube.transpose() modify in-place
That is, especially, as it seems to mimic numpy "transpose", which is not in-place.
Plus, we just don't have many in-place operations, largely by design (I think).

Thus in #2604 ...

  • I had a test cube and a sample result array which should match a derived coordinate.
  • I applied transpose operations to both, but the cube behaves differently to the result, when it should have been the same.

I think we should review this as it's peculiar and unexpected, and breaks the general simlilarity with numpy.
Arguably the numpy function could more clearly be named "transposed" (a la Python "sorted").
Obviously, that ship has sailed, but we could use that naming for a cube method.

Propose:

  • provide copying version called "cube.transposed()" instead
  • deprecating the existing "cube.transpose" -- or simply remove it from Iris 2.0 ??

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions