Enable taking the mean of dask-backed cftime arrays#6940
Enable taking the mean of dask-backed cftime arrays#6940dcherian merged 11 commits intopydata:mainfrom
Conversation
|
Ah, this still didn't quite work for older dask versions: Details
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.
nice! Thanks for making extra sure that we didn't compute the whole thing.
mathause
left a comment
There was a problem hiding this comment.
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_secondswas 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