[sdba] Re-write of Extreme's adjustment#914
Conversation
|
One thing that gosses me here is that with dask we must know the dimension sizes before the computation. In the trained Secondly, I have implemented |
There was a problem hiding this comment.
- I've successfully compared the results from my Matlab code and this new PR. Extremes are the same. Differences exist for other values, but this is due to differences in the transfer function and the number of corrected values (different approach between this and the older code). In short: The fix seems good.
- My test fails when I have chunks. I'll send @aulemahal my code so we can further test it out and see if he has the same issues.
| # sort them in Px order, and pad to have N values. | ||
| order = np.argsort(Px_hist) | ||
| px_hist = np.pad(Px_hist[order], ((0, N - af.size),), constant_values=np.NaN) | ||
| af = np.pad(af[order], ((0, N - af.size),), constant_values=np.NaN) |
There was a problem hiding this comment.
constant_values=np.NaN causes NaNs to appear in the result of adjust if some values in sim are above max(Pcommon)
| af = np.pad(af[order], ((0, N - af.size),), constant_values=np.NaN) | |
| af = np.pad(af[order], ((0, N - af.size),), constant_values=af[order][-1]) |
There was a problem hiding this comment.
I got this fixed by tweaking extrapolate_qm and interp_on_quantiles to ignore NaNs.
Maybe @huard could have a look on these changes. I modified the output of extrapolate_qm in the case of method='nan' (not really related to this PR). And interp_on_quantiles now drops ANY NaNs in the inputs EXCEPT for those expected extrapolated bounds.
RondeauG
left a comment
There was a problem hiding this comment.
Fixes appear to be working as intended.
huard
left a comment
There was a problem hiding this comment.
Happy with the changes. Could you just confirm that these changes are exercised by the test suite ?
|
The last commit reactivates the Extreme's tests and removes a bit that was not necessarily true. The tests pass, but they don't do much more than checking if the method runs... I'm not sure of what to test? @RondeauG Are the algorithms close enough that we could compare an output from the matlab version to the one here? Not value by value, but something like a general change in the distributions... |
|
I'm happy to leave testing against a reference value to a future PR. I would maybe advertise the algo as experimental until then. |
…s/heat_index * 'indices/heat_index' of github.com:UCL/xclim: (42 commits) Added french metadata for heat index. Apply changes to fraction indicator [sdba] Re-write of Extreme's adjustment (Ouranosinc#914) update history Update history [Ouranosinc#931] Fix indicator for Rxxp index Add missing type for `threshold_count` Add dev notes - add indexer example - other small changes run all available tests in one call for slow builds update makefile target black, only install coveralls in tox if coveralls is needed Indexing within indicators (Ouranosinc#934) Update history finish needs doctests Remove unnecessary keep_attrs Adapt to CF conventions 1.9 - remove gregorian calendar (Ouranosinc#935) Bump version: 0.31.2-beta → 0.31.3-beta update HISTORY.rst suggested corrections Apply suggestions from code review Resampling indicator (Ouranosinc#927) ...
…es/wetday_prop * 'indices/wetday_prop' of github.com:UCL/xclim: (46 commits) Add moi-meme as 0.32 contributor do not redefine builtin next use array_almost_equal in tests Update history Improve quantile function Apply changes to fraction indicator [sdba] Re-write of Extreme's adjustment (Ouranosinc#914) update history Update history [Ouranosinc#931] Fix indicator for Rxxp index Add missing type for `threshold_count` Add dev notes - add indexer example - other small changes run all available tests in one call for slow builds update makefile target black, only install coveralls in tox if coveralls is needed Indexing within indicators (Ouranosinc#934) Update history finish needs doctests Remove unnecessary keep_attrs Adapt to CF conventions 1.9 - remove gregorian calendar (Ouranosinc#935) Bump version: 0.31.2-beta → 0.31.3-beta ...
…/xclim into indices/potential_evapotranspiration * 'indices/potential_evapotranspiration' of github.com:UCL/xclim: (52 commits) Fix usage notebook update history allow a few more special chars Fix a few issues on rxxp add PR number use xarray.apply_ufunc to simplify the vectorization of statistical functions Add moi-meme as 0.32 contributor do not redefine builtin next use array_almost_equal in tests Update history Improve quantile function Apply changes to fraction indicator [sdba] Re-write of Extreme's adjustment (Ouranosinc#914) update history Update history [Ouranosinc#931] Fix indicator for Rxxp index Add missing type for `threshold_count` Add dev notes - add indexer example - other small changes run all available tests in one call for slow builds update makefile target black, only install coveralls in tox if coveralls is needed ...
Pull Request Checklist:
number) and pull request (:pull:number) has been added.bumpversion patchhas been called on this branch.zenodo.jsonWhat kind of change does this PR introduce?
sdba.ExtremeValues, according to the Matlab version and comments from @RondeauG.Does this PR introduce a breaking change?
No, the
ExtremeValueswas hidden in previous versions.Other information:
I'm not sure what to test...