Skip to content

Commit 8cc8ad1

Browse files
authored
Fix plotting test (#135)
1 parent a88c521 commit 8cc8ad1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
files: 'xvec\/'
22
repos:
33
- repo: https://github.com/astral-sh/ruff-pre-commit
4-
rev: v0.12.2
4+
rev: v0.14.5
55
hooks:
66
- id: ruff
77
- id: ruff-format

xvec/accessor.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,12 @@ def to_geodataframe(
956956
return df.set_geometry(geometry, crs=self._obj.proj.crs)
957957

958958
# coordinate geometry
959+
# Workaround for xarray 2025.10.1 bug where coordinates with names
960+
# different from dimension names are not included in to_dataframe()
961+
# See: https://github.com/pydata/xarray/issues/9903
962+
if len(df.index) == len(self._obj[geometry].values):
963+
df[geometry] = self._obj[geometry].values
964+
959965
return df.set_geometry(
960966
geometry, crs=self._obj[geometry].attrs.get("crs", None)
961967
) # type: ignore

0 commit comments

Comments
 (0)