Skip to content

Commit 2c571c6

Browse files
author
Chahan Kropf
committed
Require explicit threshold for single centroid coordinates
1 parent 7824875 commit 2c571c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

climada/util/coordinates.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,11 @@ def assign_coordinates(*args, **kwargs):
10551055

10561056

10571057
def estimate_matching_threshold(coords_to_assign):
1058+
if len(coords_to_assign) < 2:
1059+
raise ValueError(
1060+
"The coordinate assignement threshold cannot be"
1061+
"estimated for a single coordinate. Please set the threshold explicitly"
1062+
)
10581063
return 2 * max(abs(r) for r in get_resolution(coords_to_assign.T))
10591064

10601065

@@ -1131,7 +1136,7 @@ def match_coordinates(
11311136
across the antimeridian. However, when exact matches are enforced with `threshold=0`, lat/lon
11321137
coordinates need to be given in the same longitudinal range (such as (-180, 180)).
11331138
"""
1134-
crs = PCRS.from_user_input(DEF_CRS)
1139+
crs = PCRS.from_user_input(crs)
11351140

11361141
if coords.shape[0] == 0:
11371142
return np.array([])

0 commit comments

Comments
 (0)