From 4247900d5bae4c9b941c2da8a18f18ee1520e39c Mon Sep 17 00:00:00 2001 From: "Navid C. Constantinou" Date: Sun, 18 Feb 2024 10:30:34 +0200 Subject: [PATCH] add test for layer thickness profile generation --- tests/test_grid_generation.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_grid_generation.py b/tests/test_grid_generation.py index ea0f7662..3ef714d8 100644 --- a/tests/test_grid_generation.py +++ b/tests/test_grid_generation.py @@ -1,5 +1,6 @@ import numpy as np import pytest +from regional_mom6 import dz_hyperbolictan from regional_mom6 import angle_between from regional_mom6 import latlon_to_cartesian from regional_mom6 import quadrilateral_area @@ -8,6 +9,23 @@ import xarray as xr +@pytest.mark.parametrize( + ("nlayers", "ratio", "target_depth"), + [ + (20, 1/3, 1000), + (20, 2, 1000), + (20, 10, 1000), + (20, 2, 3000), + (50, 1/3, 1000), + (50, 2, 1000), + (50, 10, 1000), + (50, 2, 3000), + ], +) +def test_dz_hyperbolictan(nlayers, ratio, target_depth): + assert np.isclose(dz_hyperbolictan(nlayers, ratio, target_depth), + np.flip(dz_hyperbolictan(nlayers, 1 / ratio, target_depth))).all() + @pytest.mark.parametrize( ("lat", "lon", "true_xyz"), [