File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -161,12 +161,14 @@ def as_variable(obj, name=None) -> Variable | IndexVariable:
161
161
if name is not None and name in obj .dims :
162
162
# convert the Variable into an Index
163
163
if obj .ndim != 1 :
164
- raise MissingDimensionsError (
164
+ warnings . warn (
165
165
f"{ name !r} has more than 1-dimension and the same name as one of its "
166
- f"dimensions { obj .dims !r} . xarray disallows such variables because they "
167
- "conflict with the coordinates used to label dimensions."
166
+ f"dimensions { obj .dims !r} . Xarray will not automatically"
167
+ "create an Index object that would allow label-based selection." ,
168
+ RuntimeWarning ,
168
169
)
169
- obj = obj .to_index_variable ()
170
+ else :
171
+ obj = obj .to_index_variable ()
170
172
171
173
return obj
172
174
You can’t perform that action at this time.
0 commit comments