You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our historical policy was that we made no assumptions about .meta so it could be any object of any arbitrary complexity. I feel like defaulting to deepcopy is not in the spirit of this policy.
It's safer to copy than not deepcopy because a deepcopy could use a lot of memory if a large array is in the .meta, and it's safer and easier for someone to explicitly deepcopy afterwards than it is to undo a deepcopy.
Users may well be surprised by the fact that the whole .meta is the same or the values of a dict as .meta are the same if we don't copy (old behaviour) or only copy.
The text was updated successfully, but these errors were encountered:
So if the meta is axis-aware or not I will get different behaviour? If it is not axis-aware meta will be a reference to the original cubes meta but if it is axis aware it will be a new rebinded meta? My initial thought is a rebinded cube is a completely new cube and that it would not share anything with the original cube and if I changed the meta on the rebinded cube I would not expect it to alter the meta on the orig cube 🤯 I can see times where sharing it would be beneficial or even necessary.
I think there are cases where either is correct so maybe add an kwarg to control and default to old behaviour. In any case I think it needs to be called out in the documentation as a potential footgun.
Describe the bug
Pre #455 we didn't copy the meta attribute at all if it wasn't rebin aware:
ndcube/ndcube/ndcube.py
Line 1220 in fb788f7
post #455 we deepcopy it:
ndcube/ndcube/ndcube.py
Line 1280 in badee33
We had a long discussion about this in the matrix channel, but to summarise:
.meta
so it could be any object of any arbitrary complexity. I feel like defaulting todeepcopy
is not in the spirit of this policy.copy
than notdeepcopy
because adeepcopy
could use a lot of memory if a large array is in the.meta
, and it's safer and easier for someone to explicitly deepcopy afterwards than it is to undo a deepcopy..meta
is the same or the values of a dict as.meta
are the same if we don't copy (old behaviour) or only copy.The text was updated successfully, but these errors were encountered: