Skip to content

Commit 021090f

Browse files
committed
minor fixes and tweaks
1 parent d5cc3b4 commit 021090f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

xarray/core/formatting_html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def _dims_with_index(obj):
166166
return []
167167

168168
dims_with_index = set()
169-
for coord_name in obj.indexes:
169+
for coord_name in obj.xindexes:
170170
for dim in obj[coord_name].dims:
171171
dims_with_index.add(dim)
172172

xarray/core/indexing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,17 @@ def merge_query_results(results: List[QueryResult]) -> QueryResult:
7171
duplicate_dims = {k: v for k, v in all_dims_count.items() if v > 1}
7272

7373
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)
7476
fmt_dims = [
7577
f"{dim!r}: {count} indexes involved"
7678
for dim, count in duplicate_dims.items()
7779
]
7880
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 "
8082
"over the following dimension(s):\n"
8183
+ "\n".join(fmt_dims)
82-
+ "Suggestion: use a multi-index for each of those dimension(s)."
84+
+ "\nSuggestion: use a multi-index for each of those dimension(s)."
8385
)
8486

8587
dim_indexers = {}
@@ -124,8 +126,9 @@ def group_indexers_by_index(
124126
"that has no associated coordinate or index"
125127
)
126128
else:
127-
# key is a dimension without coordinate
129+
# key is a dimension without a "dimension-coordinate"
128130
# failback to location-based selection
131+
# TODO: depreciate this implicit behavior and suggest using isel instead?
129132
unique_indexes[None] = None
130133
grouped_indexers[None][key] = label
131134

0 commit comments

Comments
 (0)