From da542a39eb041516fbc0e5e48f07bb138541f980 Mon Sep 17 00:00:00 2001 From: shartgring <103518935+shartgring@users.noreply.github.com> Date: Thu, 1 Aug 2024 11:09:39 +0200 Subject: [PATCH] included PET test for penman-monteith-rh-simple --- tests/test_forcing.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tests/test_forcing.py b/tests/test_forcing.py index 29147202c..aedfd4f93 100644 --- a/tests/test_forcing.py +++ b/tests/test_forcing.py @@ -42,8 +42,15 @@ def test_precip(data_catalog): def test_pet(data_catalog): et_data = data_catalog.get_rasterdataset("era5_daily_zarr") dem = data_catalog.get_rasterdataset("era5_orography").squeeze("time", drop=True) - - peto = pet(et_data, et_data, dem, method="penman-monteith_tdew") - - assert peto.raster.shape == dem.raster.shape - np.testing.assert_almost_equal(peto.mean(), 0.57746, decimal=4) + + peto_tdew = pet(et_data, et_data, dem, method="penman-monteith_tdew") + assert peto_tdew.raster.shape == dem.raster.shape + np.testing.assert_almost_equal(peto_tdew.mean(), 0.57746, decimal=4) + + # Convert to relative humidity using simple approach + # as relative humidity is not provided in ERA5 data + # Lawrence (2005) dx.doi.org/10.1175/BAMS-86-2-225 + et_data['rh'] = 5*et_data['temp_dew'] + 100 - 5*et_data['temp'] + peto_simple = pet(et_data, et_data, dem, method="penman-monteith_rh_simple") + assert peto_simple.raster.shape == dem.raster.shape + np.testing.assert_almost_equal(peto_simple.mean(), 0.51279, decimal=4) \ No newline at end of file