Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Jan 11, 2024
1 parent c99bf25 commit 0cb5c9a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions xvec/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def to_geopandas(self) -> GeoDataFrame | pd.DataFrame:
UserWarning,
stacklevel=2,
)
return cast(pd.DataFrame, self._obj.to_pandas())
return self._obj.to_pandas()

# Dataset
gdf = self._obj.to_pandas()
Expand All @@ -784,7 +784,7 @@ def to_geopandas(self) -> GeoDataFrame | pd.DataFrame:
if index_name in self._geom_coords_all:
return gdf.reset_index().set_geometry(
index_name, crs=self._obj[index_name].attrs.get("crs", None)
)
) # type: ignore

warnings.warn(
"No active geometry column to be set. The resulting object "
Expand All @@ -795,7 +795,7 @@ def to_geopandas(self) -> GeoDataFrame | pd.DataFrame:
stacklevel=2,
)

return cast(pd.DataFrame, gdf)
return gdf

def to_geodataframe(
self,
Expand Down
6 changes: 2 additions & 4 deletions xvec/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,7 @@ def isel(self, indexers: Mapping[Any, Any]) -> GeometryIndex | None:
else:
return None

def _sel_sindex(
self, labels: Sequence[shapely.Geometry], method: str, tolerance: float
) -> IndexSelResult:
def _sel_sindex(self, labels, method: str, tolerance) -> IndexSelResult:
# only one entry expected
assert len(labels) == 1
label = next(iter(labels.values()))
Expand Down Expand Up @@ -227,7 +225,7 @@ def sel(
# options when `labels` is a single geometry.
# Xarray currently doesn't support custom options
# (see https://github.com/pydata/xarray/issues/7099)
return self._sel_sindex(labels, method, tolerance)
return self._sel_sindex(labels, method, tolerance) # type: ignore

def equals(self, other: Index) -> bool:
if not isinstance(other, GeometryIndex):
Expand Down

0 comments on commit 0cb5c9a

Please sign in to comment.