Skip to content

Commit

Permalink
reformat using black
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Apr 1, 2024
1 parent 79d431f commit 29f5bbb
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ _config_cache_template = """
</config_definition>
"""


###############################################################################
def buildnml(case, caseroot, compname):
###############################################################################
Expand Down Expand Up @@ -97,7 +98,9 @@ def buildnml(case, caseroot, compname):
clm_phys = case.get_value("CLM_PHYSICS_VERSION")

config_cache_text = _config_cache_template.format(clm_phys=clm_phys)
config_cache_path = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml")
config_cache_path = os.path.join(
caseroot, "Buildconf", compname + "conf", "config_cache.xml"
)
with open(config_cache_path, "w") as config_cache_file:
config_cache_file.write(config_cache_text)

Expand Down Expand Up @@ -154,7 +157,6 @@ def buildnml(case, caseroot, compname):
else:
nomeg = ""


glc_use_antarctica = cism_use_antarctica
if glc_use_antarctica is None:
glc_use_antarctica = dglc_use_antarctica
Expand All @@ -171,12 +173,16 @@ def buildnml(case, caseroot, compname):
if cism_use_antarctia:
expect(
False,
"Unexpected value for CISM_USE_ANTARCTICA: {}".format(cism_use_antarctica),
"Unexpected value for CISM_USE_ANTARCTICA: {}".format(
cism_use_antarctica
),
)
else:
expect(
False,
"Unexpected value for DGLC_USE_ANTARCTICA: {}".format(dglc_use_antarctica),
"Unexpected value for DGLC_USE_ANTARCTICA: {}".format(
dglc_use_antarctica
),
)

if clm_nml_use_case != "UNSET":
Expand Down Expand Up @@ -212,7 +218,9 @@ def buildnml(case, caseroot, compname):
lndfrac_file = os.path.join(lnd_domain_path, lnd_domain_file)
lndfrac_setting = "-lnd_frac " + lndfrac_file

config_cache_file = os.path.join(caseroot, "Buildconf", compname + "conf", "config_cache.xml")
config_cache_file = os.path.join(
caseroot, "Buildconf", compname + "conf", "config_cache.xml"
)

# -----------------------------------------------------
# Clear out old data
Expand All @@ -227,7 +235,6 @@ def buildnml(case, caseroot, compname):

ninst = int(ninst_lnd)
for inst_counter in range(1, ninst + 1):

# determine instance string
inst_string = ""
if ninst > 1:
Expand Down Expand Up @@ -275,7 +282,9 @@ def buildnml(case, caseroot, compname):
break

if not os.path.exists(os.path.join(rundir, clm_startfile)):
logger.warning("WARNING: Could NOT find a start file to use using" + clm_startfile)
logger.warning(
"WARNING: Could NOT find a start file to use using" + clm_startfile
)
clm_icfile = "%s = '%s'" % (startfile_type, clm_startfile)
else:
clm_icfile = ""
Expand All @@ -286,7 +295,9 @@ def buildnml(case, caseroot, compname):
user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string)
namelist_infile = os.path.join(ctsmconf, "namelist")

create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines))
create_namelist_infile(
case, user_nl_file, namelist_infile, "\n".join(infile_lines)
)

cmd = os.path.join(lnd_root, "bld", "build-namelist")

Expand Down Expand Up @@ -349,7 +360,6 @@ def buildnml(case, caseroot, compname):

###############################################################################
def _main_func():

caseroot = parse_input(sys.argv)
with Case(caseroot) as case:
compname = case.get_value("COMP_LND")
Expand Down

0 comments on commit 29f5bbb

Please sign in to comment.