Skip to content

Commit

Permalink
add also to to_geodataframe
Browse files Browse the repository at this point in the history
  • Loading branch information
veenstrajelmer authored Aug 20, 2024
1 parent b66b6b1 commit 67daff5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion xugrid/core/dataarray_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def to_geodataframe(
else:
ds = self.obj.to_dataset()

variables = [var for var in ds.data_vars if dim in ds[var].dims]
variables = [var for var in ds.data_vars if dim in ds.variables[var].dims]
# TODO deal with time-dependent data, etc.
# Basically requires checking which variables are static, which aren't.
# For non-static, requires repeating all geometries.
Expand Down
2 changes: 1 addition & 1 deletion xugrid/core/dataset_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def to_geodataframe(self, dim_order=None) -> "geopandas.GeoDataFrame": # type:
else:
raise ValueError("invalid topology dimension on grid")

variables = [var for var in ds.data_vars if dim in ds[var].dims]
variables = [var for var in ds.data_vars if dim in ds.variables[var].dims]
if variables:
data = ds[variables].to_dataframe(dim_order=dim_order)
else:
Expand Down

0 comments on commit 67daff5

Please sign in to comment.