Fix conversion of units of multivariate DataArray in sdba #1972
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Checklist:
number
) and pull request (:pull:number
) has been addedWhat kind of change does this PR introduce?
Conversion of units of multivariate DataArray is now properly handled
sdba.TrainAdjust
andsdba.Adjust
. There was a bug where the units could be changed before a conversion of the magntitudes could occur.e.g.
hist
would be converted toref
units properly, and then, the units ofsim
would be changed too, without any actual conversion taking place. This may have something to do with the weirdness of Generators.Does this PR introduce a breaking change?
No
Other information:
Just to show where I'm getting at, you can test:
You can see that
scen_tasmax
~ 15 with the new xclim, as it should, it's reasonable temperature for degC, but with old xclim it's aroundscen_tasmax
~282, clearly still magnitudes of K. This happens because internally, the units ofsim
were changed, but the values were not converted.