Skip to content

Commit

Permalink
Get all python tests working, increase size for TK_ROOF, and convert …
Browse files Browse the repository at this point in the history
…mask used for the mesh sys test to integer in ncap2 so that it will work
  • Loading branch information
ekluzek committed Sep 1, 2023
1 parent f6b0cb0 commit 7c067a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion python/ctsm/test/test_sys_fsurdat_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ def test_opt_sections(self):
lev2_five[2, :, :, :] = 3.0
lev2_five[3, :, :, :] = 4.0
lev2_five[4, :, :, :] = 5.0
lev2_ten = np.empty((10, 3, 5, 5))
for l in range(10):
lev2_ten[l, :, :, :] = float(l + 1)

lev1 = np.array(
[
[
Expand Down Expand Up @@ -221,7 +225,7 @@ def test_opt_sections(self):
np.testing.assert_array_equal(fsurdat_out_data.LAKEDEPTH, one0d * 200.0)
np.testing.assert_array_equal(fsurdat_out_data.T_BUILDING_MIN, lev1)
np.testing.assert_array_equal(fsurdat_out_data.ALB_ROOF_DIR, lev2_two)
np.testing.assert_array_equal(fsurdat_out_data.TK_ROOF, lev2_five)
np.testing.assert_array_equal(fsurdat_out_data.TK_ROOF, lev2_ten)

def test_1x1_mexicocity(self):
"""
Expand Down
8 changes: 5 additions & 3 deletions python/ctsm/test/test_sys_mesh_modifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ def setUp(self):
self._lon_dimname = fsurdat_in_data[self._lat_varname].dims[1]

ncap2_cmd = (
"ncap2 -A -v -s 'mod_lnd_props=LANDFRAC_PFT' "
+ "-A -v -s 'landmask=LANDFRAC_PFT' "
"ncap2 -A -v -s 'mod_lnd_props=LANDFRAC_PFT.convert(NC_INT)' "
+ "-A -v -s 'landmask=LANDFRAC_PFT.convert(NC_INT)' "
+ f"-A -v -s {self._lat_varname}={self._lat_varname} "
+ f"-A -v -s {self._lon_varname}={self._lon_varname} "
+ f"{fsurdat_in} {self._landmask_file}"
Expand Down Expand Up @@ -137,7 +137,9 @@ def test_allInfo(self):
# the Mask variable will now equal zeros, not ones
element_mask_in = mesh_mask_in_data.elementMask
element_mask_out = mesh_mask_out_data.elementMask
self.assertTrue(element_mask_out.equals(element_mask_in - 1))
self.assertTrue(
element_mask_out.equals(element_mask_in - 1)
) # The -1 is because of the comment above about the mask

def _create_config_file(self):
"""
Expand Down

0 comments on commit 7c067a4

Please sign in to comment.