Skip to content

Commit 7526ab3

Browse files
Apply suggestions from code review Sam
Co-authored-by: Samuel Juhel <[email protected]>
1 parent 2bfe421 commit 7526ab3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

climada/util/coordinates.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ def get_country_geometries(
797797

798798
# exit with Value error if no country code was recognized
799799
if out.size == 0:
800-
raise ValueError(f"None of the given country codes were regocnized.")
800+
raise ValueError(f"None of the given country codes were recognized.")
801801

802802
if extent:
803803
if extent[1] - extent[0] > 360:
@@ -1765,14 +1765,12 @@ def bounds_from_cardinal_bounds(*, northern, eastern, western, southern):
17651765
"Given northern bound is below given southern bound or out of bounds"
17661766
)
17671767

1768-
if not (360 >= eastern >= -180) or not (360 >= western >= -180):
1769-
raise ValueError("Given eastern/western bounds are out of range (-180, 360).")
1770-
# order eastern and western coordinates
1768+
eastern = (eastern + 180) % 360 - 180
1769+
western = (western + 180) % 360 - 180
1770+
1771+
# Ensure eastern > western
17711772
if western > eastern:
17721773
eastern += 360
1773-
if eastern > 360 and western > 180:
1774-
eastern -= 360
1775-
western -= 360
17761774

17771775
return (western, southern, eastern, northern)
17781776

0 commit comments

Comments
 (0)