-
Notifications
You must be signed in to change notification settings - Fork 0
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
Remove unit registry, use cf-xarray's or any other. #57
base: main
Are you sure you want to change the base?
Conversation
Welcome, new contributor! It appears that this is your first Pull Request. To give credit where it's due, we ask that you add your information to the
Please make sure you've read our contributing guide. We look forward to reviewing your Pull Request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, a lot cleaner!
Example added to the "usage" page! |
Pull Request Checklist:
number
) and pull request (:pull:number
) has been added.What kind of change does this PR introduce?
cf-xarray
, but starting with xclim 0.55, once xclim is imported it will be xclim's.Quantity.magnitude
is a zero-dim array, but we expect a float. I cast them explicitly everywhere we handle this.cf
unit formatter is created but not set as default bycf-xarray
. I explicitly use it everywhere we cast to string.pct
for "percent" as this is not CF and not supported by cf-xarray.As we still expect CF outputs, this is not completely agnostic : the unit registry used must come from cf-xarray. But it does allow to use the one from xclim.
Does this PR introduce a breaking change?
Shouldn't.
Other information:
Once Ouranosinc/xclim#2040 is merged a simple
import xclim
should activate xclim's registry. Then, using the hydro context would look like:I will be adding a doc example soon.