Add a roll function for Dask Arrays#2135
Conversation
|
This looks good to me. cc @shoyer does this allow you to drop logic from xarray? |
|
|
||
| result = concatenate([result[sl1], result[sl2]], axis=i) | ||
|
|
||
| result = result.reshape(array.shape) |
There was a problem hiding this comment.
Side note: This is only needed for the case where axis is None. It should be a no-op everywhere else. Seems cleaner to not have a branch here. Though I don't know if this gets optimized out by Dask or not in the no-op cases. Just figured I'd mention it.
There was a problem hiding this comment.
Dask.array doesn't optimize this out currently. It would be good to add the check either here or in reshape.
There was a problem hiding this comment.
Adding the check in reshape seems better IMHO.
There was a problem hiding this comment.
PR ( #2137 ) adds this optimization and tests for it as well.
|
Yes, we currently have very similar logic for |
Provides a function that performs the same operation as NumPy's roll except on Dask Arrays. This is done by using a mixture of slicing and concatenating. The effect is a Dask Array that is either raveled, rolled, and reshaped or rolled along specified axes. Added a few tests and added the function to the API doc.
|
Thanks @jakirkham ! |
Fixes #2132
Provides a function that performs the same operation as NumPy's roll except on Dask Arrays. This is done by using a mixture of slicing and concatenating. The effect is a Dask Array that is either raveled, rolled, and reshaped or rolled along specified axes. Added a few tests and added the function to the API doc.