Skip to content

Commit

Permalink
assert that λ and φ are monotonically increasing (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy authored Mar 19, 2024
1 parent 89e57ce commit 9b5600e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ def rectangular_hgrid(λ, φ):
xarray.Dataset: An FMS-compatible ``hgrid`` that includes all required attributes.
"""

assert np.all(np.diff(λ) > 0), "longitudes array λ must be monotonically increasing"
assert np.all(np.diff(φ) > 0), "latitudes array φ must be monotonically increasing"

R = 6371e3 # mean radius of the Earth; https://en.wikipedia.org/wiki/Earth_radius

# compute longitude spacing and ensure that longitudes are uniformly spaced
Expand Down

0 comments on commit 9b5600e

Please sign in to comment.