Skip to content

Commit

Permalink
Make datm buildnml more robust.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Sep 5, 2024
1 parent 1e403a8 commit b1f1751
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions datm/cime_config/buildnml
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
# Get anomaly forcing
# First, look in namelist
anomaly_forcing = nmlgen.get_value("anomaly_forcing")
if anomaly_forcing[0] is None:
if anomaly_forcing and anomaly_forcing[0] is None:
# If not in namelist, check whether it's an SSP compset
ssp = re.search(r"^SSP\d+_DATM", compset).group()
ssp = re.search(r"^SSP\d+_DATM", compset)
if ssp:
ssp = ssp.replace("_DATM", "")
ssp = ssp.group().replace("_DATM", "")
anomaly_forcing = ["Anomaly.Forcing.cmip6." + ssp.lower()]
nmlgen.set_value("anomaly_forcing", anomaly_forcing)

Expand Down

0 comments on commit b1f1751

Please sign in to comment.