-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Enable taking the mean of dask-backed cftime arrays #6940
Conversation
Ah, this still didn't quite work for older dask versions:
This appears to be the commit that fixed this issue in dask, meaning it should be fixed as of dask version 2021.07.0:
|
Thanks @spencerkclark
It looks like we can bump to 2021.08.0 instead of dealing with this compatibility code. |
Thanks for noting this @dcherian. I wasn't sure if this was worth bumping our minimum version for, but since our policy allows for it, I'm happy to make that change. |
result = da_2d.mean() | ||
with raise_if_dask_computes(max_computes=1): | ||
result = da_2d.mean() | ||
assert_dask_array(result, dask) |
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.
nice! Thanks for making extra sure that we didn't compute the whole thing.
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!
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.
Looks good - can you merge master to fix the merge conflict?
This was essentially enabled by @dcherian in #6556, but we did not remove the error that prevented computing the mean of a dask-backed cftime array. This PR removes that error, and adds some tests. One minor modification in
_timedelta_to_seconds
was needed for compatibility with scalar cftime arrays.This happens to address the second part of #5897, so I added a regression test for that. It seems like we decided to simply document the behavior in the first part (#5898, dcherian@99bfe12), but I'm not sure if we intend to change that behavior eventually or not.
whats-new.rst