-
Notifications
You must be signed in to change notification settings - Fork 68
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
Fix the restoration of non-indexed axes. #1189
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1189 +/- ##
==========================================
+ Coverage 88.5% 88.51% +<.01%
==========================================
Files 133 133
Lines 4978 4982 +4
==========================================
+ Hits 4406 4410 +4
Misses 572 572
Continue to review full report at Codecov.
|
19cdaa2
to
3972c7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't totally understand the issue? If you sel on value of the zplane then that results in the zc dimension only having a scalar value? But does that matter? You could still access that value with indexed.xarray['zc'].data
3972c7c
to
654fb29
Compare
654fb29
to
c31e22f
Compare
c31e22f
to
0ba45b6
Compare
|
5d8b588
to
71202db
Compare
71202db
to
d42fa0f
Compare
d42fa0f
to
9af3aec
Compare
When the selection removes a dimension, xarray.expand_dims does not expand the non-indexed dimensions that were removed. For example, if one selects only a single zplane, it reduce the z physical coordinate to a coordinate scalar, and not an array of size 1. When we detect that an axis was reduced out of existence, we ensure that the dependent axes are restored to arrays.
9af3aec
to
93dd7d2
Compare
When the selection removes a dimension, xarray.expand_dims does not expand the non-indexed dimensions that were removed. For example, if one selects only a single zplane, it reduce the z physical coordinate to a coordinate scalar, and not an array of size 1.
When we detect that an axis was reduced out of existence, we ensure that the dependent axes are restored to arrays.
Test plan: Wrote a test that selects an ImageStack using a variety of selectors. In each case, the length of each indexed dimension (i.e., X, Y, ZPLANE) must match its dependent dimension (i.e., XC, YC, ZC).