[feature request] __iter__() for rolling-window on datasets
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.2k
- Forks
- 1.4k
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 14
Description
Currently, rolling() on a dataset does not return an iterator:
MCVE Code Sample
arr = xr.DataArray(np.arange(0, 7.5, 0.5).reshape(3, 5),
dims=('x', 'y'))
r = arr.to_dataset(name="test").rolling(y=3)
for label, arr_window in r:
print(label)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-b1703cb71c1e> in <module>
3
4 r = arr.to_dataset(name="test").rolling(y=3)
----> 5 for label, arr_window in r:
6 print(label)
TypeError: 'DatasetRolling' object is not iterable
Output of xr.show_versions()
xarray: 0.13.0
pandas: 0.24.2
numpy: 1.16.4
scipy: 1.3.0
netCDF4: None
pydap: None
h5netcdf: 0.7.4
h5py: 2.9.0
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2.1.0
distributed: 2.1.0
matplotlib: 3.1.1
cartopy: None
seaborn: 0.9.0
numbagg: None
setuptools: 41.4.0
pip: 19.1.1
conda: None
pytest: None
IPython: 7.8.0
sphinx: None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Dataset.rolling() entry point and the DatasetRolling object shown in the MCVE, then reproduce the example in a development environment. Done means iterating over the rolling result works and yields the label and window demonstrated by the requested loop; add focused coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100