home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 248772865

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/pull/964#issuecomment-248772865 https://api.github.com/repos/pydata/xarray/issues/964 248772865 MDEyOklzc3VlQ29tbWVudDI0ODc3Mjg2NQ== 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
}
  170779798
Powered by Datasette · Queries took 0.677ms · About: xarray-datasette