home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1244634332

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/7021#issuecomment-1244634332 https://api.github.com/repos/pydata/xarray/issues/7021 1244634332 IC_kwDOAMm_X85KL5zc 39671216 2022-09-12T22:39:35Z 2022-09-12T22:42:11Z CONTRIBUTOR

Thanks for the report & I agree that this should lead to the same but the code paths are indeed different - but I have not looked in to the actual root cause. Could be that this is also not super thoroughly tested (and used!):

https://github.com/pydata/xarray/blob/b018442c8dfa3e71ec35e294de69e2011949afec/xarray/core/rolling.py#L289

https://github.com/pydata/xarray/blob/b018442c8dfa3e71ec35e294de69e2011949afec/xarray/core/rolling.py#L721

B.t.w. a copy-pastable example would be appreciated.

Thanks for the response, here is a straightforward example.

python import xarray as xr dummy = list(range(100)) x, y, z = [xr.DataArray(dummy, dims=['t']) for _ in range(3)] ds = xr.Dataset( {'x': x, 'y': y, 'z': z} ) print(x.rolling(t=4).construct('w', stride=4).shape) print(ds.rolling(t=4).construct('w', stride=4).x.shape) Results: ```

(25, 4) (7, 4) ```

I had a hunch that the problem come from this part - not quite sure what self._mapping_to_list did here, haven't look it up yet. https://github.com/pydata/xarray/blob/b018442c8dfa3e71ec35e294de69e2011949afec/xarray/core/rolling.py#L764-L772

Since I only had one dimension to deal with, removing this loop solves the problem for me.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1370063272
Powered by Datasette · Queries took 0.633ms · About: xarray-datasette