Skip to content

Commit 04e289d

Browse files
change bounds order for consistency
1 parent 68549d8 commit 04e289d

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

climada/hazard/tc_tracks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3015,7 +3015,7 @@ def compute_track_density(
30153015
res: int (optional), default: 5°
30163016
resolution in degrees of the grid bins in which the density will be computed
30173017
bounds: tuple, (optional) dafault: None
3018-
(lat_min,lat_max,lon_min,lon_max) latitude and longitude bounds.
3018+
(lon_min, lat_min, lon_max, lat_max) latitude and longitude bounds.
30193019
genesis: bool, (optional) default = False
30203020
If true the function computes the track density of only the genesis location of tracks
30213021
norm: str (optional), default: None
@@ -3066,9 +3066,9 @@ def compute_track_density(
30663066

30673067
# define grid resolution and bounds for density computation
30683068
if not bounds:
3069-
lat_min, lat_max, lon_min, lon_max = -90, 90, -180, 180
3069+
lon_min, lat_min, lon_max, lat_max = -180, -90, 180, 90
30703070
else:
3071-
lat_min, lat_max, lon_min, lon_max = bounds[0], bounds[1], bounds[2], bounds[3]
3071+
lon_min, lat_min, lon_max, lat_max = bounds[0], bounds[1], bounds[2], bounds[3]
30723072

30733073
lat_bins: np.ndarray = np.linspace(lat_min, lat_max, int(180 / res))
30743074
lon_bins: np.ndarray = np.linspace(lon_min, lon_max, int(360 / res))

climada/util/coordinates.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ def compute_grid_cell_area(
541541
res: float
542542
Grid resolution in degrees
543543
bounds: tuple, dafault: None
544-
(lat_min,lat_max,lon_min,lon_max) latitude and longitude bounds to compute grid cell area
544+
(lon_min, lat_min, lon_max, lat_max) latitude and longitude bounds to compute grid cell area
545545
projection: str
546546
Ellipsoid or spherical projection to approximate Earth. To get the complete list of
547547
projections call :py:meth:`pyproj.get_ellps_map()`. Widely used projections:
@@ -560,17 +560,17 @@ def compute_grid_cell_area(
560560
--------
561561
>>> area = compute_grid_areas(res = 1, projection ="sphere", units = "m^2")
562562
"""
563-
geod = Geod(ellps=projection) # Use specified ellipsoid model
563+
geod = Geod(ellps=projection)
564564

565565
if not bounds:
566-
lat_min, lat_max, lon_min, lon_max = -90, 90, -180, 180
566+
lon_min, lat_min, lon_max, lat_max = -180, -90, 180, 90
567567
else:
568-
lat_min, lat_max, lon_min, lon_max = bounds[0], bounds[1], bounds[2], bounds[3]
568+
lon_min, lat_min, lon_max, lat_max = bounds[0], bounds[1], bounds[2], bounds[3]
569569

570570
lat_edges: np.ndarray = np.linspace(lat_min, lat_max, int(180 / res))
571571
lon_edges: np.ndarray = np.linspace(lon_min, lon_max, int(360 / res))
572572

573-
area = np.zeros((len(lat_edges) - 1, len(lon_edges) - 1)) # Create an empty grid
573+
area = np.zeros((len(lat_edges) - 1, len(lon_edges) - 1))
574574

575575
# Iterate over consecutive latitude and longitude edges
576576
for i, (lat1, lat2) in enumerate(zip(lat_edges[:-1], lat_edges[1:])):

0 commit comments

Comments
 (0)