-
Notifications
You must be signed in to change notification settings - Fork 59
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
Explicit context information for unit conversion #1227
Conversation
…on] dimension. Added explicit unit conversion context.
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.
I find it non-ideal that the solution is as verbose as it is, but that's the current state of xclim's context management. And at least it is explicit.
I also added some conditions for infer_context
, as well as a test for it!
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@huard I added the option to pass |
@Zeitsperre It hung here too, so I simply commented it out. |
This is really mysterious... I have a theory on what it could be but will explore more. |
Co-authored-by: David Huard <huard.david@ouranos.ca>
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
infer_context
function to encapsulate the logic determining context when not explicit (e.g. generic indices, datachecks, etc.)Does this PR introduce a breaking change?
Things that worked out of the box by assuming the hydro context applied to every xclim operation will break. A bit more care needs to be taken when writing indices, especially generic ones, to handle unit conversion correctly.
Other information: