I have an xarray dataset that I would like to index using boolean indexing as I would with Pandas. For example, I have a pandas dataframe:
A B C
5 1 0
4 1 0
3 5 0
4 3 0
5 2 0
And I want only rows where the value in B is greater than 2, like this:
df = df[df['B'] > 2]
would give
A B C
3 5 0
4 3 0
How could I do the same operation in xarray for an xarray dataset?
https://docs.xarray.dev/en/stable/user-guide/indexing.html#masking-with-where
i think you are looking for this