Skip to content

Commit e1c9633

Browse files
committed
Force check_antimeridian to False in distance euclidean if unit is not degree
1 parent 54c8565 commit e1c9633

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

climada/util/coordinates.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,6 +1504,9 @@ def _nearest_neighbor_euclidean(
15041504
# threshold and set an unvalid index -1
15051505
if unit == "degree":
15061506
dist = dist * EARTH_RADIUS_KM
1507+
else:
1508+
# if unit is not in degree, check_antimeridian is forced to False
1509+
check_antimeridian = False
15071510
num_warn = np.sum(dist > threshold)
15081511
if num_warn:
15091512
LOGGER.warning(
@@ -1512,8 +1515,6 @@ def _nearest_neighbor_euclidean(
15121515
assigned[dist > threshold] = -1
15131516

15141517
if check_antimeridian:
1515-
if unit != "degree":
1516-
raise ValueError("check_antimeridian is only implemented for degrees")
15171518
assigned = _nearest_neighbor_antimeridian(
15181519
np.rad2deg(centroids), np.rad2deg(coordinates[idx]), threshold, assigned
15191520
)

0 commit comments

Comments
 (0)