Skip to content

Commit ca86640

Browse files
explicitly ask for Points
Co-authored-by: Lukas Riedel <[email protected]>
1 parent d5d7981 commit ca86640

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

climada/hazard/centroids/centr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,12 +917,12 @@ def write_hdf5(self, file_name, mode="w"):
917917
pandas_df = pd.DataFrame(self.gdf)
918918
for col in pandas_df.columns:
919919
if str(pandas_df[col].dtype) == "geometry":
920-
try:
920+
if (self.gdf.geometry.geom_type == "Point").all():
921921
pandas_df[col + ".x"] = self.gdf[col].x
922922
pandas_df[col + ".y"] = self.gdf[col].y
923923
pandas_df.drop(columns=[col], inplace=True)
924924
xycols.append(col)
925-
except ValueError:
925+
else:
926926
pandas_df[col] = self.gdf[col].to_wkb()
927927
wkbcols.append(col)
928928

0 commit comments

Comments
 (0)