Skip to content

Commit 9b5600e

Browse files
authored
assert that λ and φ are monotonically increasing (#127)
1 parent 89e57ce commit 9b5600e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

regional_mom6/regional_mom6.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ def rectangular_hgrid(λ, φ):
410410
xarray.Dataset: An FMS-compatible ``hgrid`` that includes all required attributes.
411411
"""
412412

413+
assert np.all(np.diff(λ) > 0), "longitudes array λ must be monotonically increasing"
414+
assert np.all(np.diff(φ) > 0), "latitudes array φ must be monotonically increasing"
415+
413416
R = 6371e3 # mean radius of the Earth; https://en.wikipedia.org/wiki/Earth_radius
414417

415418
# compute longitude spacing and ensure that longitudes are uniformly spaced

0 commit comments

Comments
 (0)