Remove all values from xarray based on values of another list. #7417
Answered
by
jhamman
sagunkayastha
asked this question in
Q&A
-
I have a xarray DataArray with shape(1500,1600) read from a (MODIS data) netcdf file. I have another list with QA values [0, 1,23,45..] . I can perform the task looping through the list and then removing one at a time. I was wondering if there is a better way to do this? Thank you. |
Beta Was this translation helpful? Give feedback.
Answered by
jhamman
Jan 4, 2023
Replies: 1 comment 1 reply
-
You can use da.where(~da.isin([0, 1,23,45, ...])) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
sagunkayastha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use
DataArray.isin
for this: