Skip to content

How to select data in xarray Dataset with multiple slices once? #9051

Answered by scottyhq
forestbat asked this question in Q&A
Discussion options

You must be logged in to vote

selecting data from these slices became a difficult task——if I use foreach and xarray.merge to complete it,running speed will be bad.

There is really nothing inherently wrong with a for loop if it accomplishes what you need! The dataset in your example is quite small, but if you really are concerned with scalability here is some discussion that might be of interest https://discourse.pangeo.io/t/advice-for-scalable-raster-vector-extraction/4129/18

So how to read data from dataset quickly and elegantly?

The answer here depends on what you ultimately want to do with your subsets of data. Do you just want summary statistics? The Xvec library provides an elegant approach if you convert you…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by forestbat
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