Skip to content

Commit 4434801

Browse files
authored
Merge pull request #2686 from samsrabin/ssp-anomaly-fixes
ctsm5.3.053: Fix and improve anomaly forcings for ISSP cases
2 parents 39ccc2f + e1fbca6 commit 4434801

File tree

17 files changed

+299
-67
lines changed

17 files changed

+299
-67
lines changed

.github/workflows/validate_xml.py

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
"""
2+
Check that all XML files in our repo (except for those in submodules) are well-formed. Error if not.
3+
"""
4+
import sys
5+
import glob
6+
import os
7+
import subprocess
8+
import xml.etree.ElementTree as ET
9+
10+
11+
def get_submodule_paths():
12+
"""
13+
Get list of submodules
14+
"""
15+
cmd = "git config --file .gitmodules --get-regexp path | awk '{ print $2 }'"
16+
result = subprocess.run(cmd, capture_output=True, text=True, shell=True, check=True)
17+
result_list = result.stdout.split("\n")[:-1]
18+
result_list = [x for x in result_list if x]
19+
return result_list
20+
21+
22+
def is_in_submodule(file_path, submodule):
23+
"""
24+
Return True if file is in given submodule, False otherwise
25+
"""
26+
return os.path.commonpath([file_path, submodule]) == os.path.commonpath([submodule])
27+
28+
29+
def is_in_any_submodule(file_path, submodule_paths):
30+
"""
31+
Return True if file is in any submodule, False otherwise
32+
"""
33+
file_path = os.path.abspath(file_path)
34+
submodule_paths = map(os.path.abspath, submodule_paths)
35+
return any(is_in_submodule(file_path, submodule) for submodule in submodule_paths)
36+
37+
38+
def validate_xml(file_path):
39+
"""
40+
Return True if XML file is well-formed, False otherwise
41+
"""
42+
try:
43+
ET.parse(file_path)
44+
except ET.ParseError:
45+
print(f"❌ {file_path} is NOT well-formed")
46+
return False
47+
print(f"✅ {file_path} is well-formed")
48+
return True
49+
50+
51+
def main():
52+
# pylint: disable=missing-function-docstring
53+
submodule_paths = get_submodule_paths()
54+
all_valid = True
55+
for xml_file in glob.glob("**/*.xml", recursive=True):
56+
if is_in_any_submodule(xml_file, submodule_paths):
57+
continue
58+
if not validate_xml(xml_file):
59+
all_valid = False
60+
61+
if not all_valid:
62+
print("\nUse xmllint to show problems in malformed files")
63+
64+
return all_valid
65+
66+
67+
sys.exit(0 if main() else 1)

.github/workflows/xml-check.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Check that XML files are well-formed
2+
# Only check files in our repo that AREN'T in submodules
3+
# Use a Python command to check each file because xmllint isn't available on GH runners
4+
5+
on: [push, pull_request] # Trigger on push or pull request
6+
7+
jobs:
8+
check-xml:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: '3.x'
18+
19+
- name: Check XML files
20+
run: python .github/workflows/validate_xml.py

cime_config/testdefs/ExpectedTestFails.xml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,21 @@
3939
<test name="SMS_Ld5.f09_t232.ISSP245Clm60BgcCropCrujra.derecho_intel.clm-ciso_dec2050Start">
4040
<phase name="SETUP">
4141
<status>FAIL</status>
42-
<issue>#2686</issue>
42+
<issue>#3209</issue>
4343
</phase>
4444
</test>
4545

4646
<test name="SMS_Ld5.f09_t232.ISSP370Clm60BgcCropCrujra.derecho_intel.clm-ciso_dec2050Start">
4747
<phase name="SETUP">
4848
<status>FAIL</status>
49-
<issue>#2686</issue>
49+
<issue>#3209</issue>
5050
</phase>
5151
</test>
5252

5353
<test name="SMS_Ld5.f09_t232.ISSP585Clm60BgcCropCrujra.derecho_intel.clm-ciso_dec2050Start">
5454
<phase name="SETUP">
5555
<status>FAIL</status>
56-
<issue>#2686</issue>
56+
<issue>#3209</issue>
5757
</phase>
5858
</test>
5959

@@ -159,11 +159,15 @@
159159
</phase>
160160
</test>
161161

162-
<test name="FUNITCTSM_P1x1.f10_f10_mg37.I2000Clm50Sp.izumi_intel"
162+
<test name="FUNITCTSM_P1x1.f10_f10_mg37.I2000Clm50Sp.izumi_intel">
163163
<phase name="MODEL_BUILD">
164164
<status>FAIL</status>
165165
<issue>#3182</issue>
166166
</phase>
167+
<phase name="RUN">
168+
<status>FAIL</status>
169+
<issue>#3182</issue>
170+
</phase>
167171
</test>
168172

169173
<test name="SMS_Ld10_D_Mmpi-serial.CLM_USRDAT.I1PtClm60Bgc.izumi_nag.clm-default--clm-NEON-HARV--clm-matrixcnOn">

cime_config/testdefs/testlist_clm.xml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3073,6 +3073,65 @@
30733073
<option name="comment">Transient production test with clm6, t232, and Crujra while the defaults have not changed</option>
30743074
</options>
30753075
</test>
3076+
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP126Clm50BgcCrop" testmods="clm/default">
3077+
<machines>
3078+
<machine name="derecho" compiler="intel" category="aux_clm"/>
3079+
<machine name="derecho" compiler="intel" category="ssp"/>
3080+
</machines>
3081+
<options>
3082+
<option name="wallclock">00:20:00</option>
3083+
<option name="comment">Transient production with anomaly forcing future scenario SSP1-2.6 case</option>
3084+
</options>
3085+
</test>
3086+
<test name="SMS_D_Ld5" grid="f10_f10_mg37" compset="ISSP245Clm50BgcCrop" testmods="clm/default">
3087+
<machines>
3088+
<machine name="derecho" compiler="intel" category="aux_clm"/>
3089+
<machine name="derecho" compiler="intel" category="ssp"/>
3090+
</machines>
3091+
<options>
3092+
<option name="wallclock">00:20:00</option>
3093+
<option name="comment" >Transient production with anomaly forcing future scenario SSP2-4.5 case</option>
3094+
</options>
3095+
</test>
3096+
<test name="SMS_D_Ld5" grid="f10_f10_mg37" compset="ISSP245Clm50BgcCrop" testmods="clm/default--clm/noAnomalyForcing">
3097+
<machines>
3098+
<machine name="derecho" compiler="intel" category="ssp"/>
3099+
</machines>
3100+
<options>
3101+
<option name="wallclock">00:20:00</option>
3102+
<option name="comment" >Transient production with future scenario SSP2-4.5 but NO anomaly forcing</option>
3103+
</options>
3104+
</test>
3105+
<test name="SMS_D_Ld5" grid="f10_f10_mg37" compset="ISSP245Clm50BgcCrop" testmods="clm/datm_rcp45_anom_forc">
3106+
<machines>
3107+
<machine name="derecho" compiler="intel" category="aux_clm"/>
3108+
<machine name="derecho" compiler="intel" category="ssp"/>
3109+
</machines>
3110+
<options>
3111+
<option name="wallclock">00:20:00</option>
3112+
<option name="comment" >Transient production with anomaly forcing future scenario RCP4.5 (CMIP5) case</option>
3113+
</options>
3114+
</test>
3115+
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP370Clm50BgcCrop" testmods="clm/default">
3116+
<machines>
3117+
<machine name="derecho" compiler="intel" category="ssp"/>
3118+
</machines>
3119+
<options>
3120+
<option name="wallclock">00:20:00</option>
3121+
<option name="comment" >Transient production with anomaly forcing future scenario SSP3-7.0 case</option>
3122+
</options>
3123+
</test>
3124+
<test name="SMS_D_Ld5" grid="f09_g17" compset="ISSP585Clm50BgcCrop" testmods="clm/default">
3125+
<machines>
3126+
<machine name="derecho" compiler="intel" category="ssp"/>
3127+
</machines>
3128+
<options>
3129+
<option name="wallclock">00:20:00</option>
3130+
<option name="comment" >Transient production with anomaly forcing future scenario SSP5-8.5 case</option>
3131+
</options>
3132+
</test>
3133+
3134+
30763135
<test name="ERP_D_Ld5" grid="f10_f10_mg37" compset="I1850Clm50Bgc" testmods="clm/nlevgrnd_small">
30773136
<machines>
30783137
<machine name="derecho" compiler="intel" category="aux_clm">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
anomaly_forcing = 'Anomaly.Forcing.cmip5.rcp45'

cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm

Lines changed: 0 additions & 1 deletion
This file was deleted.

cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm_streams

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
anomaly_forcing = 'none'
2+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
anomaly_forcing = 'none'

0 commit comments

Comments
 (0)