-
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
sdba - Grouped detrending #467
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
huard
reviewed
May 28, 2020
huard
requested changes
May 28, 2020
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 suggest adding tests. Otherwise it looks fine.
Pull Request Test Coverage Report for Build 1974
💛 - Coveralls |
This was referenced May 29, 2020
Open
huard
approved these changes
Jun 4, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
bumpversion (minor / major / patch)
has been called on this branchgit push --tags
)All detrending is now made using the
Grouper
class of sdba. The BaseDetrend exposed methods callgroup.apply()
with the_fit
and_get_trend
methods of the subclasses.Performance could be lower for simple detrendings. To code it as elegantly as I could, I didn't code shortcuts. When calling
fit
, the_fit(da)
method returns a grouped dataset. This dataset is broadcasted back along the 'time' coordinate of the dataarray to detrend and then grouped again for the trend computation (which is a non-grouping grouped operation). For something as simple asMeanDetrend
it's a lot of overhead...Yes, in order to achieve this as elegantly as I could, I removed the resampling possibility of
PolyDetrend
. It could be put back, but it's slightly more complicated. Watcha think @huard?Results of DQM might be different between this new method and the previous one.
EDIT: Comment on the performance
Might not work with the current master of xarray : calling
polyfit
on an element fromgroupby
could throw some errors that should be fixed with Allow non-unique and non-monotonic coordinates in get_clean_interp_index and polyfit pydata/xarray#4099.