issue_comments: 394758682
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/2215#issuecomment-394758682 | https://api.github.com/repos/pydata/xarray/issues/2215 | 394758682 | MDEyOklzc3VlQ29tbWVudDM5NDc1ODY4Mg== | 25231875 | 2018-06-05T15:42:15Z | 2018-06-05T16:23:12Z | NONE | I found a way to reproduce the error. One of the MuliIndex levels on the DataArrays has NaNs in it. If I remove that level, the correct values appear in the result. Should the presence of that MultiIndex level cause this behavior? ``` import string import numpy as np import xarray as xr dims = ("x", "y") shape = (10, 5) das = [] for j in (0, 1): data = np.full(shape, np.nan, dtype="float64") for i in range(shape[0]): data[i, i % shape[1]] = float(i) coords_d = { "ints": ("x", range(jshape[0], (j+1)shape[0])), "nans": ("x", np.array([np.nan] * shape[0], dtype="float64")), "lower": ("y", list(string.ascii_lowercase[:shape[1]])) } da = xr.DataArray(data=data, dims=dims, coords=coords_d) da.set_index(append=True, inplace=True, x=["ints", "nans"], y=["lower"]) das.append(da) nonzeros_raw = [np.nonzero(~np.isnan(da)) for da in das] print("nonzeros_raw: ") print(nonzeros_raw) aligned = xr.align(*das, join="outer") nonzeros_aligned = [np.nonzero(~np.isnan(da)) for da in aligned] print("nonzeros_aligned: ") print(nonzeros_aligned) assert nonzeros_raw[0].shape == nonzeros_aligned[0].shape ``` |
{ "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
329438885 |