Skip to content

Commit

Permalink
Add one more acceptance test for new regridding (metoppv#1508)
Browse files Browse the repository at this point in the history
* add one more acceptance test for regridding

* change comments in test_regrid

* Update improver_tests/acceptance/test_regrid.py

Co-authored-by: Tom Gale <tom@gale.app>

Co-authored-by: Tom Gale <tom@gale.app>
  • Loading branch information
zfan001 and tjtg authored Jun 1, 2021
1 parent a4ac4a9 commit 9b48be0
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions improver_tests/acceptance/test_regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

def test_regrid_basic(tmp_path):
"""Test basic regridding"""
# KGO for this test is the same as test_regrid_check_landmask below
# KGO for this test (default: bilinear) is the same as test_regrid_bilinear_2
kgo_dir = acc.kgo_root() / "regrid"
kgo_path = kgo_dir / "basic/kgo.nc"
input_path = kgo_dir / "global_cutout.nc"
Expand All @@ -56,6 +56,27 @@ def test_regrid_basic(tmp_path):
acc.compare(output_path, kgo_path)


def test_regrid_bilinear_2(tmp_path):
"""Test bilinear-2 regridding"""
# KGO for this test is the same as test_regrid_basic
# bilinear-2 regridding produces the same result as Iris/bilinear regridding
kgo_dir = acc.kgo_root() / "regrid"
kgo_path = kgo_dir / "basic/kgo.nc"
input_path = kgo_dir / "global_cutout.nc"
target_path = kgo_dir / "ukvx_grid.nc"
output_path = tmp_path / "output.nc"
args = [
input_path,
target_path,
"--output",
output_path,
"--regrid-mode",
"bilinear-2",
]
run_cli(args)
acc.compare(output_path, kgo_path)


def test_regrid_nearest(tmp_path):
"""Test nearest neighbour regridding"""
kgo_dir = acc.kgo_root() / "regrid"
Expand Down Expand Up @@ -127,7 +148,6 @@ def test_regrid_nearest_landmask(tmp_path):
@pytest.mark.slow
def test_regrid_check_landmask(tmp_path):
"""Test land sea mask output matches other test"""
# KGO for this test is the same as test_basic above
kgo_dir = acc.kgo_root() / "regrid"
kgo_path = kgo_dir / "nearest/kgo.nc"
input_path = kgo_dir / "global_cutout.nc"
Expand Down Expand Up @@ -227,7 +247,7 @@ def test_regrid_nearest_2_multi_realization(tmp_path):


def test_regrid_bilinear_2_multi_realization(tmp_path):
"""Test bilinear-2 neighbour regridding"""
"""Test bilinear-2 regridding"""
kgo_dir = acc.kgo_root() / "regrid"
kgo_path = kgo_dir / "bilinear_2/kgo_multi_realization.nc"
input_path = kgo_dir / "landmask/global_cutout_multi_realization.nc"
Expand Down

0 comments on commit 9b48be0

Please sign in to comment.