home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 842556731

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/issues/1995#issuecomment-842556731 https://api.github.com/repos/pydata/xarray/issues/1995 842556731 MDEyOklzc3VlQ29tbWVudDg0MjU1NjczMQ== 35968931 2021-05-17T18:59:18Z 2021-05-17T18:59:18Z MEMBER

Has this not been solved by the argument allow_rechunk?

@crusaderky isn't this effectively what you were trying to achieve?

```python import xarray as xr

def mulsum(a, b): acc = 0 for i in range(a.size): acc += a[i] * b[i] return acc

a = xr.DataArray(data=[1, 2, 3], dims=['x']).chunk({"x": 1})

b = xr.DataArray(data=[4, 5, 6], dims=['x']).chunk({"x": 1})

c = xr.apply_ufunc( mulsum, a, b, input_core_dims=[['x'], ['x']], dask='parallelized', output_dtypes=[float], dask_gufunc_kwargs={'allow_rechunk': True})

print(c.compute()) returns <xarray.DataArray ()> array(32) ```

I think this has only been possible since the implementation of xarray.apply_ufunc was switched from dask.array.blockwise to dask.array.apply_gufunc in #4060.

If this is actually doing what I think it's doing then we should document this possibility!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  305757822
Powered by Datasette · Queries took 238.369ms · About: xarray-datasette