Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Avoid calling np.asarray on lazy indexing classes #6874
Avoid calling np.asarray on lazy indexing classes #6874
Changes from 49 commits
45cd500
9c0350c
74afa53
9de7427
cc0a653
59c7ead
2aa0830
1306758
cf67972
0209900
536648a
f2514c7
3c597d4
201eeba
cd02a8a
7ef55e0
4e77fec
d14c61f
19af950
22db817
2bbcc16
ca2a10a
9256dd0
906c3b3
598c201
941c643
d1127fe
c0c78a1
9b727e6
46d98ec
b19a24b
84f560f
426519f
c4b81bf
d11a3cf
c223617
51552d4
5f1cf53
937d572
cc7d0b5
1576261
7d8459e
9815b75
39e7529
f304bcb
6cb1677
2c7da96
26d224c
65da209
0bc1175
8c2d74c
20c8c81
77f7059
517f195
5c23bd2
887e1c5
2557d02
b313258
cbd030e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
We currently return
pydap.BaseType
and rely on annp.asarray
call inexplicit_indexing_adapter
. I've removed that call below.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.
Adding
_wrap_numpy_scalars
allows us to handle scalars being returned by the backend. This seems OK to me in that we place fewer restrictions on the backend (and is backward compatible).xarray/xarray/core/indexing.py
Lines 607 to 612 in 3ee7b5a
But now the issue is that we should pass an appropriate
like
argument tonp.array
but I don't see how to that from a scalararray
Good news is that backends can avoid this complication by returning arrays, so we could just ignore this ugly bit for now.
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 think this is the right generalization.
as_indexable
should choose an appropriate indexing adapter.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.
Not entirely sure about this but it forces us to explicitly pass numpy arrays to NumpyIndexingAdapter. Only the pydap test failed, so I cast those objects to np.array in the backend.