Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
657b612
Add function to test if lat and lon are in geographic coords
Sep 22, 2024
b594b7f
Add test for geographic coords in dist_to_coast
Sep 22, 2024
e36ded8
Add test for geographic coords in coord_on_land
Sep 22, 2024
dc78a13
Merge branch 'develop-white' into feature/remove_implicit_use_crs
Oct 23, 2024
b88ecc4
Switch branch feature/remove_implicite_use_crs to black format
Oct 23, 2024
96ede79
Merge branch 'develop-black' into feature/remove_implicit_use_crs
Oct 23, 2024
2bc5c6a
Merge branch 'develop' into feature/remove_implicit_use_crs
Oct 23, 2024
b139e8f
Merge branch 'develop' into feature/remove_implicit_use_crs
Jan 14, 2025
c8aac80
Merge branch 'develop' into feature/remove_implicit_use_crs
Mar 5, 2025
320d0f7
Extend allowed extent for geo coords
Mar 5, 2025
9ef7323
Modify allowed extents in geo_coords check function to allow for bounds
Mar 6, 2025
f27c4aa
Include possible wrong lat lon extension in error message
Mar 6, 2025
df439a5
Add check for geo coords in get_country_code
Mar 6, 2025
d3aea1e
Add test for geocoords in convert_wgs_to_utm
Mar 6, 2025
fb3cf7e
Update error message in coord_on_land
Mar 6, 2025
cf57963
Harmonize error messages
Mar 6, 2025
cb1e718
Adapt test get_country_geometries_fail
Mar 6, 2025
2a1f9b1
Check for geo coords in match_coordinates
Mar 6, 2025
322a9d3
Add check for lat in get_gridcellarea
Mar 6, 2025
60dc067
Modify check geo coords function to please linter
Mar 6, 2025
a0e02be
Add test for geo coords in calc of coriolis param
Mar 6, 2025
127d9cc
Add tests for check_if_geo_coords function
Mar 6, 2025
737fcd4
Merge branch 'develop' into feature/remove_implicit_use_crs
Apr 8, 2025
eca9f77
Incorporate suggestions from review 1
luseverin Apr 8, 2025
99635bf
Start adapating match_coordinates function to other crs
May 15, 2025
a642c04
Add handling of unit in match_centroids
May 15, 2025
eea31cb
Rename deg to degrees
May 15, 2025
35f0f7f
Add function to infer unit of coordinates
May 15, 2025
782b53d
Use infer_unit_coords in match_centroids function
May 15, 2025
ffee7f8
Add tests for unit_infer and unit-adapted match_coordinates
May 15, 2025
61e7b0f
Make test_tack_land_params compliant with new requirement of geodetic…
May 15, 2025
ef250c4
Correct wrong is_geodetic crs attribute
May 15, 2025
bca6e3a
Add restriction for haversine with non-degree units
May 15, 2025
54e2f75
Finish adding test for handling of different units
May 15, 2025
63bf8b5
Add test invalid unit for match coords and docstrings
May 15, 2025
da1c965
Update docstrings
May 15, 2025
5d53512
Try to fix new linter issues
May 15, 2025
54c8565
Correct error in logger warning
May 15, 2025
e1c9633
Force check_antimeridian to False in distance euclidean if unit is no…
Jun 19, 2025
fbcb163
Remove outdated test for raise of ValueError when check_antimeridian …
Jun 19, 2025
41b66bb
Add function to get coordinates from axis of coordinates'crs
Jun 27, 2025
7d1d3f3
Update unit names to be consistent with epsg notation and remove unit…
Jun 27, 2025
2176402
Clarify docstring check_if_geo_coords
Jun 27, 2025
8edb184
Make conversion between radians and degrees more consistent
Jun 27, 2025
91600a9
Remove deprecated infer_unit_coords function
Jun 27, 2025
f0d8dcc
Update tests
Jun 27, 2025
d45e55f
Force input coords and centroids to have crs attribute in match_centr…
Jun 27, 2025
409ff73
Re-harmonize unit names and raise error when crs of centroids or coor…
Jun 27, 2025
028fa0b
Add missing tests
Jun 27, 2025
2da2e2e
Fix linter issues
Jun 27, 2025
e2022ba
Refix linter
Jun 27, 2025
9c4b51e
Wrap valuerror raising in check_if_geo_coords
Jul 28, 2025
f14d5f0
Update tests
Jul 28, 2025
a733e8e
Remove useless info in get_crs_unit docstring
Jul 28, 2025
685c241
Raise separate exceptions for missing crs in coord_gdf and centroids
luseverin Jul 28, 2025
a5d5c20
Fix error in _nearest_neighbor_approx docstring
Jul 28, 2025
16bcc84
Make clearer error message for _nearest_neighbor with non-allowed units
Jul 30, 2025
07a4a73
Simplify crs check in match_centroids
Jul 30, 2025
f2d49b3
Correct typo and update tests for new error messages in match_centroids
Jul 30, 2025
0f3de31
Only warn for check_antimeridian when it is true and add tests
Jul 30, 2025
c67d6da
Allow for units other than degree km and m by keeping distance thresh…
Jul 30, 2025
a260848
Update thresholds in test to be consisten with handling of thresholds…
Jul 30, 2025
2f6bb5e
Remove mention to calling functions in error message in _nearest_neig…
luseverin Jul 30, 2025
734541a
Remove mention to calling functions in error message in _nearest_neig…
luseverin Jul 30, 2025
86d8126
Update docstrings match_centroids
Jul 30, 2025
faf8666
update docstrings for match_coordinates
Jul 30, 2025
b55b02a
Update changelog
Jul 30, 2025
e3b8edc
Merge remote-tracking branch 'origin/feature/remove_implicit_use_crs'…
Aug 4, 2025
3f8f2ad
Update docstring to removed grid centroids + black
Aug 4, 2025
5eb7753
Add error to docstring and return value
Aug 5, 2025
90602b1
Replace default threshold by dynamic one and apply black
Aug 5, 2025
3147715
Update tests to use dynamic threshold
Aug 5, 2025
daa09ff
Simplify non degree crs handling
Aug 21, 2025
15c5d0e
Use crs instead of unit
Aug 22, 2025
7824875
Update test to use crs as input
Aug 22, 2025
2c571c6
Require explicit threshold for single centroid coordinates
Aug 22, 2025
5160ab0
Add docstrings for km to degree and inverse
Aug 22, 2025
c1916b4
Add docstrings for estimate threshold
Aug 22, 2025
82b27e0
Update impact tests
Aug 25, 2025
bd87a0f
Add test for projected crs
Aug 25, 2025
4bb02cd
Add docstring in impact calc
Aug 26, 2025
8e0039c
Update impact calc test to use correct distance threshold
Aug 26, 2025
df3e303
Add impact calc test with other crs
Aug 26, 2025
a22a047
Improve docstrings
Aug 26, 2025
f3300b0
Separate check geo coordinates into two methods
Aug 27, 2025
bc0f0b8
Improve docstrings
Aug 27, 2025
c183d24
Correct docstrings
Aug 27, 2025
a9c76e8
Add new coordinates methods to changelog
Aug 27, 2025
a69712b
Improve wording
Aug 27, 2025
bb2e16a
Fix resolution to be only positive
Aug 27, 2025
70fbde2
Add coordinate checks for bounds
Aug 27, 2025
9a1b296
Add test test resolution
Aug 27, 2025
bcb48b5
Add test assign other crs
Aug 27, 2025
df85382
Update changelog
Aug 27, 2025
64baf7b
Revert bounds and normalize degree check as test were broadly failing.
Aug 27, 2025
94c544e
Merge remote-tracking branch 'origin/develop' into feature/relative_m…
Aug 28, 2025
86bb4f5
Check that lon normalize values are actually proper longitudes
Aug 28, 2025
9ce4106
Revert "Check that lon normalize values are actually proper longitudes"
Aug 28, 2025
f8e6268
Raise error if no res above min_threshold can be found in get_resolut…
Sep 2, 2025
9205a19
Add test exception exp.assign_centroids when crs not equal
Sep 2, 2025
b4b6a9e
Add test get_unit_crs for undefined unit
Sep 2, 2025
2afd553
Add test unknown unit get_gridcell_area
Sep 2, 2025
9b56aae
Add test estimate_matching_threshold
Sep 3, 2025
8275b6b
check geocoords in lon_normalize and handle empty arrays in check geo…
Sep 11, 2025
cb5db5e
Update tests lon_normalize
Sep 11, 2025
5ff2806
Increase allowed lon extent in is_geo_coords to avoid failing tests w…
Sep 11, 2025
56f53a1
Update offensive value for test_get_country_geometries_fail
Sep 11, 2025
c3f7132
Add handling of nans in is_geo_coords
Sep 22, 2025
271c4f8
Merge branch 'develop' into feature/relative_matching_distance
Sep 23, 2025
215b315
Update changelog
Sep 23, 2025
d3ab604
Update climada/engine/impact_calc.py
chahank Sep 23, 2025
4ad866f
Merge remote-tracking branch 'origin/develop' into feature/relative_m…
Sep 23, 2025
a937f41
Clarify meaning of highest resolution in docstrings
luseverin Sep 23, 2025
262ca5b
Clarify meaning of highest resolution in docstrings
luseverin Sep 23, 2025
9460d11
Correct typo in docstring
chahank Sep 23, 2025
38d7a7d
Fix typo in docstring
chahank Sep 23, 2025
fed482c
Resolve linter issue
chahank Sep 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ Removed:
- Added optional parameter to `geo_im_from_array`, `plot_from_gdf`, `plot_rp_imp`, `plot_rp_intensity`,
`plot_intensity`, `plot_fraction`, `_event_plot` to mask plotting when regions are too far from data points [#1047](https://github.com/CLIMADA-project/climada_python/pull/1047). To recreate previous plots (no masking), the parameter can be set to None.
- Added instructions to install Climada petals on Euler cluster in `doc.guide.Guide_Euler.ipynb` [#1029](https://github.com/CLIMADA-project/climada_python/pull/1029)

- Added util methods to handle crs coordinates consistently: `is_geo_coords`, `check_if_geo_coords`, `get_crs_unit`, `estimate_matching_threshold`, `degree_to_km`, and `km_to_degree` [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080)
- `ImpactFunc` and `ImpactFuncSet` now support equality comparisons via `==` [#1027](https://github.com/CLIMADA-project/climada_python/pull/1027)

### Changed

- Changed default distance threshold for nearest neighbor matching in `util.coordinates.match_coordinates` from a fixed value of 100km to twice the highest resolution of the coords_to_assign [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080).
- Changed the default mask_distance in `util.plot.geo_im_from_array` to 0.03 to avoid white gaps in gridded hazard data with comparably low resolution (>80 centroids per axis) [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
- Increased speed of `util.plot.add_shapes` by avoiding for loops, substantially speeding up `Hazard.plot_intensity` and other functions. [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
- Update `util.coordinates.match_centroids`, `util.coordinates.match_coordinates`, so that they also
accept coordinates that are not defined in degree. [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080)
- Implement cheap test to check that input coordinates at least seem geographic for functions that require
geographic coordinates as input (e.g. `util.coordinates.dist_to_coast`, `util.coordinates.coord_on_land`, `util.coordinates.lon_normalize`, `util.coordinates.lon_bounds`). [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080)
- `Hazard.local_exceedance_intensity`, `Hazard.local_return_period` and `Impact.local_exceedance_impact`, `Impact.local_return_period`, using the `climada.util.interpolation` module: New default (no binning), binning on decimals, and faster implementation [#1012](https://github.com/CLIMADA-project/climada_python/pull/1012)
- World Bank indicator data is now downloaded directly from their API via the function `download_world_bank_indicator`, instead of relying on the `pandas-datareader` package [#1033](https://github.com/CLIMADA-project/climada_python/pull/1033)
- `Exposures.write_hdf5` pickles geometry data in WKB format, which is faster and more sustainable. [#1051](https://github.com/CLIMADA-project/climada_python/pull/1051)
Expand Down
16 changes: 16 additions & 0 deletions climada/engine/impact_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
Default: True
assign_centroids : bool, optional
indicates whether centroids are assigned to the self.exposures object.
The default centroids assignment uses Euclidean distance and a threshold equal to
twice the highest resolution (smallest distance between any two nearest neighbours)
of the centroids (assuming a regular grid).
Recommendation: assign the centroids directly with control
over the distance metric and the distance threshold using
`exposure.assign_centroids(hazard)`. In this case, set assign_centroids to ``False``.
Centroids assignment is an expensive operation; set this to ``False`` to save
computation time if the hazards' centroids are already assigned to the exposures
object.
Expand All @@ -114,12 +120,22 @@
>>> imp = impcalc.impact(insured=True)
>>> imp.aai_agg

>>> haz = Hazard.from_hdf5(HAZ_DEMO_H5) # Set hazard
>>> impfset = ImpactFuncSet.from_excel(ENT_TEMPLATE_XLS)
>>> exp = Exposures(pd.read_excel(ENT_TEMPLATE_XLS))
>>> #Adjust threshold and distance to centroids/exposure resolution
>>> exp.assign_centroids(hazard, threshold=1.5, distance='euclidean')
>>> impcalc = ImpactCal(exp, impfset, haz)
>>> imp = impcalc.impact(insured=True, assign_centroids=False)
>>> imp.aai_agg

See also
--------
apply_deductible_to_mat : apply deductible to impact matrix
apply_cover_to_mat : apply cover to impact matrix
climada.entity.exposures.assign_centroids : assign centroids to exposures explicitly
"""
# TODO: consider refactoring, making use of Exposures.hazard_impf

Check warning on line 138 in climada/engine/impact_calc.py

View check run for this annotation

Jenkins - WCR / Pylint

fixme

NORMAL: TODO: consider refactoring, making use of Exposures.hazard_impf
Raw output
no description found
# check for compatibility of exposures and hazard type
if all(
name not in self.exposures.gdf.columns
Expand Down
27 changes: 26 additions & 1 deletion climada/engine/test/test_impact_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,28 @@ def test_calc_impact_TC_pass(self):
self.assertAlmostEqual(6.570532945599105e11, impact.tot_value)
self.assertAlmostEqual(6.512201157564421e09 * x, impact.aai_agg, 5)

def test_calc_impact_TC_change_crs_pass(self):
"""Test compute impact"""
crs = "EPSG:4087"
exp = ENT.exposures.copy()
exp.to_crs(crs)
haz = deepcopy(HAZ)
haz.centroids.to_crs(crs)
icalc = ImpactCalc(exp, ENT.impact_funcs, haz)
impact = icalc.impact()
self.assertEqual(icalc.n_events, len(impact.at_event))
self.assertEqual(0, impact.at_event[0])
self.assertEqual(0, impact.at_event[7225])
self.assertAlmostEqual(1.472482938320243e08, impact.at_event[13809], delta=1)
self.assertAlmostEqual(7.076504723057620e10, impact.at_event[12147], delta=1)
self.assertEqual(0, impact.at_event[14449])
self.assertEqual(icalc.n_exp_pnt, len(impact.eai_exp))
self.assertAlmostEqual(1.518553670803242e08, impact.eai_exp[0], delta=1)
self.assertAlmostEqual(1.373490457046383e08, impact.eai_exp[25], 6)
self.assertAlmostEqual(1.066837260150042e08, impact.eai_exp[49], 6)
self.assertAlmostEqual(6.570532945599105e11, impact.tot_value)
self.assertAlmostEqual(6.512201157564421e09, impact.aai_agg, 5)

def test_calc_impact_RF_pass(self):
haz = Hazard.from_hdf5(get_test_file("test_hazard_US_flood_random_locations"))
exp = Exposures.from_hdf5(
Expand Down Expand Up @@ -574,10 +596,13 @@ def test_single_exp_zero_mdr(self):
eai_exp = np.array([aai_agg])
at_event = np.array([imp_evt, 0])
exp.set_geometry_points()
exp.assign_centroids(haz, threshold=1)
impf_tc = ImpfTropCyclone.from_emanuel_usa()
impf_set = ImpactFuncSet([impf_tc])
impf_set.check()
imp = ImpactCalc(exp, impf_set, haz).impact(save_mat=True)
imp = ImpactCalc(exp, impf_set, haz).impact(
assign_centroids=False, save_mat=True
)
check_impact(self, imp, haz, exp, aai_agg, eai_exp, at_event, at_event)


Expand Down
66 changes: 41 additions & 25 deletions climada/entity/exposures/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,65 +591,81 @@
self,
hazard,
distance="euclidean",
threshold=u_coord.NEAREST_NEIGHBOR_THRESHOLD,
threshold=None,
overwrite=True,
):
"""Assign for each exposure coordinate closest hazard coordinate.
"""Assign for each exposure coordinate the closest hazard coordinate.
The Exposures ``gdf`` will be altered by this method. It will have an additional
(or modified) column named ``centr_[hazard.HAZ_TYPE]`` after the call.

Uses the utility function ``u_coord.match_centroids``. See there for details
and parameters.

The value -1 is used for distances larger than ``threshold`` in point distances.
In case of raster hazards the value -1 is used for centroids outside of the raster.

Parameters
----------
hazard : Hazard
Hazard to match (with raster or vector centroids).
Hazard to match. The hazard centroids must be in the same coordinate
reference system (crs) as the exposures.
distance : str, optional
Distance to use in case of vector centroids.
Distance to use for matching exposures points to hazard centroids
Possible values are "euclidean", "haversine" and "approx".
Default: "euclidean"
threshold : float
If the distance (in km) to the nearest neighbor exceeds `threshold`,
Assignement threshold in units of the exposure's crs.
If the distance to the nearest neighbor exceeds `threshold`,
the index `-1` is assigned.
Set `threshold` to 0, to disable nearest neighbor matching.
Default: 100 (km)
Set `threshold` to 0, to disable nearest neighbor matching and enforce
exact matching.
Default: twice the highest resolution (smallest distance between any two nearest neighbours) of the hazard centroids

Check warning on line 621 in climada/entity/exposures/base.py

View check run for this annotation

Jenkins - WCR / Pylint

line-too-long

LOW: Line too long (128/100)
Raw output
Used when a line is longer than a given number of characters.
overwrite: bool
If True, overwrite centroids already present. If False, do
not assign new centroids. Default is True.

See Also
--------
climada.util.coordinates.match_grid_points: method to associate centroids to
exposure points when centroids is a raster
climada.util.coordinates.match_coordinates:
method to associate centroids to exposure points
climada.util.coordinates.estimate_matching_threshold:
method to calculate the default threshold
climada.util.coordinates.km_to_degree:
method to approximately convert kilometers to degrees
climada.util.coordinates.degree_to_km:
method to approximately convert degrees to kilometers

Notes
-----
The default order of use is:

1. if centroid raster is defined, assign exposures points to
the closest raster point.
2. if no raster, assign centroids to the nearest neighbor using
euclidian metric

Both cases can introduce innacuracies for coordinates in lat/lon
coordinates as distances in degrees differ from distances in meters
on the Earth surface, in particular for higher latitude and distances
larger than 100km. If more accuracy is needed, please use 'haversine'
distance metric. This however is slower for (quasi-)gridded data,
and works only for non-gridded data.
For coordinates in lat/lon coordinates distances in degrees differ from
distances in meters on the Earth surface, in particular for higher
latitude and distances larger than 100km. If more accuracy for degree
coordinates is needed, please use 'haversine' distance metric,
which however is slower.

Caution: nearest neighbourg matching can introduce serious artefacts
such as:
- exposure and hazard centroids with shifted grids can lead
to systematically wrong assignements.
- hazard centroids covering larger areas than exposures may lead
to sub-optimal matching if the threshold is too large
- projected crs often diverge at the anti-meridian and close points
on either side will be at a large distance. For proper handling
of the anti-meridian please use degree coordinates in EPSG:4326.
This might be relevant for countries like the Fidji or the US that
cross the anti-meridian.

Users are free to implement their own matching alrogithm and save the
matching centroid index in the appropriate column ``centr_[hazard.HAZ_TYPE]``.
"""
haz_type = hazard.haz_type
centr_haz = INDICATOR_CENTR + haz_type
if centr_haz in self.gdf:
LOGGER.info("Exposures matching centroids already found for %s", haz_type)
if overwrite:
LOGGER.info("Existing centroids will be overwritten for %s", haz_type)
else:
LOGGER.info(
"Exposures matching centroids already found for %s", haz_type
)
return

LOGGER.info(
Expand All @@ -659,7 +675,7 @@
)

if not u_coord.equal_crs(self.crs, hazard.centroids.crs):
raise ValueError("Set hazard and exposure to same CRS first!")
raise ValueError("Set hazard and exposure to the same CRS first!")
# Note: equal_crs is tested here, rather than within match_centroids(),
# because exp.gdf.crs may not be defined, but exp.crs must be defined.

Expand Down
55 changes: 54 additions & 1 deletion climada/entity/exposures/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,59 @@ def test_assign_pass(self):
self.assertEqual(exp.gdf.shape[0], len(exp.hazard_centroids("FL")))
np.testing.assert_array_equal(exp.hazard_centroids("FL"), expected_result)

def test_assign_meter_crs_pass(self):
"""Check that attribute `assigned` is correctly set."""
np_rand = np.random.RandomState(123456789)

haz = Hazard.from_raster(
[HAZ_DEMO_FL], haz_type="FL", window=Window(10, 20, 50, 60)
)
ncentroids = haz.centroids.size
crs_meters = "EPSG:4087"
haz.centroids.to_crs(crs_meters, inplace=True)
exp = Exposures(
crs=haz.centroids.crs,
lon=np.concatenate(
[
haz.centroids.lon,
haz.centroids.lon + 0.001 * (-0.5 + np_rand.rand(ncentroids)),
]
),
lat=np.concatenate(
[
haz.centroids.lat,
haz.centroids.lat + 0.001 * (-0.5 + np_rand.rand(ncentroids)),
]
),
)
expected_result = np.concatenate([np.arange(ncentroids), np.arange(ncentroids)])

# make sure that it works for both float32 and float64
for test_dtype in [np.float64, np.float32]:
haz.centroids.gdf["lat"] = haz.centroids.lat.astype(test_dtype)
haz.centroids.gdf["lon"] = haz.centroids.lon.astype(test_dtype)
exp.assign_centroids(haz)
self.assertEqual(exp.gdf.shape[0], len(exp.hazard_centroids("FL")))
np.testing.assert_array_equal(exp.hazard_centroids("FL"), expected_result)

def test_assign_no_equal_crs(self):
haz = Hazard.from_raster(
[HAZ_DEMO_FL], haz_type="FL", window=Window(10, 20, 50, 60)
)
crs_km = "EPSG:4326"
crs_meters = "EPSG:4087"
exp = Exposures(
crs=crs_meters,
lon=haz.centroids.lon,
lat=haz.centroids.lat,
)
haz.centroids.to_crs(crs_km, inplace=True)
with self.assertRaises(ValueError) as cm:
exp.assign_centroids(haz)
self.assertEqual(
"Set hazard and exposure to the same CRS first!", str(cm.exception)
)

def test__init__meta_type(self):
"""Check if meta of type list raises a ValueError in __init__"""
with self.assertRaises(TypeError) as cm:
Expand Down Expand Up @@ -212,7 +265,7 @@ def test_assign_raster_pass(self):
0.0,
],
)
exp.assign_centroids(haz)
exp.assign_centroids(haz, threshold=u_coord.km_to_degree(100))

expected_result = [
# constant y-value, varying x-value
Expand Down
2 changes: 1 addition & 1 deletion climada/hazard/test/test_tc_tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,7 @@ def test_track_land_params(self):
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])
lon_shift = np.array([360, 360, 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
Expand Down
2 changes: 2 additions & 0 deletions climada/hazard/trop_cyclone/trop_cyclone_windfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,8 @@ def _coriolis_parameter(lat: np.ndarray) -> np.ndarray:
cp : np.ndarray of same shape as input
Coriolis parameter.
"""
u_coord.check_if_geo_coords(lat, 0)

return 2 * V_ANG_EARTH * np.sin(np.radians(np.abs(lat)))


Expand Down
Loading
Loading