Skip to content

[Question] Efficiently selecting nearest time data per group in Xarray #10233

Answered by Parrot7483
Parrot7483 asked this question in Q&A

You must be logged in to vote

One has to do the following it is reasonably faster but not perfect.

  1. Group by id and time using UniqueGrouper and BinGrouper
  2. squeeze the id coordinate
  3. select using pad or nearest
  4. collapse the time_bins coordinate using max or min to get a dense matrix.

Replies: 4 comments 2 replies

You must be logged in to vote
0 replies

You must be logged in to vote
0 replies

You must be logged in to vote
2 replies
@dcherian

@Parrot7483

Answer selected by Parrot7483

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