Elffuss BraidHub

kikocis/auto-code-rover public

main · 844 BRawPermalink
1diff --git a/xarray/core/variable.py b/xarray/core/variable.py
2--- a/xarray/core/variable.py
3+++ b/xarray/core/variable.py
4@@ -120,6 +120,16 @@ def as_variable(obj, name=None) -> "Union[Variable, IndexVariable]":
5 if isinstance(obj, Variable):
6 obj = obj.copy(deep=False)
7 elif isinstance(obj, tuple):
8+ if isinstance(obj[1], DataArray):
9+ # TODO: change into TypeError
10+ warnings.warn(
11+ (
12+ "Using a DataArray object to construct a variable is"
13+ " ambiguous, please extract the data using the .data property."
14+ " This will raise a TypeError in 0.19.0."
15+ ),
16+ DeprecationWarning,
17+ )
18 try:
19 obj = Variable(*obj)
20 except (TypeError, ValueError) as error: