Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions xarray/core/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,10 +768,12 @@ def concat(

if not indexes:
coord_dtype = None
elif len(set(idx.coord_dtype for idx in indexes)) == 1:
coord_dtype = indexes[0].coord_dtype
else:
coord_dtype = np.result_type(*[idx.coord_dtype for idx in indexes])
indexes_coord_dtypes = {idx.coord_dtype for idx in indexes}
if len(indexes_coord_dtypes) == 1:
coord_dtype = next(iter(indexes_coord_dtypes))
else:
coord_dtype = np.result_type(*indexes_coord_dtypes)

return cls(new_pd_index, dim=dim, coord_dtype=coord_dtype)

Expand Down
2 changes: 1 addition & 1 deletion xarray/core/treenode.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def relative_to(self: NamedNode, other: NamedNode) -> str:
)

this_path = NodePath(self.path)
if other.path in list(parent.path for parent in (self, *self.parents)):
if any(other.path == parent.path for parent in (self, *self.parents)):
return str(this_path.relative_to(other.path))
else:
common_ancestor = self.find_common_ancestor(other)
Expand Down
6 changes: 3 additions & 3 deletions xarray/groupers.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,10 @@ def season_to_month_tuple(seasons: Sequence[str]) -> tuple[tuple[int, ...], ...]
((12, 1, 2, 3), (9, 10, 11, 12))
"""
initials = "JFMAMJJASOND"
starts = dict(
("".join(s), i + 1)
starts = {
"".join(s): i + 1
for s, i in zip(sliding_window(2, initials + "J"), range(12), strict=True)
)
}
result: list[tuple[int, ...]] = []
for i, season in enumerate(seasons):
if len(season) == 1:
Expand Down
Loading