Skip to content

DataArray .rolling() unclear behaviour when center=False #8958

Open
@juliencarponcy

Description

@juliencarponcy

What is your issue?

Hi,

I am using the rolling().construct() method which I found very convenient and efficient.

I had timeseries with 2 dimensions: time and channel. I used the construct to produce small overlapping windows of samples on all channels:

xr_data['full_windowed_eeg'] = xr_data['resampled_eeg'] \
							.rolling(resampled_time=window_size, min_periods=None) \
							.construct("window_tvec", stride=1, keep_attrs=True) \
							.dropna('resampled_time') \
							.rename({'resampled_time':'window_time'}).copy()

However, after not obtaining the result I expected, I found out that the new coord window_time, was corresponding to the original time coords at the end/right of the window, and not as the first time coord of the window as I expected.

There is no argument to specify this apparently, as in its current state, it allows only for taking the "center coord" or the "right coord" (if center=False).

I expect that the way I wanted it is not so uncommon, so implementing that possibility would be great. But more urgently, I would find it extremely useful and avoiding puzzling debbugging if this behaviour was clearly explained in the API reference.

But maybe I am missing something here?

Thanks for your great work !

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions