-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Use cumsum from flox #10987
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
base: main
Are you sure you want to change the base?
Use cumsum from flox #10987
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Co-authored-by: Deepak Cherian <[email protected]>
for more information, see https://pre-commit.ci
| **kwargs, | ||
| ) | ||
|
|
||
| # Prefer Dataset.func(...) over Dataset.reduce(func, ...): |
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.
why is this needed
cc @TomNicholas
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.
Because of #6528 and #10987 (comment). Since the problem of Datasets dropping the coords is solved in .cumsum in this PR, DataTree must also use ds.cumsum instead of ds.reduce("cumsum") in order to avoid dropping the coordinates.
| ) | ||
| @pytest.mark.parametrize("func", ["cumsum", "cumprod"]) | ||
| def test_reduce_cumsum_test_dims(self, reduct, expected, func) -> None: | ||
| def test_reduce_cumsum_test_dims(self, reduct, func) -> None: |
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.
can we also assert that coordinates & indexes are preserved please
| with xr.set_options(use_flox=use_flox): | ||
| if use_dask: | ||
| ds = ds.chunk() | ||
| if use_lazy_group_idx: |
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.
this is always False
whats-new.rstapi.rstThe non-flox version reduces chunksizes significantly:
With flox the chunksize is retained: