issues: 457716471
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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 457716471 | MDU6SXNzdWU0NTc3MTY0NzE= | 3032 | apply_ufunc should preemptively broadcast | 23738400 | open | 0 | 11 | 2019-06-18T22:02:36Z | 2019-06-19T22:27:27Z | CONTRIBUTOR | Code SampleI am having some troubles understanding ```python import xarray as xr import numpy as np a = xr.DataArray(data=np.random.normal(size=(7, 3)), dims=["dim1", "dim2"]) c = xr.DataArray(data=np.random.normal(size=(5, 6)), dims=["dim3", "dim4"]) def func(x,y): print(x.shape) print(y.shape) return ``` The function defined always raises an error when trying to call Problem description```python xr.apply_ufunc(func, a, c) Out(7, 3, 1, 1)(5, 6)``` Here, ```python print([ary.shape for ary in xr.broadcast(a,c)]) [(7, 3, 5, 6), (7, 3, 5, 6)]``` Using different input core dims does not get rid of the problem, instead I believe it shows some more issues: ```python xr.apply_ufunc(func, a, c, input_core_dims=[["dim1"],[]]) (3, 1, 1, 7), expected (3, 5, 6, 7)(5, 6), expected (3, 5, 6)xr.apply_ufunc(func, a, c, input_core_dims=[[],["dim3"]]) (7, 3, 1), expected (7, 3, 6)(6, 5), expected (7, 3, 6, 5)xr.apply_ufunc(func, a, c, input_core_dims=[["dim1"],["dim3"]]) (3, 1, 7), expected (3, 6, 7)(6, 5), expected (3, 6, 5)``` Is this current behaviour what should be expected? Output of
|
{
"url": "https://api.github.com/repos/pydata/xarray/issues/3032/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
13221727 | issue |