-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drop all but specified data_variables/coordinates as a convenience function #2884
Comments
Something that is currently possible, though perhaps not super well-documented, is |
@jbusecke Can you send in a PR to update the docs? https://xarray.pydata.org/en/stable/data-structures.html#dataset |
I'm pretty sure there's an issue request somewhere to add |
Wow. Thats awesome. Had no clue about it. I will put in a PR for the docs for sure. Might take a bit though. |
Ok I have submitted a PR for the @dcherian, I was not able to find that issue you mentioned. I would certainly be interested to have a look in the future. |
I often work with datasets that consist out of a lot of data_variables and coordinates.
Often I am only concerned about a subset of variables, and for convenience drop all but a selected list of variables with a little snippet like this:
Code Sample, a copy-pastable example if possible
I would love to have this functionality available as a DataArray/Dataset function. It could look something like
da_slim = da.drop_all_but(['var1, 'var3'])
. Would this be of interest to people here? Then I could try to put in a PR.The text was updated successfully, but these errors were encountered: