-
-
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
cumsum drops index coordinates #6528
Comments
Lines 5239 to 5240 in 7173bd3
If you comment out this if-check so it always add the variable at least the example seems to work. Not sure how to handle this:
|
👍 I think we should add cumsum to |
There was some discussion a while ago about how to handle |
…oved potential solution to pydata#6528.
* Added file to generate docs for cumulatives. generate_cumulatives.py creates _cumulatives.py * Fixed mypy issues * Updated cumulatives to fix mypy issues * Added keep_attrs to groupby funcs * Combined cumulatives and reductions and aggregations and modified dataset cumulative functions. * Merged cumulatives and reductions into aggregations * Removed test print from dataset.py * Removed generate_cumulatives and generate_reductions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Updated _aggregations with docstring changes * Updated generate_aggregations.py with suggestions from @dcherian. Removed potential solution to #6528. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removed unecessary function from dataset.py * Removed unecessary function from dataset.py * Updated api.rst, whats-new.rst and added a cumprod test to test_groupby.py * Fixed accidental edit to test_dataset.py * Apply suggestions from code review * Merge and rename reductions and cumulatives to aggregations * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * minor tweaks * Update computation.py * Update generate_aggregations.py * Update .pre-commit-config.yaml * fix mypy * use _group_dim in resample? * Update resample.py * Manually fix docstring * Apply suggestions from code review Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> * Use TEMPLATE_SEE_ALSO * use default example * add resample test * remove cumulative function in ops * Revert "remove cumulative function in ops" This reverts commit 66e7390. * Add numeric_only=True Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Illviljan <14371165+Illviljan@users.noreply.github.com> Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com>
I had a look at moving this to Instead, it's a function that we've written which can execute over multiple dimensions xarray/xarray/core/duck_array_ops.py Lines 621 to 631 in c9d89e2
|
Another alternative is to focus on |
Can we just redirect |
I looked at this but it has slightly more features such as |
fwiw, I just tested this with a 33 MB
is anywhere from 18 to 30x faster than
|
@jhollowed, is that the first invocation? If you have a repro then happy to investigate, would be a big deal if that's real. Footnotes
|
@max-sixty No, it's not just the first invocation, from what I can tell. The repo in question is a mess, but here's a minimal working example which mimics my use case:
In this example the difference is even more extreme, with a ~50x slowdown by using I tried to also save the return of If I'm making a mistake or have an obvious misunderstanding please let me know. This is perhaps veering off-topic for this issue, but long story short, I just ended up using |
FWIW you may also want to use something like |
@max-sixty Interesting.
and
yield I'm working on a login node of a cluster with many users, so I'm not totally in control of the context I'm running in. But my conda env looks like this. |
Ah, OK, neither FWIW we're considering including In the meantime, you might want to add |
Given we now have a reference to I thought about whether we should add a warning for |
The core |
Agree; I closed since it seems unlikely we'll fix. But great if there's a path. We could deprecate the |
What happened?
cumsum drops index coordinates. Seen in #6525, #3417
What did you expect to happen?
Preserve index coordinates
Minimal Complete Verifiable Example
Relevant log output
No response
Anything else we need to know?
No response
Environment
xarray main
The text was updated successfully, but these errors were encountered: