-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Labels
Description
Using get_country_code around the antimeridian can raise a ValueError unexpectedly.
The following code example is a simplified version of the locations of a Tropical Cyclone track around the antimeridian.
from climada.util.coordinates import get_country_code
lats = [45.201, 46.334, 47.988]
lons = [-179.902, -179.999, 180.002]
codes = get_country_code(lats, lons)
It raises a ValueError: longitude extent range is greater than 360: -180.0 to 180.00300000000001
That happens because in get_country_code the extend is widened without any respect for the bounds of the projection
File ~/Documents/git_folder/climada_python/climada/util/coordinates.py:1544, in get_country_code(lat, lon, gridded)
1542 extent = (lon.min() - 0.001, lon.max() + 0.001,
1543 lat.min() - 0.001, lat.max() + 0.001)