home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 572556658

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/3671#issuecomment-572556658 https://api.github.com/repos/pydata/xarray/issues/3671 572556658 MDEyOklzc3VlQ29tbWVudDU3MjU1NjY1OA== 12862013 2020-01-09T13:17:29Z 2020-01-09T13:17:29Z CONTRIBUTOR

Small update:

I was currently using: data = ( data.rolling(x=window_size ).construct("roll_x") .rolling(y=window_size ).construct("roll_y") .isel(x=slice(window_size - 1, None, stride), y=slice(window_size - 1, None, stride)) .stack(n=("x", "y")) )

but this was performing quite badly for larger arrays. However after having a look at DataArrayRolling and rewriting this piece of code to the following, performance was good.

data = ( data.rolling(x=window_size ).construct("roll_x") .isel(x=slice(window_size - 1, None, stride)) .rolling(y=window_size ).construct("roll_y") .isel(y=slice(window_size - 1, None, stride)) .stack(n=("x", "y")) )

I saw that DataArrayRolling.construct() also uses a slice (isel) to create the strided array, so there is not much of a performance penalty of first creating a rolling window with stride 1 and then slicing the data.

However, if you want to add strides to the 'Strided rolling' (#3607) it would be nice to still be able to create rolling windows that start at index 0.

By the way: feel free to close this issue, if you do not see a need for an alignment option.

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