File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ def _dims_with_index(obj):
166
166
return []
167
167
168
168
dims_with_index = set ()
169
- for coord_name in obj .indexes :
169
+ for coord_name in obj .xindexes :
170
170
for dim in obj [coord_name ].dims :
171
171
dims_with_index .add (dim )
172
172
Original file line number Diff line number Diff line change @@ -71,15 +71,17 @@ def merge_query_results(results: List[QueryResult]) -> QueryResult:
71
71
duplicate_dims = {k : v for k , v in all_dims_count .items () if v > 1 }
72
72
73
73
if duplicate_dims :
74
+ # TODO: this message is not right when combining indexe(s) queries with
75
+ # location-based indexing on a dimension with no dimension-coordinate (failback)
74
76
fmt_dims = [
75
77
f"{ dim !r} : { count } indexes involved"
76
78
for dim , count in duplicate_dims .items ()
77
79
]
78
80
raise ValueError (
79
- "Xarray does not support label-based selection with more than one index"
81
+ "Xarray does not support label-based selection with more than one index "
80
82
"over the following dimension(s):\n "
81
83
+ "\n " .join (fmt_dims )
82
- + "Suggestion : use a multi-index for each of those dimension(s)."
84
+ + "\n Suggestion : use a multi-index for each of those dimension(s)."
83
85
)
84
86
85
87
dim_indexers = {}
@@ -124,8 +126,9 @@ def group_indexers_by_index(
124
126
"that has no associated coordinate or index"
125
127
)
126
128
else :
127
- # key is a dimension without coordinate
129
+ # key is a dimension without a "dimension- coordinate"
128
130
# failback to location-based selection
131
+ # TODO: depreciate this implicit behavior and suggest using isel instead?
129
132
unique_indexes [None ] = None
130
133
grouped_indexers [None ][key ] = label
131
134
You can’t perform that action at this time.
0 commit comments