home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 508743579 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

  • crusaderky 2

issue 1

  • Can apply_ufunc be used on arrays with different dimension sizes · 2 ✖

author_association 1

  • MEMBER 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
545140066 https://github.com/pydata/xarray/issues/3413#issuecomment-545140066 https://api.github.com/repos/pydata/xarray/issues/3413 MDEyOklzc3VlQ29tbWVudDU0NTE0MDA2Ng== crusaderky 6213168 2019-10-22T20:29:58Z 2019-10-22T20:29:58Z MEMBER

@jhamman are you happy to close the ticket?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Can apply_ufunc be used on arrays with different dimension sizes 508743579
544210342 https://github.com/pydata/xarray/issues/3413#issuecomment-544210342 https://api.github.com/repos/pydata/xarray/issues/3413 MDEyOklzc3VlQ29tbWVudDU0NDIxMDM0Mg== crusaderky 6213168 2019-10-20T01:06:27Z 2019-10-20T01:06:27Z MEMBER

It's working as intended.

apply_ufunc verifies that indices are aligned. Note the optional parameter join='exact'. You have two implicit pd.RangeIndex on dimension t that have a different number of elements - which means they are not aligned. Hence, when apply_ufunc internally calls xarray.align(Xda, yda, join="exact"), it falls over.

You have two options: 1. add join='outer' to the apply_ufunc call, which will cause the shorter of the two variables to be padded with NaNs. You'll also need to replace mean() with nanmean() in your kernel. This however is horribly inefficient. 2. rename one of the two dimensions to tell apply_ufunc that they aren't meant to be aligned:

python out = xr.apply_ufunc( diff_mean, Xda, yda.rename({"t": "t2"}), dask="parallelized", input_core_dims=[['t'], ['t2']], output_core_dims=[[]], output_dtypes=[np.float], )

While on the topic, note that vectorize=True is asking xarray to slice the numpy array, do a for loop in pure python applying your kernel multiple times, and then concatenate the output back together - that is, horribly slow. If you can avoid it, you should, and your kernel definitely can be changed to process arbitrary unknown dimensions:

python def diff_mean(X, y): assert X.shape[-1] != y.shape[-1] return X.mean(axis=-1) - y.mean(axis=-1)

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  Can apply_ufunc be used on arrays with different dimension sizes 508743579

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