From f38a5d67e169786789d99de9af46eb33ef4d9f13 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 18 Apr 2024 12:11:26 -0600 Subject: [PATCH] Fix utest errors: various and one still remains --- python/ctsm/test/test_unit_singlept_data.py | 4 +- .../test/test_unit_singlept_data_surfdata.py | 48 +++++++++++++++++-- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/python/ctsm/test/test_unit_singlept_data.py b/python/ctsm/test/test_unit_singlept_data.py index 1b058c8a5b..4d2e59aa32 100755 --- a/python/ctsm/test/test_unit_singlept_data.py +++ b/python/ctsm/test/test_unit_singlept_data.py @@ -39,8 +39,8 @@ class TestSinglePointCase(unittest.TestCase): evenly_split_cropland = False pct_pft = None num_pft = 16 - cth = [0.9] - cbh = [0.1] + cth = [0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9] + cbh = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] include_nonveg = False uni_snow = True cap_saturation = True diff --git a/python/ctsm/test/test_unit_singlept_data_surfdata.py b/python/ctsm/test/test_unit_singlept_data_surfdata.py index b747cb14e0..05198ab350 100755 --- a/python/ctsm/test/test_unit_singlept_data_surfdata.py +++ b/python/ctsm/test/test_unit_singlept_data_surfdata.py @@ -47,8 +47,8 @@ class TestSinglePointCaseSurfaceNoCrop(unittest.TestCase): evenly_split_cropland = False pct_pft = None num_pft = 16 - cth = [0.9] - cbh = [0.1] + cth = [0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9] + cbh = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] include_nonveg = False uni_snow = True cap_saturation = True @@ -58,6 +58,8 @@ class TestSinglePointCaseSurfaceNoCrop(unittest.TestCase): # -- dimensions of xarray dataset lsmlat = [plat] lsmlon = [plon] + months = np.arange(1, 13, 1, dtype=int) + lsmpft = np.arange(0, 79, 1, dtype=int) natpft = np.arange(0, 15, 1, dtype=int) cft = np.arange(15, 17, 1, dtype=int) numurbl = np.arange(0, 3, 1, dtype=int) @@ -139,6 +141,24 @@ class TestSinglePointCaseSurfaceNoCrop(unittest.TestCase): "units": "unitless", }, ), + "MONTHLY_HEIGHT_TOP": xr.DataArray( + data=np.random.rand(1, 1, months[-1], lsmpft[-1] + 1), + dims=["lsmlat", "lsmlon", "time", "lsmpft"], + coords={"lsmlat": lsmlat, "lsmlon": lsmlon, "time": months, "lsmpft": lsmpft}, + attrs={ + "long_name": "monthly height top by pft and month", + "units": "m", + }, + ), + "MONTHLY_HEIGHT_BOT": xr.DataArray( + data=np.random.rand(1, 1, months[-1], lsmpft[-1] + 1), + dims=["lsmlat", "lsmlon", "time", "lsmpft"], + coords={"lsmlat": lsmlat, "lsmlon": lsmlon, "time": months, "lsmpft": lsmpft}, + attrs={ + "long_name": "monthly height bottom by pft and month", + "units": "m", + }, + ), }, attrs={"Conventions": "test data only"}, ) @@ -642,8 +662,8 @@ class TestSinglePointCaseSurfaceCrop(unittest.TestCase): evenly_split_cropland = False pct_pft = None num_pft = 78 - cth = [0.9] - cbh = [0.1] + cth = [0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9, 0.9] + cbh = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1] include_nonveg = False uni_snow = False cap_saturation = False @@ -653,6 +673,8 @@ class TestSinglePointCaseSurfaceCrop(unittest.TestCase): # -- dimensions of xarray dataset lsmlat = [plat] lsmlon = [plon] + months = np.arange(1, 12, 1, dtype=int) + lsmpft = np.arange(0, 79, 1, dtype=int) natpft = np.arange(0, 15, 1, dtype=int) cft = np.arange(15, 79, 1, dtype=int) numurbl = np.arange(0, 3, 1, dtype=int) @@ -734,6 +756,24 @@ class TestSinglePointCaseSurfaceCrop(unittest.TestCase): "units": "unitless", }, ), + "MONTHLY_HEIGHT_TOP": xr.DataArray( + data=np.random.rand(1, 1, months[-1], lsmpft[-1] + 1), + dims=["lsmlat", "lsmlon", "time", "lsmpft"], + coords={"lsmlat": lsmlat, "lsmlon": lsmlon, "time": months, "lsmpft": lsmpft}, + attrs={ + "long_name": "monthly height top by pft and month", + "units": "m", + }, + ), + "MONTHLY_HEIGHT_BOT": xr.DataArray( + data=np.random.rand(1, 1, months[-1], lsmpft[-1] + 1), + dims=["lsmlat", "lsmlon", "time", "lsmpft"], + coords={"lsmlat": lsmlat, "lsmlon": lsmlon, "time": months, "lsmpft": lsmpft}, + attrs={ + "long_name": "monthly height bottom by pft and month", + "units": "m", + }, + ), }, attrs={"Conventions": "test data only"}, )