home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 170779798 and user = 1924092 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

  • chris-b1 · 2 ✖

issue 1

  • New function for applying vectorized functions for unlabeled arrays to xarray objects · 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
248957341 https://github.com/pydata/xarray/pull/964#issuecomment-248957341 https://api.github.com/repos/pydata/xarray/issues/964 MDEyOklzc3VlQ29tbWVudDI0ODk1NzM0MQ== chris-b1 1924092 2016-09-22T16:34:44Z 2016-09-22T16:34:44Z MEMBER

@shoyer - I agree on 3) that it might too much to pack in to xr.apply. As one possibility, here's a half-implemented (probably buggy!) wrapper that would allow this:

``` python @xarray_gufunc @numba.guvectorize(['void(f8[:], f8[:])'], '(n)->()') def std_gufunc(arr, out): out[0] = np.std(arr)

std_gufunc(arr, dims=('x',)) ```

https://gist.github.com/chris-b1/d28c6b8e78bf65ef7eb97e1095bc87f2

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New function for applying vectorized functions for unlabeled arrays to xarray objects 170779798
248772865 https://github.com/pydata/xarray/pull/964#issuecomment-248772865 https://api.github.com/repos/pydata/xarray/issues/964 MDEyOklzc3VlQ29tbWVudDI0ODc3Mjg2NQ== chris-b1 1924092 2016-09-21T23:28:55Z 2016-09-21T23:28:55Z MEMBER

A few pieces of feedback trying this out. I'm basically learning xarray as I go (I ran into this right away), so weight appropriately.

Usecase - I have a numba gufunc I want to apply to DataArray, e.g. a reduction like this (std is just for sake of example)

``` @numba.guvectorize(['void(f8[:], f8[:])'], '(n)->()') def std_gufunc(arr, out): out[0] = np.std(arr)

arr = xr.DataArray(np.random.randn(100, 100, 100), dims=('x', 'y', 'z')) ```

1) The "obvious" thing doesn't work - maybe catch and show a nicer error message here

xr.apply(std_gufunc, arr) ValueError: dimensions ('x', 'y', 'z') must have the same length as the number of data dimensions, ndim=2

2) I personally found the non-string version of signature really difficult to wrap my mind around (the below took several tries to get right). I don't have a concrete suggestion though, maybe only the string form is meant to really be the public api?

xr.apply(std_gufunc, arr, signature=([('x',)], [()])) xr.apply(std_gufunc, arr, signature='(x)->()')

3) It would be nice to take advantage of the existing gufunc signature in some way. Maybe this is a wrapper built on top or xr.apply, or expand the api to allow something like this;

xr.apply(std_gufunc, arr, dims=('x',)) xr.apply(std_gufunc, arr, dims={'n':'x'})

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  New function for applying vectorized functions for unlabeled arrays to xarray objects 170779798

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