Skip to content
Merged
Changes from 1 commit
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
30 changes: 14 additions & 16 deletions lib/iris/tests/integration/analysis/test_area_weighted.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,25 @@
# See LICENSE in the root of the repository for full licensing details.
"""Integration tests for area weighted regridding."""

# Import iris.tests first so that some things can be initialised before
# importing anything else.
import iris.tests as tests # isort:skip
import pytest

import iris
from iris.analysis import AreaWeighted
from iris.tests import _shared_utils


@tests.skip_data
class AreaWeightedTests(tests.IrisTest):
def setUp(self):
@_shared_utils.skip_data
class TestAreaWeighted:
@pytest.fixture(autouse=True)
def _setup(self):
# Prepare a cube and a template

cube_file_path = tests.get_data_path(["NetCDF", "regrid", "regrid_xyt.nc"])
cube_file_path = _shared_utils.get_data_path(
["NetCDF", "regrid", "regrid_xyt.nc"]
)
self.cube = iris.load_cube(cube_file_path)

template_file_path = tests.get_data_path(
template_file_path = _shared_utils.get_data_path(
["NetCDF", "regrid", "regrid_template_global_latlon.nc"]
)
self.template_cube = iris.load_cube(template_file_path)
Expand All @@ -29,8 +31,8 @@ def test_regrid_area_w_lazy(self):
# Regrid the cube onto the template.
out = self.cube.regrid(self.template_cube, AreaWeighted())
# Check data is still lazy
self.assertTrue(self.cube.has_lazy_data())
self.assertTrue(out.has_lazy_data())
assert self.cube.has_lazy_data()
assert out.has_lazy_data()
# Save the data
with self.temp_filename(suffix=".nc") as fname:
iris.save(out, fname)
Expand All @@ -41,8 +43,8 @@ def test_regrid_area_w_lazy_chunked(self):
# Regrid the cube onto the template.
out = self.cube.regrid(self.template_cube, AreaWeighted())
# Check data is still lazy
self.assertTrue(self.cube.has_lazy_data())
self.assertTrue(out.has_lazy_data())
assert self.cube.has_lazy_data()
assert out.has_lazy_data()
# Save the data
with self.temp_filename(suffix=".nc") as fname:
iris.save(out, fname)
Expand All @@ -66,7 +68,3 @@ def test_regrid_area_w_real_start(self):
# Save the data
with self.temp_filename(suffix=".nc") as fname:
iris.save(out, fname)


if __name__ == "__main__":
tests.main()
Loading