-
Notifications
You must be signed in to change notification settings - Fork 64
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
Update history, refactor sdba processing functions, add unit handling in sdba #801
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Remind me why we decided to have |
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.
How confident are you that our test coverage would have picked potential errors introduced in this PR?
From experience, it's easy to break unit handling, and tests were not initially covered to check this. You added unit related checks, but how tight are we overall ?
Co-authored-by: David Huard <[email protected]>
Co-authored-by: David Huard <[email protected]>
We decided to use As for the tests, I did add more, but you are right that it's always a tricky question. Failures and bugs in the attributes will not always trigger test failures... I plan to add a bit more. |
@Zeitsperre I'd like to hear your opinion on a change from I think this PR as revealed a faille in our logic of being CF-orthodox and not using |
This is true. We should be at the very least appending some general summary of actions taken to the
From my understanding, because it isn't flagged as a variable attribute means that we are free to do it. Try adding a |
Very small point, but the Notes docstring for |
So I changed "xclim_history" to "history" throughout xclim! This is not super-breaking, but kinda.
now:
If the indicator was from a virtual module, the module name would be appended in the call string (ex: Applies also to ensembles percentiles and stats, |
@Zeitsperre
|
That's exactly what we should expect. LGTM. |
I'm turning crazy soon. The sdba notebook compiles with a failure on the first try, but passes on the second try... |
This actually sounds insane, by Einstein's definition anyway. I'll give it a try as well. |
Works for me on the first try. It may have to do with the |
🤯 So I copied only this example in a new script and ran it 7 times. At the start, I deleted the xclim testing data and the script's output. Between trial 3 and 4, I modified the code to have some more info in the traceback (the algo was untouched).
Funny, eh? EDIT: The |
What is going on?! This is really strange behaviour. Any information from the trace back (is it different from the |
I could get the following info:
Thus, it seems that, at random moments, the last matrix multiplication of EDIT: It may be obvious, but writing it to be sure : this only happens when dask is used, |
Added an explicit setting of units to all ADJ inputs. And a comment to note that it is weird. |
Now, that's more interesting, a real error! My bad. |
Pull Request Checklist:
bumpversion (major / minor / patch)
has been called on this branchgit push --tags
).zenodo.json
What kind of change does this PR introduce?
map_blocks
is used. This applies toprocessing.py
. This also changed the signature of the concerned functions, so that they get an explicit one.xclim_history
attribute through a new@update_xclim_history
decorator. Decorated functions will have a correctly formattedxclim_history
attribute added to their first output.Does this PR introduce a breaking change?
Yes. Signature of
adapt_freq
,jitter_under_thresh
and others has changed. All variables are given as DataArrays (no more dataset as input) and threshold are given as quantities, so strings, not numbers.Other information:
We have a naming problem with the
xclim_history
attribute. Currently, theupdate_history
function will take the inputs and merge their history attributes. Then we take it and put it inxclim_history
. If a variable has been modified before by xclim, thexclim_history
attribute is overwritten, not appended. Should we go back tohistory
to make it simpler? @Zeitsperre @huard This applies to the indicators too!