From bf4fd053cb6d4bfbc692aafa62fe135d50f264fe Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 21 Aug 2025 08:09:41 -0600 Subject: [PATCH 1/2] add FMS support library to new CASE_SUPPORT_LIBRARIES variable (moved from cime) --- cime_config/buildnml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 68fcb89d..ad1bc6e0 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -15,7 +15,7 @@ import logging CIMEROOT = os.environ.get("CIMEROOT") if CIMEROOT is None: raise SystemExit("ERROR: must set CIMEROOT environment variable") -sys.path.append(os.path.join(CIMEROOT, "scripts", "Tools")) +sys.path.append(os.path.join(CIMEROOT, "CIME", "Tools")) # The scope of the following path expansion is limited to this script only, # and is needed to import MOM6 input file classes: @@ -433,7 +433,13 @@ def buildnml(case, caseroot, compname): # Build the component namelist if compname != "mom": raise AttributeError + # add the FMS library to the list of cesm support libraries for the case + libs = case.get_values("CASE_SUPPORT_LIBRARIES") + if "FMS" not in libs: + libs.extend(["gptl","pio","csm_share","FMS"]) + case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) + ninst = case.get_value("NINST_OCN") inst_suffixes = ( ["_{:04d}".format(i + 1) for i in range(ninst)] if ninst > 1 else [""] @@ -460,7 +466,7 @@ def buildnml(case, caseroot, compname): def _main_func(): caseroot = parse_input(sys.argv) - with Case(caseroot) as case: + with Case(caseroot, read_only=False) as case: buildnml(case, caseroot, "mom") From 537652c984c62658c24890395b7468217116685f Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 28 Aug 2025 09:48:18 -0600 Subject: [PATCH 2/2] handle backward compatiblity --- cime_config/buildnml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index ad1bc6e0..16dcdfbc 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -434,12 +434,14 @@ def buildnml(case, caseroot, compname): if compname != "mom": raise AttributeError # add the FMS library to the list of cesm support libraries for the case - libs = case.get_values("CASE_SUPPORT_LIBRARIES") - if "FMS" not in libs: - libs.extend(["gptl","pio","csm_share","FMS"]) - - case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) - + # designed to be backward compatible in case cmeps does not define CASE_SUPPORT_LIBRARIES + try: + libs = case.get_values("CASE_SUPPORT_LIBRARIES") + if libs is not None and "FMS" not in libs: + libs.extend(["gptl","pio","csm_share","FMS"]) + case.set_value("CASE_SUPPORT_LIBRARIES", ",".join(libs)) + except: + pass ninst = case.get_value("NINST_OCN") inst_suffixes = ( ["_{:04d}".format(i + 1) for i in range(ninst)] if ninst > 1 else [""]