pydata / pydata/xarray

Feature Request: Efficient rolling with strides

Open
#3,608 8 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

topic-rolling
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

Xarray is facing the same issues in its current rolling implementation (DataArrayRolling and DatasetRolling) as described in this pandas issue. Namely, the construct methods stride parameter is applied after the rolling is computed. Technically, we are computing more than we would need to because we partially throwing it away due to striding.

In PR #3607 the issue is solved for the ...Rolling's __iter__ function but not for the construct, reduce and _bottleneck_reduce methods.
Since the way Xarray's rolling is implemented relies on numpy, we could introduce a sliding window function as described here.

Any opinions?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the rolling implementation for DataArrayRolling and DatasetRolling, then compare the strided iter work in PR #3607 with construct, reduce, and _bottleneck_reduce. Review the linked pandas and NumPy discussions before choosing an approach. Done means rolling windows avoid computing values discarded by construct or reduction strides, with the affected behavior covered by the existing rolling tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, python
Domain
data, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.