diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py
index 3d653745a..c4ea12df6 100644
--- a/cime_config/stream_cdeps.py
+++ b/cime_config/stream_cdeps.py
@@ -336,14 +336,30 @@ def create_stream_xml(
),
)
if var_key in valid_values:
+
+ # # Handle, e.g., 'bilinear' in namelist instead of bilinear (no quotes)
+ mod_dict_var_key = mod_dict[var_key]
+
+ # Check that key is valid
+ is_valid = mod_dict_var_key in valid_values[var_key]
+ msg = "{} can only have values of {} for stream {} in file {}, not {}".format(
+ var_key,
+ valid_values[var_key],
+ stream_name,
+ user_mods_file,
+ mod_dict[var_key],
+ )
+ if not is_valid:
+ # Check for surrounding quote marks
+ has_surrounding_quotes = (
+ (mod_dict_var_key[0] == mod_dict_var_key[-1] == "'") or
+ (mod_dict_var_key[0] == mod_dict_var_key[-1] == '"')
+ )
+ if has_surrounding_quotes and mod_dict_var_key[1:-1] in valid_values[var_key]:
+ msg += " (try removing surrounding quotes)"
expect(
- mod_dict[var_key] in valid_values[var_key],
- "{} can only have values of {} for stream {} in file {}".format(
- var_key,
- valid_values[var_key],
- stream_name,
- user_mods_file,
- ),
+ is_valid,
+ msg,
)
stream_vars["stream_" + var_key] = mod_dict[var_key]
if var_key == "datafiles":
diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml
index 28e341c02..17e24b8cc 100755
--- a/datm/cime_config/buildnml
+++ b/datm/cime_config/buildnml
@@ -10,6 +10,7 @@
# pylint: disable=wildcard-import,unused-wildcard-import,wrong-import-position
import os, sys
+import re
_CDEPS_CONFIG = os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir,os.pardir,"cime_config")
_CIMEROOT = os.environ.get("CIMEROOT")
@@ -115,6 +116,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
atm_grid = case.get_value("ATM_GRID")
model_grid = case.get_value("GRID")
comp_lnd = case.get_value("COMP_LND")
+ compset = case.get_value("COMPSET")
# Check for incompatible options.
if "CLM" in datm_mode and comp_lnd == "clm":
@@ -135,6 +137,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
logger.debug("DATM preso3 mode is {}".format(datm_preso3))
logger.debug("DATM topo mode is {}".format(datm_topo))
logger.debug("CLM_USRDAT_NAME is {}".format(clm_usrdat_name))
+ logger.debug("COMPSET is {}".format(compset))
# Initialize namelist defaults
config = {}
@@ -177,6 +180,17 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
nmlgen.init_defaults(infile, config)
+ # Get anomaly forcing
+ # First, look in namelist
+ anomaly_forcing = nmlgen.get_value("anomaly_forcing")
+ if not anomaly_forcing or anomaly_forcing[0] is None:
+ # If not in namelist, check whether it's an SSP compset
+ ssp = re.search(r"^SSP\d+_DATM", compset)
+ if ssp:
+ ssp = ssp.group().replace("_DATM", "")
+ anomaly_forcing = ["Anomaly.Forcing.cmip6." + ssp.lower()]
+ nmlgen.set_value("anomaly_forcing", anomaly_forcing)
+
# Generate datm_in
namelist_file = os.path.join(confdir, "datm_in")
nmlgen.write_output_file(namelist_file, data_list_path, groups=['datm_nml','const_forcing_nml'])
@@ -205,8 +219,10 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path
bias_correct = nmlgen.get_value("bias_correct")
if bias_correct is not None:
streamlist.append(bias_correct)
+
+ # Set anomaly forcing in datm.streams.xml
anomaly_forcing = nmlgen.get_value("anomaly_forcing")
- if anomaly_forcing[0] is not None:
+ if anomaly_forcing[0] is not None and anomaly_forcing[0] != "none":
streamlist += anomaly_forcing
# Generate datm.streams.xml
diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml
index 1fa6aa2f9..fb5cd7861 100644
--- a/datm/cime_config/namelist_definition_datm.xml
+++ b/datm/cime_config/namelist_definition_datm.xml
@@ -224,7 +224,7 @@
char(10)
datm
datm_nml
- Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave
+ none,Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.cmip6.ssp245,Anomaly.Forcing.cmip6.ssp370,Anomaly.Forcing.cmip6.ssp585
If set, include anomaly forcing streams in namelist.
diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml
index 07be39a6d..bf42d98c4 100644
--- a/datm/cime_config/stream_definition_datm.xml
+++ b/datm/cime_config/stream_definition_datm.xml
@@ -209,16 +209,13 @@
topo.cplhist
========================
- optional streams anonomly forcing (turned on and set my datm_nml variable anomoly_forcing
+ optional streams anonomly forcing (turned on and set my datm_nml variable anomaly_forcing
========================
- Anomaly.Forcing.Humidity
- Anomaly.Forcing.Longwave
- Anomaly.Forcing.Precip
- Anomaly.Forcing.Pressure
- Anomaly.Forcing.Shortwave
- Anomaly.Forcing.Temperature
- Anomaly.Forcing.Uwind
- Anomaly.Forcing.Vwind
+ Anomaly.Forcing.cmip5.rcp45
+ Anomaly.Forcing.cmip6.ssp126
+ Anomaly.Forcing.cmip6.ssp245
+ Anomaly.Forcing.cmip6.ssp370
+ Anomaly.Forcing.cmip6.ssp585
========================
optional streams bias correction (turned on and set my datm_nml variable bias_correct)
@@ -1171,49 +1168,25 @@
-
+
-
-
+
+
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
+ $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.pr.ccsm4.rcp45.2006-2300.nc
+ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.allvars.ccsm4.rcp45.2006-2300.nc
+ huss Sa_shum_af
pr Faxa_prec_af
-
- null
-
- bilinear
-
- null
- 2006
- 2006
- 2300
- 0
-
- nearest
-
-
- cycle
-
-
- 1.5
-
- single
-
-
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc
-
-
+ ps Sa_pbot_af
+ rlds Faxa_lwdn_af
+ rsds Faxa_swdn_af
tas Sa_tbot_af
+ uas Sa_u_af
+ vas Sa_v_af
null
@@ -1236,24 +1209,31 @@
single
-
+
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
+ $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.ps.ccsm4.rcp45.2006-2300.nc
+ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP1-2.6/af.allvars.CESM.SSP1-2.6.2015-2100_c20220628.nc
+ huss Sa_shum_af
+ pr Faxa_prec_af
ps Sa_pbot_af
+ rlds Faxa_lwdn_af
+ rsds Faxa_swdn_af
+ tas Sa_tbot_af
+ uas Sa_u_af
+ vas Sa_v_af
null
bilinear
null
- 2006
- 2006
- 2300
+ 2015
+ 2015
+ 2100
0
nearest
@@ -1267,76 +1247,21 @@
single
-
+
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
+ $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.huss.ccsm4.rcp45.2006-2300.nc
+ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP2-4.5/af.allvars.CESM.SSP2-4.5.2015-2100_c20220628.nc
huss Sa_shum_af
-
- null
-
- bilinear
-
- null
- 2006
- 2300
- 2300
- 0
-
- nearest
-
-
- cycle
-
-
- 1.5
-
- single
-
-
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc
-
-
+ pr Faxa_prec_af
+ ps Sa_pbot_af
+ rlds Faxa_lwdn_af
+ rsds Faxa_swdn_af
+ tas Sa_tbot_af
uas Sa_u_af
-
- null
-
- bilinear
-
- null
- 2006
- 2006
- 2300
- 0
-
- nearest
-
-
- cycle
-
-
- 1.5
-
- single
-
-
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
-
-
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc
-
-
vas Sa_v_af
null
@@ -1344,9 +1269,9 @@
bilinear
null
- 2006
- 2006
- 2300
+ 2015
+ 2015
+ 2100
0
nearest
@@ -1360,24 +1285,31 @@
single
-
+
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
+ $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rsds.ccsm4.rcp45.2006-2300.nc
+ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP3-7.0/af.allvars.CESM.SSP3-7.0.2015-2100_c20220628.nc
+ huss Sa_shum_af
+ pr Faxa_prec_af
+ ps Sa_pbot_af
+ rlds Faxa_lwdn_af
rsds Faxa_swdn_af
+ tas Sa_tbot_af
+ uas Sa_u_af
+ vas Sa_v_af
null
bilinear
null
- 2006
- 2006
- 2300
+ 2015
+ 2015
+ 2100
0
nearest
@@ -1391,24 +1323,31 @@
single
-
+
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc
+ $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
- $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.rlds.ccsm4.rcp45.2006-2300.nc
+ $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP5-8.5/af.allvars.CESM.SSP5-8.5.2015-2100_c20220628.nc
+ huss Sa_shum_af
+ pr Faxa_prec_af
+ ps Sa_pbot_af
rlds Faxa_lwdn_af
+ rsds Faxa_swdn_af
+ tas Sa_tbot_af
+ uas Sa_u_af
+ vas Sa_v_af
null
bilinear
null
- 2006
- 2006
- 2300
+ 2015
+ 2015
+ 2100
0
nearest
@@ -1422,6 +1361,7 @@
single
+
diff --git a/datm/cime_config/testdefs/testlist_datm.xml b/datm/cime_config/testdefs/testlist_datm.xml
index 34bbe3fcf..788e6f555 100644
--- a/datm/cime_config/testdefs/testlist_datm.xml
+++ b/datm/cime_config/testdefs/testlist_datm.xml
@@ -52,6 +52,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90
index f11aa167c..8ce199ee4 100644
--- a/datm/datm_datamode_clmncep_mod.F90
+++ b/datm/datm_datamode_clmncep_mod.F90
@@ -73,15 +73,15 @@ module datm_datamode_clmncep_mod
! stream data bias correction
real(r8), pointer :: strm_precsf(:) => null()
- ! stream data anomonly forcing
- real(r8), pointer :: strm_u_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_v_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_prec_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_tbot_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_pbot_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_shum_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_swdn_af(:) => null() ! anomoly forcing
- real(r8), pointer :: strm_lwdn_af(:) => null() ! anomoly forcing
+ ! stream data anomaly forcing
+ real(r8), pointer :: strm_u_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_v_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_prec_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_tbot_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_pbot_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_shum_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_swdn_af(:) => null() ! anomaly forcing
+ real(r8), pointer :: strm_lwdn_af(:) => null() ! anomaly forcing
! import state data
real(r8), pointer :: Sx_avsdr(:) => null()
@@ -246,7 +246,7 @@ subroutine datm_datamode_clmncep_init_pointers(importState, exportState, sdat, r
call shr_strdata_get_stream_pointer( sdat, 'Faxa_precsf' , strm_precsf , rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
- ! initialize pointers for module level stream arrays for anomonly forcing
+ ! initialize pointers for module level stream arrays for anomaly forcing
call shr_strdata_get_stream_pointer( sdat, 'Sa_u_af' , strm_u_af , rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
call shr_strdata_get_stream_pointer( sdat, 'Sa_v_af' , strm_v_af , rc)