home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 594669577 and user = 14314623 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 1

  • jbusecke · 1 ✖

issue 1

  • compose weighted with groupby, coarsen, resample, rolling etc. · 1 ✖

author_association 1

  • CONTRIBUTOR 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1233445643 https://github.com/pydata/xarray/issues/3937#issuecomment-1233445643 https://api.github.com/repos/pydata/xarray/issues/3937 IC_kwDOAMm_X85JhOML jbusecke 14314623 2022-08-31T21:36:51Z 2022-08-31T21:36:51Z CONTRIBUTOR

I am interested in the coarsen with weights scenario that @dcherian and @mathause described here for a current project of ours.

I solved the issue manually and its not that hard ```python import xarray as xr import numpy as np

example data with weights

data = np.arange(16).reshape(4,4).astype(float)

add some nans

data[2,2] = np.nan data[1,1] = np.nan

create some simple weights

weights = np.repeat(np.array([[1,2,1,3]]).T, 4, axis=1) weights

da = xr.DataArray(data, dims=['x', 'y'], coords={'w':(['x','y'], weights)}) da ```

python masked_weights = da.w.where(~np.isnan(da)) # .weighted() already knows how to do this da_weighted = da * masked_weights da_coarse = da_weighted.coarsen(x=2, y=2).sum() / masked_weights.coarsen(x=2, y=2).sum() da_coarse

but I feel all of this is duplicating existing functionality (e.g. the masking of weights based on nans in the data) and might be sensibly streamlined into something like: python da.weighted(da.w).coarsen(...).mean() at least from a user perspective (there might be unique challenges with the implementation that I am overlooking here).

Happy to help but would definitely need some guidance on this one.

I do believe that this would provide a very useful functionality for many folks who work with curvilinear grids and want to prototype things that depend on some sort of scale reduction (coarsening).

Also cc'ing @TomNicholas who is involved in the same project 🤗

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  compose weighted with groupby, coarsen, resample, rolling etc. 594669577

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 2961.159ms · About: xarray-datasette