Skip to content

drop keyword in ds.rolling(time=7, drop=True).mean()? #4588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ahuang11 opened this issue Nov 16, 2020 · 4 comments
Closed

drop keyword in ds.rolling(time=7, drop=True).mean()? #4588

ahuang11 opened this issue Nov 16, 2020 · 4 comments

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Nov 16, 2020

Should rolling have a drop keyword, similar to squeeze(drop=True)?

import xarray as xr
air = xr.tutorial.open_dataset('air_temperature')
air = air.rolling(time=7, drop=True).mean()

Equivalent:

import xarray as xr
air = xr.tutorial.open_dataset('air_temperature')
air = air.rolling(time=7).mean()
air = air.isel(time=slice(6, None))

Actual implementation will require considering min_period / center=True too

@ahuang11 ahuang11 changed the title drop keyword in ds.rolling(drop=True).mean()? drop keyword in ds.rolling(time=7, drop=True).mean()? Nov 16, 2020
@mathause
Copy link
Collaborator

This is not something I would expect or miss so knowing your use-case would be helpful. Just as a word of caution, the implementation of rolling is a bit convoluted, so this may take a bit of effort.

@dcherian
Copy link
Contributor

Do you want to avoid the padding?

@ahuang11
Copy link
Contributor Author

ahuang11 commented Feb 18, 2021 via email

@dcherian
Copy link
Contributor

Thanks. Closing as duplicate of #2007. I have a solution in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants