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
I was working on #304 when I discovered that our ij.py.to_xarray() does not rename dimensions properly. When to_xarray() is given an xarray.DataArray with dimensions and a new dimension order (i.e. a list of new dimension names) the expected output is a rename of the dimensions. For example:
What to_xarray() with a new dimension order should do here is rename the dimensions while preserving the shape and the coordinates. It should not reshape the array. If a you want to do that, then the user should use xarray.DataArray.transpose().
When I try to do this dimension renaming with pyimagej built from main I get this ValueError:
It looks like xarray is no longer deprecating xarray.DataArray.rename as this works and produces the desired result of just changing the dimension labels without changing the shape of the array.
But at some point this method was flagged to be deprecated (see commit: c003095). I clearly missed this discussion indicating that the deprecation warning was actually planned on being dropped. I'm currently using xarray 2024.9.0 which does not produce this warning.
The remedy here is to revert back to our old logic which works as intended. Additionally I will add some extra tests that more rigorously shuffles the dimension names.
I was working on #304 when I discovered that our
ij.py.to_xarray()
does not rename dimensions properly. Whento_xarray()
is given anxarray.DataArray
with dimensions and a new dimension order (i.e. a list of new dimension names) the expected output is a rename of the dimensions. For example:What
to_xarray()
with a new dimension order should do here is rename the dimensions while preserving the shape and the coordinates. It should not reshape the array. If a you want to do that, then the user should usexarray.DataArray.transpose()
.When I try to do this dimension renaming with
pyimagej
built frommain
I get thisValueError
:Here's a minimal script that reproduces this:
The text was updated successfully, but these errors were encountered: