issues: 859611240
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
859611240 | MDU6SXNzdWU4NTk2MTEyNDA= | 5169 | nan length coordinates | 1053153 | open | 0 | 2 | 2021-04-16T08:50:50Z | 2021-04-24T02:43:35Z | CONTRIBUTOR | Is your feature request related to a problem? Please describe. When using arrays with a nan shape, I'd like to provide a coordinate specification from a delayed object, which is my responsibility to make sure has the right chunks and length. Describe the solution you'd like Below are three examples that I think should work, where I give a coordinate via a dask array, a dask series, and a dask index. Currently, all three examples error out by computing the coordinate length (triggering an unwanted dask computation!), and then indicating that its different than the array's corresponding length, which is nan. ```python import dask import dask.array as da import dask.dataframe as dd import numpy as np import pandas as pd import xarray as xr def foo(): return np.arange(4) arr = da.from_delayed(dask.delayed(foo)(), shape=(np.nan,), dtype=int) idx = da.from_delayed(dask.delayed(foo)(), shape=(np.nan,), dtype=int) ddf = dd.from_pandas(pd.DataFrame({'y': np.arange(4)}), npartitions=1) arr0 = xr.DataArray(arr, coords=[('z', idx)]) arr1 = xr.DataArray(arr, coords=[('z', ddf['y'])]) arr2 = xr.DataArray(arr, coords=[('z', ddf.index)]) ``` Error:
Describe alternatives you've considered After computations to complete add the missing coordinate. This requires carrying around the delayed index with the delayed array. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/5169/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |