diff --git a/tests/operators/test_convection.py b/tests/operators/test_convection.py index f25d27ed8..7d54dc0af 100644 --- a/tests/operators/test_convection.py +++ b/tests/operators/test_convection.py @@ -58,6 +58,24 @@ def orography_2D() -> iris.cube.Cube: return iris.load_cube("tests/test_data/convection/Orography2D.nc") +@pytest.fixture +def orography_3D() -> iris.cube.Cube: + """Get a 3D Orography cube (time).""" + return iris.load_cube("tests/test_data/convection/Orography3D.nc") + + +@pytest.fixture +def orography_3D_ens() -> iris.cube.Cube: + """Get a 3D Orography cube (realization).""" + return iris.load_cube("tests/test_data/convection/Orography3D_ens.nc") + + +@pytest.fixture +def orography_4D() -> iris.cube.Cube: + """Get a 4D Orography cube (time and realization).""" + return iris.load_cube("tests/test_data/convection/Orography4D.nc") + + def test_cape_ratio(SBCAPE, MUCAPE, MUCIN): """Compare with precalculated ratio KGOs.""" # Calculate the diagnostic. @@ -106,3 +124,30 @@ def test_inflow_layer_properties_non_masked_arrays(EIB, BLheight, orography_2D): ) precalculated = iris.load_cube("tests/test_data/convection/ECFlagD.nc") assert np.allclose(inflow_layer_properties.data, precalculated.data) + + +def test_inflow_layer_properties_3D_orography_time(EIB, BLheight, orography_3D): + """Reduce a 3D orography (time) field down to 2D.""" + inflow_layer_properties = convection.inflow_layer_properties( + EIB, BLheight, orography_3D + ) + precalculated = iris.load_cube("tests/test_data/convection/ECFlagD.nc") + assert np.allclose(inflow_layer_properties.data, precalculated.data) + + +def test_inflow_layer_properties_3D_orography_ensemble(EIB, BLheight, orography_3D_ens): + """Reduce a 3D orography (realisation) field down to 2D.""" + inflow_layer_properties = convection.inflow_layer_properties( + EIB, BLheight, orography_3D_ens + ) + precalculated = iris.load_cube("tests/test_data/convection/ECFlagD.nc") + assert np.allclose(inflow_layer_properties.data, precalculated.data) + + +def test_inflow_layer_properties_4D_orography(EIB, BLheight, orography_4D): + """Reduce a 4D orography (time and realisation) field down to 2D.""" + inflow_layer_properties = convection.inflow_layer_properties( + EIB, BLheight, orography_4D + ) + precalculated = iris.load_cube("tests/test_data/convection/ECFlagD.nc") + assert np.allclose(inflow_layer_properties.data, precalculated.data) diff --git a/tests/test_data/convection/Orography3D.nc b/tests/test_data/convection/Orography3D.nc new file mode 100644 index 000000000..a6dd6d98d Binary files /dev/null and b/tests/test_data/convection/Orography3D.nc differ diff --git a/tests/test_data/convection/Orography3D_ens.nc b/tests/test_data/convection/Orography3D_ens.nc new file mode 100644 index 000000000..5dc6435a4 Binary files /dev/null and b/tests/test_data/convection/Orography3D_ens.nc differ diff --git a/tests/test_data/convection/Orography4D.nc b/tests/test_data/convection/Orography4D.nc new file mode 100644 index 000000000..9e895cd7b Binary files /dev/null and b/tests/test_data/convection/Orography4D.nc differ