Skip to content
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() method to drop obs/mod/variable (reverse sel) #451

Open
jsmariegaard opened this issue Oct 13, 2024 · 3 comments · May be fixed by #460
Open

drop() method to drop obs/mod/variable (reverse sel) #451

jsmariegaard opened this issue Oct 13, 2024 · 3 comments · May be fixed by #460
Assignees
Labels
enhancement New feature or request

Comments

@jsmariegaard
Copy link
Member

pandas and xarray allow users to drop part of the dataset with a drop method - see e.g. https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.drop.html. Which is opposite to sel() but should have the same syntax. The drop method should return a new Comparer or ComparerCollection with all data except the dropped.

Two new methods should be added to Comparer and ComparerCollection, respectively, both named drop(). Add them below sel() method

and

@jsmariegaard jsmariegaard added the enhancement New feature or request label Oct 13, 2024
@ryan-kipawa ryan-kipawa linked a pull request Oct 24, 2024 that will close this issue
@ryan-kipawa
Copy link
Collaborator

Dropping models, obs, and variables seems straightforward. What's a bit less clear is dropping according to the other arguments of sel():

  • start : do we interpret as drop all time values after this time? is it needed? (could also refer users to use sel)
  • end: do we interpret as drop all time values before this time? (could also refer users to use sel)
  • time: do we interpret as drop this specific time, but keep all others? is it needed?
  • area: do we interpret as keep everything outside of this area? is it needed?

I started #460 where I'll add the possibility to drop obs, models, and variables. Do you think the other ones are equally as important to add?

@ecomodeller
Copy link
Member

xarray.Dataset.drop discourages the use of drop in favor of drop_vars and drop_sel, probably because of the potential confusion of dropping both rows or columns with the same method.

@jsmariegaard
Copy link
Member Author

I don't think you will need to drop time or area in the same way as specific modelresults or observations so let's just do obs, models, and variables. I would prefer to keep the name drop() though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants