-
Notifications
You must be signed in to change notification settings - Fork 0
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
Consolidate numpy and dask vindex handling #3
Consolidate numpy and dask vindex handling #3
Conversation
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.
Thanks for the PR. I have some comments here
xarray/core/nputils.py
Outdated
return mixed_positions, vindex_positions | ||
|
||
|
||
class VectorizedIndex(object): |
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.
As it is an array-wrapper, I think the name should be something like NumpyVectorizedIndexingAdapter
, like NumpyIndexingAdapter
or DaskIndexingAdapter
.
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.
Agreed, changed.
xarray/core/variable.py
Outdated
# result. This is significantly faster/more efficient for | ||
# most array backends. | ||
values = np.arange(*value.indices(self.sizes[dim])) | ||
variables.insert(i, Variable((dim,), values)) |
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 am wondering if this line is correct.
v = Variable(['w', 'x', 'y', 'z'], [[[[1, 2, 3], [4, 5, 6]]]])
ind = Variable(['y'], [0])
v_new = v[ind, :, 1:2, 2]
raises
'IndexError: index 2 is out of bounds for axis 2 with size 2'
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.
Good catch! Fixed (I think)
No description provided.