From 9b5600e856bded2dddf0991aa009050dd34ea618 Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Tue, 19 Mar 2024 06:30:20 +0200 Subject: [PATCH] =?UTF-8?q?assert=20that=20=CE=BB=20and=20=CF=86=20are=20m?= =?UTF-8?q?onotonically=20increasing=20(#127)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- regional_mom6/regional_mom6.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/regional_mom6/regional_mom6.py b/regional_mom6/regional_mom6.py index 98e30a19..2cb4d47b 100644 --- a/regional_mom6/regional_mom6.py +++ b/regional_mom6/regional_mom6.py @@ -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