Merge branch 'develop' into feature/remove_implicit_use_crs #1159
GitHub Actions / Core / Unit Test Results (3.11)
failed
Jan 14, 2025 in 0s
1 fail, 714 pass in 9m 44s
Annotations
Check warning on line 0 in climada.hazard.test.test_tc_tracks.TestFuncs
github-actions / Core / Unit Test Results (3.11)
test_track_land_params (climada.hazard.test.test_tc_tracks.TestFuncs) failed
tests_xml/tests.xml [took 2s]
Raw output
ValueError: Input lat and lon coordinates are not geographic.
self = <climada.hazard.test.test_tc_tracks.TestFuncs testMethod=test_track_land_params>
def test_track_land_params(self):
"""Test identification of points on land and distance since landfall"""
# 1 pt over the ocean and two points within Fiji, one on each side of the anti-meridian
lon_test = np.array([170, 179.18, 180.05])
lat_test = np.array([-60, -16.56, -16.85])
on_land = np.array([False, True, True])
lon_shift = np.array([-360, 0, 360])
# ensure both points are considered on land as is
np.testing.assert_array_equal(
u_coord.coord_on_land(lat=lat_test, lon=lon_test), on_land
)
# independently on shifts by 360 degrees in longitude
np.testing.assert_array_equal(
> u_coord.coord_on_land(lat=lat_test, lon=lon_test + lon_shift), on_land
)
climada/hazard/test/test_tc_tracks.py:1194:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
lat = array([-60. , -16.56, -16.85]), lon = array([-190. , 179.18, 540.05])
land_geom = None
def coord_on_land(lat, lon, land_geom=None):
"""Check if points are on land.
Parameters
----------
lat : np.array
latitude of points in epsg:4326
lon : np.array
longitude of points in epsg:4326
land_geom : shapely.geometry.multipolygon.MultiPolygon, optional
If given, use these as profiles of land. Otherwise, the global landmass is used.
Returns
-------
on_land : np.array(bool)
Entries are True if corresponding coordinate is on land and False otherwise.
"""
if lat.size != lon.size:
raise ValueError(
"Wrong size input coordinates: %s != %s." % (lat.size, lon.size)
)
if lat.size == 0:
return np.empty((0,), dtype=bool)
if not check_if_geo_coords(lat, lon):
> raise ValueError("Input lat and lon coordinates are not geographic.")
E ValueError: Input lat and lon coordinates are not geographic.
climada/util/coordinates.py:705: ValueError
Loading