Skip to content

Commit

Permalink
avoid unnecessary auto-creation of index to avoid userwarning
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Mar 22, 2024
1 parent 0f70805 commit 6bbcc8a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,17 @@ def _check_data_shape(
return data
else:
data_shape = tuple(
as_variable(coords[k], k).size if k in coords.keys() else 1
(
as_variable(coords[k], k, auto_convert=False).size
if k in coords.keys()
else 1
)
for k in dims
)
else:
data_shape = tuple(as_variable(coord, "foo").size for coord in coords)
data_shape = tuple(
as_variable(coord, "foo", auto_convert=False).size for coord in coords
)
data = np.full(data_shape, data)
return data

Expand Down

0 comments on commit 6bbcc8a

Please sign in to comment.