Skip to content

Commit

Permalink
Get unpacked data to be used downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
aimtsou authored Apr 10, 2024
1 parent 3dc7215 commit 740606b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xarray/core/variable.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ def as_variable(
except ValueError:
raise ValueError(f"Tuple {obj} is not in the form (dims, data[, attrs])")

if isinstance(obj[1], DataArray):
if isinstance(data_, DataArray):
raise TypeError(
f"Variable {name!r}: Using a DataArray object to construct a variable is"
" ambiguous, please extract the data using the .data property."
)
try:
obj = Variable(*obj)
obj = Variable(dims_, data_, *attrs)
except (TypeError, ValueError) as error:
raise error.__class__(
f"Variable {name!r}: Could not convert tuple of form "
Expand Down

0 comments on commit 740606b

Please sign in to comment.