Commit 41dfa16
committed
BUG: Fix display with nested arrays
Currently, the following will fail to display:
```python
import xarray as xr
import numpy as np
x = np.empty((2, 2), dtype=object)
for i in range(2):
for j in range(2):
x[i, j] = np.zeros(2) # Set to 1D array of size 2
ds = xr.DataArray(x)
ds
```
Whenever there are `size==1` arrays, it currently does work:
```python
import xarray as xr
import numpy as np
x = np.empty((2, 2), dtype=object)
for i in range(2):
for j in range(2):
x[i, j] = np.zeros((1, 1, 1)) # Set to 3D array of size 1
ds = xr.DataArray(x)
ds
For context, I am running into this issue in https://github.com/pipefunc/pipefunc where one can put the resulting objects into `xarray.Dataset`s.
For example, see the docs here https://pipefunc.readthedocs.io/en/latest/examples/physics-simulation/ (search for `xarray.Dataset`).1 parent aa9e2bd commit 41dfa16
2 files changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
0 commit comments