-
Notifications
You must be signed in to change notification settings - Fork 300
Update RMS aggregator with lazy function #3130
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
Conversation
| def test_masked(self): | ||
| # Masked entries should be completely ignored. | ||
| data = as_lazy_data(ma.array([5, 10, 2, 11, 6, 4], | ||
| mask=[False, True, False, True, False, False], |
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.
E128 continuation line under-indented for visual indent
pelson
left a comment
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.
LGTM
lib/iris/analysis/__init__.py
Outdated
| # However `da.average` current doesn't handle masked weights correctly | ||
| # (see https://github.com/dask/dask/issues/3846). | ||
| # To work around this we use da.mean, which doesn't support weights at | ||
| # all, so we raise an error rather than silently giving the wrong answer. |
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.
Where is the error being raised? Is that caused by passing invalid kwargs through to da.mean?
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.
@pelson apologies, that comment isn't that clear on re-reading. But you're right, the error comes from da.mean receiving a bad kwarg:
TypeError: mean() got an unexpected keyword argument 'weights'
I'll improve the wording of the comment.
corinnebosley
left a comment
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.
@dkillick This is very lovely. Your comments are informative and helpful; your tests are clean, simple and well structured, good job all round.
Adds a lazy aggregation function to the RMS aggregator, which makes use of dask functionality to build the RMS equation.
Note that currently this does not allow lazy weighted RMS aggregation when the input is also masked. This is in place because there appears to be a limitation in
da.average, which means the weights array is not masked to match the input data.Ping @niallrobinson - with thanks for raising the fact the RMS aggregator wasn't lazy, and for pairing on this update.