Skip to content

Commit

Permalink
Check for DataArray instance (pydata#7030)
Browse files Browse the repository at this point in the history
  • Loading branch information
dranjan committed Aug 12, 2023
1 parent 21c400c commit b22eada
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -943,8 +943,13 @@ def __setitem__(self, key, value):
See __getitem__ for more details.
"""
from xarray.core.dataarray import DataArray

dims, index_tuple, new_order = self._broadcast_indexes(key)

if isinstance(value, DataArray):
value = value.variable

if not isinstance(value, Variable):
value = as_compatible_data(value)
if value.ndim > len(dims):
Expand Down

0 comments on commit b22eada

Please sign in to comment.