issues: 134921284
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
134921284 | MDU6SXNzdWUxMzQ5MjEyODQ= | 770 | Internal refactor: create a generic function for applying ufuncs-like functions to xarray objects | 1217238 | closed | 0 | 4 | 2016-02-19T17:18:53Z | 2017-10-20T16:44:47Z | 2017-10-20T16:44:47Z | MEMBER | It would be awesome to have a generic function for making functions that act like NumPy's generalized universal functions "xarray aware". What would If any of A concrete example of similar functionality in dask.array is Here are a few concrete examples of how this could work: ``` python def average(array, weights, dim=None): # still needs a bit of work to make a NaN and dask.array safe version # version of np.average return apply_ufunc(np.average, [array, weights], agg_dims=dim) def where(cond, first, second=None): if second is None: # need to write where2, a function that looks at first.dtype # to infer the appropriate NA sentinel value return apply_ufunc(ops.where2, [cond, first]) else: return apply_ufunc(ops.where, [cond, first, second]) def dot(self, other, dim=None): if dim is None: dim = set(self.dims) ^ set(other.dims) return apply_ufunc(ops.tensordot, [self, other], agg_dims=dim) ``` |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/770/reactions", "total_count": 2, "+1": 2, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |