issues: 474247717
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
474247717 | MDU6SXNzdWU0NzQyNDc3MTc= | 3168 | apply_ufunc erroneously operating on an empty array when dask used | 35968931 | closed | 0 | 3 | 2019-07-29T20:44:23Z | 2020-03-30T15:08:16Z | 2020-03-30T15:08:15Z | MEMBER | Problem description
Minimum working example```python import numpy as np import xarray as xr def example_ufunc(x): print(x.shape) return np.mean(x, axis=-1) def new_mean(da, dim): result = xr.apply_ufunc(example_ufunc, da, input_core_dims=[[dim]], dask='parallelized', output_dtypes=[da.dtype]) return result shape = {'t': 2, 'x':3} data = xr.DataArray(data=np.random.rand(*shape.values()), dims=shape.keys()) unchunked = data chunked = data.chunk(shape) actual = new_mean(chunked, dim='x') # raises the warning print(actual) print(actual.compute()) # does the computation correctly ``` Result
Expected resultSame thing without the Output of
|
{ "url": "https://api.github.com/repos/pydata/xarray/issues/3168/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |