-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cube.transpose is an in-place operation #2615
Comments
+1 for cube.transpose returning a cube, however it is important to us that it does not consume any more memory for the data or coordinates i.e. the cube returned should be a view of the original cube. This would also be in keeping with ndarray.transpose behaviour. Not sure where transposed comes into this as numpy uses transpose. |
Taking this out of the v2.0.0 milestone - we aren't going to hit this in time, but can very readily add this as a future flag during the v2.x series. Of course, we will need to figure out data sharing before we can do this though (again, not going to happen for v2.0.0). |
In order to maintain a backlog of relevant issues, we automatically label them as stale after 500 days of inactivity. If this issue is still important to you, then please comment on this issue and the stale label will be removed. Otherwise this issue will be automatically closed in 28 days time. |
This stale issue has been automatically closed due to a lack of community activity. If you still care about this issue, then please either:
|
I agree that in-place operations need to be reduced, or we should at least have an option like |
I appreciate numpy is not consistent itself here but 'typically' method calls are in-place and calling an operation via function call would return a copy ( i.e. anyway, so for iris what about: return copy
in-place transpose of cube
Numpy makes use of the optional I think a contract is required on the UI. Ideally consistency, predictability AND flexibility. Cheers |
Xref #5007 |
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 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:
The text was updated successfully, but these errors were encountered: