-
Notifications
You must be signed in to change notification settings - Fork 41
set_options is applied on init, not enter #300
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
Comments
Unrelated to the bug, but it would be cool to be able to apply these options persistently to a particular dataset, to avoid needing a |
Ah thanks for the report. we intended (see https://cf-xarray.readthedocs.io/en/latest/custom-criteria.html ) with set_options(...)
ds_1.cf.<something> But I'll look into For persistence, we'd have to store your criteria in |
For prioritization, I'm not a current user. If this is hard and not generally useful, don't worry about it. If I were to be a user, we work with datasets from different sources that break CF conventions in different ways. I'd like to be able to specify for each dataset what ways it breaks CF conventions, and not have to worry about potential interactions between dataset configurations if I were to merge all exceptions for all our data sources into one configuration. In other words, there's a one to one map between the exceptions we want to be made and the dataset we're operating on. A "standardize" method that retrieves a new xarray dataset with everything CF compliant might be a good way to support this use case. I could convert each dataset using a different context manager, and not worry about differences between datasets from that point forward. |
Really nice stuff! I'm not impacted by this, but I noticed a bug. In the following example, I would expect corresponding options to be applied to operations on their corresponding datasets. Currently, as I understand
set_options
, ds_2_options will be used for bothds_1
calls, and neither context manager will be used for theds_2
call.I believe the fix would involve writing a test like the above example and moving the
init
code intoenter
.The text was updated successfully, but these errors were encountered: