Skip to content

Commit 5b984da

Browse files
authored
add FMS support library to new CASE_SUPPORT_LIBRARIES variable (#276)
* add FMS support library to new CASE_SUPPORT_LIBRARIES variable (moved from cime) * handle backward compatiblity
1 parent 31a16bb commit 5b984da

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cime_config/buildnml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import logging
1515
CIMEROOT = os.environ.get("CIMEROOT")
1616
if CIMEROOT is None:
1717
raise SystemExit("ERROR: must set CIMEROOT environment variable")
18-
sys.path.append(os.path.join(CIMEROOT, "scripts", "Tools"))
18+
sys.path.append(os.path.join(CIMEROOT, "CIME", "Tools"))
1919

2020
# The scope of the following path expansion is limited to this script only,
2121
# and is needed to import MOM6 input file classes:
@@ -433,7 +433,15 @@ def buildnml(case, caseroot, compname):
433433
# Build the component namelist
434434
if compname != "mom":
435435
raise AttributeError
436-
436+
# add the FMS library to the list of cesm support libraries for the case
437+
# designed to be backward compatible in case cmeps does not define CASE_SUPPORT_LIBRARIES
438+
try:
439+
libs = case.get_values("CASE_SUPPORT_LIBRARIES")
440+
if libs is not None and "FMS" not in libs:
441+
libs.extend(["gptl","pio","csm_share","FMS"])
442+
case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs))
443+
except:
444+
pass
437445
ninst = case.get_value("NINST_OCN")
438446
inst_suffixes = (
439447
["_{:04d}".format(i + 1) for i in range(ninst)] if ninst > 1 else [""]
@@ -460,7 +468,7 @@ def buildnml(case, caseroot, compname):
460468
def _main_func():
461469

462470
caseroot = parse_input(sys.argv)
463-
with Case(caseroot) as case:
471+
with Case(caseroot, read_only=False) as case:
464472
buildnml(case, caseroot, "mom")
465473

466474

0 commit comments

Comments
 (0)