Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add one more acceptance test for new regridding #1508

Merged
merged 3 commits into from
Jun 1, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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