-
-
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
Adding cumsum / cumprod reduction operators #791
Comments
Advice on the feasibility of adding cumsum / cumprod appreciated. |
I don't think this should be too difficult now that cumulative reductions are available in dask and numpy. I think you'll just have to add the |
It may be more involved, e.g., there appears to be a custom |
You are correct that it shouldn't be too difficult. |
Note, numpy doesn't provide |
There was no particular reason why I didn't add these before -- we just never had a compelling enough need to get around to it. I don't think it would be particularly difficult. |
@shoyer, should a custom version supporting nans be implemented too? I think that is more useful for my immediate needs and it would be good to have both options for completeness. However, it will be somewhat of a hack and involve adding Can you provide some perspective on what you would be willing to admit into xarray? It seems like standard |
Why not make a PR to add |
@shoyer and @jhamman, I've started a branch to address this at https://github.com/pwolfram/xarray/tree/add_cumsum_cumprod, but there appear to be some other issues that may need resolved prior to this implementation, e.g., #807. Also, 2 quick new developer questions:
I suspect there is a simple way to do these things but would appreciate hearing about your workflows. Thanks! |
We all may have slightly different development workflows but mine goes something like this: # checkout conda environment with xarray dependencies
source activate xarray_dev34
cd path_to_xarray
# install xarray using setuptools develop option
python setup.py develop
# make changes to source code
# run test suite
py.test |
Thanks @jhamman! |
Please see #812 for the PR stub. Note, I still need to work on this when I get some time. |
It would be useful to have the cumsum / cumprod reduction operator for DataArray and Dataset, analagous to http://xarray.pydata.org/en/stable/generated/xarray.DataArray.sum.html?highlight=sum#xarray.DataArray.sum
and http://xarray.pydata.org/en/stable/generated/xarray.Dataset.sum.html?highlight=sum#xarray.Dataset.sum
I notice this is on the TODO at https://github.com/pydata/xarray/blob/master/xarray/core/ops.py#L54 and am assuming there is something subtle here about the implementation. I believe the issue was probably with dask, but the issue / PR at dask/dask#923 & dask/dask#925 may have removed the roadblock.
The text was updated successfully, but these errors were encountered: