Skip to content

Remove implicit use of CRS in code base #1020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 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
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
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 @@ -1341,7 +1341,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
9 changes: 9 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,15 @@
cp : np.ndarray of same shape as input
Coriolis parameter.
"""
if not u_coord.check_if_geo_coords(lat, 0):
raise ValueError(

Check warning on line 906 in climada/hazard/trop_cyclone/trop_cyclone_windfields.py

View check run for this annotation

Jenkins - WCR / Code Coverage

Not covered line

Line 906 is not covered by tests
"Input lat and lon coordinates do not seem to correspond"
" to geographic coordinates in degrees. This can be because"
" total extents are > 180 for lat or > 360 for lon, lat coordinates"
" are outside of -90<lat<90, or lon coordinates are outside of -540<lon<540."
" If you use degree values outside of these ranges,"
" please shift the coordinates to the valid ranges."
)
return 2 * V_ANG_EARTH * np.sin(np.radians(np.abs(lat)))


Expand Down
Loading
Loading