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/issues/1914#issuecomment-396738702,https://api.github.com/repos/pydata/xarray/issues/1914,396738702,MDEyOklzc3VlQ29tbWVudDM5NjczODcwMg==,1217238,2018-06-12T21:23:09Z,2018-06-12T21:23:09Z,MEMBER,"[xyzpy](http://xyzpy.readthedocs.io) (by @jcmgray) looks like it might be a nice way to solve this problem, e.g., see http://xyzpy.readthedocs.io/en/latest/examples/complex%20output%20example.html
","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,297560256
https://github.com/pydata/xarray/issues/1914#issuecomment-367578341,https://api.github.com/repos/pydata/xarray/issues/1914,367578341,MDEyOklzc3VlQ29tbWVudDM2NzU3ODM0MQ==,1217238,2018-02-22T06:13:58Z,2018-02-22T06:13:58Z,MEMBER,"This issue has brought up a lot of the same issues: https://github.com/pydata/xarray/issues/1773
Clearly, we need better documentation here at the very least.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,297560256
https://github.com/pydata/xarray/issues/1914#issuecomment-366884882,https://api.github.com/repos/pydata/xarray/issues/1914,366884882,MDEyOklzc3VlQ29tbWVudDM2Njg4NDg4Mg==,1217238,2018-02-20T07:02:37Z,2018-02-20T07:02:37Z,MEMBER,"`xarray.broadcast()` could also be helpful for generating a cartesian product. Something like `xarray.broadcast(*data.coords.values())` would get you three 3D DataArray objects.
`apply_ufunc` with `vectorize=True` could also achieve what you're looking for here:
```python
import xarray as xr
import numpy as np
data = xr.Dataset(coords={'x': np.linspace(-1, 1), 'y': np.linspace(0, 10), 'a': 1, 'b': 5})
def some_function(x, y):
return float(x) * float(y)
xr.apply_ufunc(some_function, data['x'], data['y'], vectorize=True)
```
Results in:
```
array([[ -0. , -0.204082, -0.408163, ..., -9.591837, -9.795918, -10. ],
[ -0. , -0.195752, -0.391504, ..., -9.200333, -9.396085,
-9.591837],
[ -0. , -0.187422, -0.374844, ..., -8.80883 , -8.996252,
-9.183673],
...,
[ 0. , 0.187422, 0.374844, ..., 8.80883 , 8.996252,
9.183673],
[ 0. , 0.195752, 0.391504, ..., 9.200333, 9.396085,
9.591837],
[ 0. , 0.204082, 0.408163, ..., 9.591837, 9.795918, 10. ]])
Coordinates:
* x (x) float64 -1.0 -0.9592 -0.9184 -0.8776 -0.8367 -0.7959 ...
a int64 1
b int64 5
* y (y) float64 0.0 0.2041 0.4082 0.6122 0.8163 1.02 1.224 1.429 ...
```
You can even do this with dask arrays if you set `dask='parallelized'`.
That said, it does feel like there's some missing functionality here for the xarray equivalent of `ndenumerate`. I'm not entirely sure what the right API is, yet.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,297560256