Skip to content

dataset.sel() argument to select outside closest neighbours is implemented? #6099

Answered by benbovy
aragong asked this question in Q&A
Discussion options

You must be logged in to vote

I think that your example may be a bit too specific to be implemented directly in Xarray. It is a good use case for Xarray's custom indexes, though (see https://github.com/pydata/xarray/projects/1). Once the feature is available, you could create a specific xarray.Index subclass which implements the logic so that .sel() will also select the nearest labels around a given range for a coordinate (or fill the first and/or last items with nan if the nearest elements are beyond a given tolerance).

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by TomNicholas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants