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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
files: 'xvec\/'
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.2
rev: v0.14.5
hooks:
- id: ruff
- id: ruff-format
Expand Down
6 changes: 6 additions & 0 deletions xvec/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,12 @@ def to_geodataframe(
return df.set_geometry(geometry, crs=self._obj.proj.crs)

# coordinate geometry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a comment here explaining what is happening with a link to the xarray issue? I'd like to see this as a temporary measure until it gets fixed in upstream.

# Workaround for xarray 2025.10.1 bug where coordinates with names
# different from dimension names are not included in to_dataframe()
# See: https://github.com/pydata/xarray/issues/9903
if len(df.index) == len(self._obj[geometry].values):
df[geometry] = self._obj[geometry].values

return df.set_geometry(
geometry, crs=self._obj[geometry].attrs.get("crs", None)
) # type: ignore
Expand Down