home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where issue = 546791416 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 2

  • fujiisoup 2
  • mark-boer 2

author_association 2

  • CONTRIBUTOR 2
  • MEMBER 2

issue 1

  • rolling.construct alignment · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
573270896 https://github.com/pydata/xarray/issues/3671#issuecomment-573270896 https://api.github.com/repos/pydata/xarray/issues/3671 MDEyOklzc3VlQ29tbWVudDU3MzI3MDg5Ng== fujiisoup 6815844 2020-01-11T02:24:19Z 2020-01-11T02:24:19Z MEMBER

But I mistakenly thought that there was a performance penalty to doing this.

Yes, construct(stride=2) does exactly the same thing before returning an array. https://github.com/pydata/xarray/blob/ff75081304eb2e2784dcb229cc48a532da557896/xarray/core/rolling.py#L242

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rolling.construct alignment 546791416
572931220 https://github.com/pydata/xarray/issues/3671#issuecomment-572931220 https://api.github.com/repos/pydata/xarray/issues/3671 MDEyOklzc3VlQ29tbWVudDU3MjkzMTIyMA== mark-boer 12862013 2020-01-10T08:40:35Z 2020-01-10T08:40:35Z CONTRIBUTOR

Hi @fujiisoup, thx for your response.

That is exactly what I needed and what I used to do. But I mistakenly thought that there was a performance penalty to doing this. But the performance decrease turned out to be the result of the order in which I rolled and sliced.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rolling.construct alignment 546791416
572718436 https://github.com/pydata/xarray/issues/3671#issuecomment-572718436 https://api.github.com/repos/pydata/xarray/issues/3671 MDEyOklzc3VlQ29tbWVudDU3MjcxODQzNg== fujiisoup 6815844 2020-01-09T19:32:29Z 2020-01-09T19:32:29Z MEMBER

Hi @mark-boer for raising an issue. I am not sure if I got the point exactly, but the following is similar to what you want? python In [81]: arr = xr.DataArray(np.arange(4), dims=("x",)) ...: arr.rolling(x=2).construct("roll_x").isel(x=slice(1, None, 2)) Out[81]: <xarray.DataArray (x: 2, roll_x: 2)> array([[0., 1.], [2., 3.]]) Dimensions without coordinates: x, roll_x

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  rolling.construct alignment 546791416
572556658 https://github.com/pydata/xarray/issues/3671#issuecomment-572556658 https://api.github.com/repos/pydata/xarray/issues/3671 MDEyOklzc3VlQ29tbWVudDU3MjU1NjY1OA== mark-boer 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
}
  rolling.construct alignment 546791416

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 12.212ms · About: xarray-datasette