Skip to content

Commit

Permalink
Test hgrid generator (#62)
Browse files Browse the repository at this point in the history
* added test for test quad area

* remove placeholder tests trivial

* reformat with black

* added basic test for rectangular hgrid

* Update tests/test_grid_generation.py

Co-authored-by: Navid C. Constantinou <[email protected]>

* assert output is a dataset

---------

Co-authored-by: Navid C. Constantinou <[email protected]>
  • Loading branch information
ashjbarnes and navidcy authored Sep 4, 2023
1 parent f876f88 commit 6fd32fb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_grid_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import pytest
from regional_mom6 import angle_between
from regional_mom6 import quad_area
from regional_mom6 import rectangular_hgrid
import xarray as xr


@pytest.mark.parametrize(
Expand Down Expand Up @@ -29,4 +31,12 @@ def test_quad_area(lat, lon, true_area):
assert np.isclose(np.sum(quad_area(lat, lon)), true_area)


# what to return when pytest passes
# a simple test that rectangular_hgrid runs without erroring
@pytest.mark.parametrize(
("lat", "lon"),
[
(np.linspace(0, 10, 7), np.linspace(0, 10, 13)),
],
)
def test_rectangular_hgrid(lat, lon):
assert isinstance(rectangular_hgrid(lat, lon), xr.Dataset)

0 comments on commit 6fd32fb

Please sign in to comment.