home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1438733254

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/6772#issuecomment-1438733254 https://api.github.com/repos/pydata/xarray/issues/6772 1438733254 IC_kwDOAMm_X85VwVPG 14808389 2023-02-21T16:04:37Z 2023-02-21T16:04:37Z MEMBER

Apologies for letting this sit for so long.

The reason for the unexpected behavior seems to be that mean is implemented using sum / count: https://github.com/pydata/xarray/blob/21d86450b3cec595c74aa410cbcc367c9c7f8a0a/xarray/core/rolling.py#L176 https://github.com/pydata/xarray/blob/21d86450b3cec595c74aa410cbcc367c9c7f8a0a/xarray/core/rolling.py#L161-L163 where min_periods is applied in the sum (by masking values where count < min_periods).

However, sum on rolling objects will fill any missing values with 0 before doing anything else, so when the actual sum is computed skipna does not have any effect.

So if you were to set min_periods=1 you'd get the same result as what you'd expect while min_periods=3 is what you're seeing.

@pydata/xarray, any idea what to do here? Should we document that passing skipna does not have any effect on rolling window sums / means, or would it be better to change the implementation? Or maybe I'm missing something else?

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