Skip to content

Commit 685c241

Browse files
luseverinchahank
andauthored
Raise separate exceptions for missing crs in coord_gdf and centroids
Co-authored-by: Chahan M. Kropf <[email protected]>
1 parent a733e8e commit 685c241

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

climada/util/coordinates.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,14 @@ def match_centroids(
12461246
try:
12471247
if not equal_crs(coord_gdf.crs, centroids.crs):
12481248
raise ValueError("Set hazard and GeoDataFrame to same CRS first!")
1249-
if coord_gdf.crs is None or centroids.crs is None:
1249+
if coord_gdf.crs is None:
12501250
raise ValueError(
1251-
"Please provide coordinate GeoDataFrame and Hazard "
1251+
"Please provide a coord_gdf (coordinate GeoDataFrame)"
1252+
"object with a valid crs attribute."
1253+
)
1254+
if centroids.crs is None :
1255+
raise ValueError(
1256+
"Please provide centroids "
12521257
"object with a valid crs attribute."
12531258
)
12541259
except AttributeError as exc:

0 commit comments

Comments
 (0)