Skip to content

Commit 6bbcc8a

Browse files
committed
avoid unnecessary auto-creation of index to avoid userwarning
1 parent 0f70805 commit 6bbcc8a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

xarray/core/dataarray.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,17 @@ def _check_data_shape(
208208
return data
209209
else:
210210
data_shape = tuple(
211-
as_variable(coords[k], k).size if k in coords.keys() else 1
211+
(
212+
as_variable(coords[k], k, auto_convert=False).size
213+
if k in coords.keys()
214+
else 1
215+
)
212216
for k in dims
213217
)
214218
else:
215-
data_shape = tuple(as_variable(coord, "foo").size for coord in coords)
219+
data_shape = tuple(
220+
as_variable(coord, "foo", auto_convert=False).size for coord in coords
221+
)
216222
data = np.full(data_shape, data)
217223
return data
218224

0 commit comments

Comments
 (0)