home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 602108359

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/pull/3818#issuecomment-602108359 https://api.github.com/repos/pydata/xarray/issues/3818 602108359 MDEyOklzc3VlQ29tbWVudDYwMjEwODM1OQ== 2443309 2020-03-21T21:39:21Z 2020-03-21T21:39:21Z MEMBER

I've started testing this out and have run into one problem. Here's a simple example that uses template and Dask backed DataArrays in args

```python ds = xr.tutorial.load_dataset('air_temperature')

def func(X, y): ''' a simple reduction (assume the output can't be inferred automatically) ''' return X.sum('time') + y.min('time')

ds = ds.chunk({'lat': 10, 'lon': 10}) X = ds['air'] y = ds['air'] **2 template = X.sum('time')

expected = func(X, y) actual = xr.map_blocks(func, X, args=[y], template=template) xr.testing.assert_identical(actual, expected) ```

This raises:

```python-traceback

KeyError Traceback (most recent call last) <ipython-input-9-5491345c8970> in <module> 5 6 expected = func(X, y) ----> 7 actual = xr.map_blocks(func, X, args=[y], template=template) 8 xr.testing.assert_identical(actual, expected)

/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/core/parallel.py in map_blocks(func, obj, args, kwargs, template) 424 # even if length of dimension is changed by the applied function 425 expected["shapes"] = { --> 426 k: output_chunks[k][v] for k, v in input_chunk_index.items() 427 } 428 expected["data_vars"] = set(template.data_vars.keys()) # type: ignore

/srv/conda/envs/notebook/lib/python3.7/site-packages/xarray/core/parallel.py in <dictcomp>(.0) 424 # even if length of dimension is changed by the applied function 425 expected["shapes"] = { --> 426 k: output_chunks[k][v] for k, v in input_chunk_index.items() 427 } 428 expected["data_vars"] = set(template.data_vars.keys()) # type: ignore

KeyError: 'time' ```

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