Pointwise indexing -- something like sel_points
See original GitHub issue@hdail suggested that it would be useful to be able to index points in addition to indexing dimensions separately. Right now, you can do this via something like:
xray.concat([ds.sel(x=x, y=y) for x, y in pts], dim='station')
This would be handy for sampling particular points out of multiple dimensions, e.g., to compare gridded and station data.
It’s also probably worth implementing in xray because it can be done quickly using numpy’s fancy indexing (I think) which would be more efficient than a loop, though I suspect the implementation is probably somewhat complex.
Issue Analytics
- State:
- Created 9 years ago
- Comments:19 (18 by maintainers)
Top Results From Across the Web
xarray.Dataset.sel_points — xarray 0.8.2 documentation
Returns a new dataset with each array indexed pointwise by tick labels along the specified dimension(s). In contrast to Dataset.isel_points , indexers for ......
Read more >Indexing and selecting data — xarray 0.7.1 documentation
Indexing a DataArray directly works (mostly) just like it does for numpy arrays, ... See Pointwise indexing for how to achieve this functionality...
Read more >Indexing and selecting data - xarray - Read the Docs
Indexing a DataArray directly works (mostly) just like it does for numpy arrays, except that the ... The following is an example of...
Read more >Download book PDF - Springer Link
A rough idea of how the product will function and what it looks like is ... as a sequence of indexed symbols by...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for this proposal.
I made a slight modification to @WeatherGod’s code so that I could use string indices for the “station” coordinate, though I’m sure there is a better way to implement this. Also note the addition of a few
list
calls for Python 3 compat.Fixed by https://github.com/pydata/xarray/pull/507