Skip to content

Commit 1e75282

Browse files
committed
minor xarray compatibility fix
1 parent f1363d9 commit 1e75282

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎psyplot/data.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4128,7 +4128,12 @@ def add_missing_dimensions(arr):
41284128
# interactive treatment of DataArrays
41294129
missing = set(arr.dims).difference(base.coords) - {"variable"}
41304130
for dim in missing:
4131-
base[dim] = arr.coords[dim] = np.arange(base.dims[dim])
4131+
try:
4132+
size = base.sizes[dim]
4133+
except AttributeError:
4134+
# old xarray version
4135+
size = base.dims[dim]
4136+
base[dim] = arr.coords[dim] = np.arange(size)
41324137

41334138
if squeeze:
41344139

0 commit comments

Comments
 (0)