diff --git a/.gitmodules b/.gitmodules
index 19bc024208..2708c9446b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -91,8 +91,8 @@ fxDONOTUSEurl = https://github.com/ESCOMP/CMEPS.git
[submodule "cdeps"]
path = components/cdeps
-url = https://github.com/ESCOMP/CDEPS.git
-fxtag = cdeps1.0.34
+url = https://github.com/samsrabin/CDEPS.git
+fxtag = 25c7b920de8fdf1a90b00276a0d7b003b4a845a9
fxrequired = ToplevelRequired
# Standard Fork to compare to with "git fleximod test" to ensure personal forks aren't committed
fxDONOTUSEurl = https://github.com/ESCOMP/CDEPS.git
diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_clm.xml
index 59044feb10..df6f6b01cc 100644
--- a/cime_config/testdefs/testlist_clm.xml
+++ b/cime_config/testdefs/testlist_clm.xml
@@ -1989,6 +1989,7 @@
+
@@ -2513,15 +2514,46 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/include_user_mods b/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/include_user_mods
similarity index 100%
rename from cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/include_user_mods
rename to cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/include_user_mods
diff --git a/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_clm b/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_clm
new file mode 100644
index 0000000000..ebd35fb2ab
--- /dev/null
+++ b/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_clm
@@ -0,0 +1 @@
+flanduse_timeseries = '$DIN_LOC_ROOT/lnd/clm2/surfdata_esmf/ctsm5.2.0/landuse.timeseries_0.9x1.25_SSP2-4.5_1850-2100_78pfts_c240216.nc'
diff --git a/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_datm b/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_datm
new file mode 100644
index 0000000000..a1e2523cca
--- /dev/null
+++ b/cime_config/testdefs/testmods_dirs/clm/datm_rcp45_anom_forc/user_nl_datm
@@ -0,0 +1 @@
+anomaly_forcing = 'Anomaly.Forcing.cmip5.rcp45'
diff --git a/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm b/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm
deleted file mode 100644
index d8ee13a339..0000000000
--- a/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm
+++ /dev/null
@@ -1 +0,0 @@
-anomaly_forcing = 'Anomaly.Forcing.Temperature'
diff --git a/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm_streams b/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm_streams
deleted file mode 100644
index 34ca8a96ae..0000000000
--- a/cime_config/testdefs/testmods_dirs/clm/datm_ssp126_anom_forc/user_nl_datm_streams
+++ /dev/null
@@ -1,22 +0,0 @@
-Anomaly.Forcing.Temperature:year_first=2015
-Anomaly.Forcing.Temperature:year_last=2100
-Anomaly.Forcing.Temperature:year_align=2015
-Anomaly.Forcing.Temperature:meshfile =$DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc
-! List of Data types to use
-! Remove the variables you do NOT want to include in the Anomaly forcing:
-! pr is preciptiation
-! tas is temperature
-! huss is humidity
-! uas and vas are U and V winds
-! rsds is solare
-! rlds is LW down
-Anomaly.Forcing.Temperature:datavars = pr Faxa_prec_af, \
- tas Sa_tbot_af, \
- ps Sa_pbot_af, \
- huss Sa_shum_af, \
- uas Sa_u_af, \
- vas Sa_v_af, \
- rsds Faxa_swdn_af, \
- rlds Faxa_lwdn_af
-Anomaly.Forcing.Temperature:datafiles =$DIN_LOC_ROOT/atm/datm7/anomaly_forcing/CMIP6-SSP1-2.6/af.allvars.CESM.SSP1-2.6.2015-2100_c20220628.nc
-
diff --git a/components/cdeps b/components/cdeps
index 7476950699..25c7b920de 160000
--- a/components/cdeps
+++ b/components/cdeps
@@ -1 +1 @@
-Subproject commit 7476950699909813d1938a34bd8d71bf5bfbf1e9
+Subproject commit 25c7b920de8fdf1a90b00276a0d7b003b4a845a9
diff --git a/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst b/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst
index 0c6009f3fe..0a22fea0c6 100644
--- a/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst
+++ b/doc/source/users_guide/running-special-cases/Running-with-anomaly-forcing.rst
@@ -5,41 +5,69 @@
==============================
Running with anomaly forcing
==============================
-Because performing fully coupled climate simulations is computationally expensive, an alternate method of running land-only simulations forced by future climate projections was developed for CTSM called 'anomaly forcing'. The anomaly forcing method uses a previously completed fully coupled simulation to create monthly anomalies, relative to the present day, of near-surface atmospheric states and fluxes. These anomalies, representing the evolution of future climate projections, are applied to a repeating cycle of present day atmospheric forcing data, either as an additive (for states) or multiplicative (for fluxes) quantity. Thus, high-frequency variability is obtained from the present day atmospheric forcing data, while the long-term evolution of the climate is determined by the anomaly forcing dataset.
+Because performing fully coupled climate simulations is computationally expensive, an alternate method of running land-only simulations forced by future climate projections was developed for CTSM called "anomaly forcing." The anomaly forcing method uses a previously-completed, fully-coupled simulation to create monthly anomalies, relative to the present day, of near-surface atmospheric states and fluxes. These anomalies, representing the evolution of future climate projections, are applied to a repeating cycle of present day atmospheric forcing data, either as an additive (for states) or multiplicative (for fluxes) quantity. Thus, high-frequency variability is obtained from the present day atmospheric forcing data, while the long-term evolution of the climate is determined by the anomaly forcing dataset.
-To enable anomaly forcing in a CTSM simulation, the following namelist variable can be added to the user\_nl\_datm file:
+Anomaly climate forcings are automatically enabled for ``ISSP`` compsets (e.g., ``ISSP585``). After the namelist has been created, ``CaseDocs/datm.streams.xml`` will have an entry like this pointing to the anomaly forcing file being used:
- anomaly\_forcing = 'Anomaly.Forcing.Precip','Anomaly.Forcing.Temperature','Anomaly.Forcing.Pressure','Anomaly.Forcing.Humidity','Anomaly.Forcing.Uwind','Anomaly.Forcing.Vwind','Anomaly.Forcing.Shortwave','Anomaly.Forcing.Longwave'
+::
-Any combination or subset of forcing variables can be used, e.g. to modify only a single atmospheric forcing variable, one could use:
+
+ ...
+
+ /glade/campaign/cesm/cesmdata/inputdata/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
+
+ ...
+
- anomaly\_forcing = 'Anomaly.Forcing.Temperature'
+To use alternative data, add a ``user_nl_datm_streams`` namelist file to your case with contents like so:
-which will only adjust the temperature (TBOT).
+::
-After the namelist has been created, the run directory will be populated with files such as these:
+ Anomaly.Forcing.cmip6.ssp585:datafiles = /path/to/your/datafile
+ Anomaly.Forcing.cmip6.ssp585:meshfile = /path/to/meshfile/for/your/datafile
- datm.streams.txt.Anomaly.Forcing.Temperature
+ ! List of Data types to use
+ ! Remove the variables you do NOT want to include in the anomaly forcing:
+ ! pr is precipitation
+ ! tas is temperature
+ ! huss is humidity
+ ! uas and vas are U and V winds
+ ! rsds is solare
+ ! rlds is LW down
+ Anomaly.Forcing.cmip6.ssp585:datavars = pr Faxa_prec_af, \
+ tas Sa_tbot_af, \
+ ps Sa_pbot_af, \
+ huss Sa_shum_af, \
+ uas Sa_u_af, \
+ vas Sa_v_af, \
+ rsds Faxa_swdn_af, \
+ rlds Faxa_lwdn_af
-which will contain the location of the default anomaly forcing datasets. To use alternative data, copy these files to the case directory with the 'user\_' prefix, and modify the 'user\_*' files accordingly, e.g.:
+To instead disable anomaly forcing in ``ISSP`` compsets, the following can be added to the ``user_nl_datm`` file:
- user\_datm.streams.txt.Anomaly.Forcing.Temperature
+::
- For example, one could use the user\_datm.streams.txt.Anomaly.Forcing.* files to point to these SSP-derived anomaly forcing datasets:
+ anomaly_forcing = 'none'
- /glade/p/cesmdata/cseg/inputdata/atm/datm7/anomaly\_forcing/CMIP6-SSP3-7.0
+Note that other inputs are also set automatically for ``ISSP`` compsets, including CO2 (``co2tseries``), ozone (``preso3``), N deposition (``presndep``), and aerosols (``presaero``).
- af.huss.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
- af.pr.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
- af.ps.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
- af.rlds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
- af.rsds.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
- af.tas.cesm2.SSP3-7.0.2015-2100\_c20200329.nc
+For single-point simulations, the global anomaly forcing files can be used, but the map should be nearest-neighbor interpolated by putting the following in ``user_nl_datm_streams``:
-Users may wish to also update files such as the landuse\_timeseries and aerosol and Ndepostion files to correspond to the appropriate SSP.
+TODO: IS THIS ACTUALLY NEEDED?
-For single point simulations, the global anomaly forcing files can be used, but the map_algo namelist variable should be appended with nearest neighbor values for each of the anomaly forcing fields, e.g.
+::
- mapalgo = 'nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn','nn' (the number of 'nn' values will depend on the number of original streams plus the number of anomaly forcing streams)
+ ! Replace "ssp585" if needed
+ Anomaly.Forcing.cmip6.ssp585:mapalgo = nn
-The cycling of the present-day (base) climate is controlled through the DATM\_CLMNCEP\_YR\_START and DATM_CLMNCEP\_YR\_END variables in env\_run.xml.
+The first and last years over which the present-day (base) climate should cycle are set through the ``DATM_YR_START`` and ``DATM_YR_END`` XML variables.
diff --git a/tmp_scripts/make_allvars_files.sh b/tmp_scripts/make_allvars_files.sh
new file mode 100755
index 0000000000..06d47a9479
--- /dev/null
+++ b/tmp_scripts/make_allvars_files.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+set -e
+
+module load nco
+
+indir=/glade/campaign/cesm/cesmdata/cseg/inputdata/atm/datm7/anomaly_forcing
+outdir=/glade/work/samrabin/ctsm_cdeps_ssp-temperature
+
+rcp=$1
+if [[ ${rcp} == "" ]]; then
+ echo "You must provide rcp (e.g., 45)" >&2
+ exit 1
+fi
+
+if [[ ! -d "${indir}" ]]; then
+ echo "Input directory not found: ${indir}" >&2
+ exit 1
+fi
+
+restoffilename="ccsm4.rcp${rcp}.2006-2300.nc"
+
+pushd "${indir}" 1>/dev/null
+varlist="$(ls af.*.${restoffilename} | grep -v allvars | cut -f2 -d.)"
+if [[ "${varlist}" == "" ]]; then
+ echo "No variables found" >&2
+ exit 1
+fi
+popd 1>/dev/null
+
+newfile="${outdir}/af.allvars.${restoffilename}"
+
+i=0
+for var in ${varlist}; do
+ echo $var
+ i=$((i + 1))
+ thisfile="${indir}/af.${var}.${restoffilename}"
+ if [[ ${i} -eq 1 ]]; then
+ nccopy -k cdf5 "${thisfile}" "${newfile}"
+ continue
+ fi
+ ncks -A -v ${var} "${thisfile}" "${newfile}"
+done
+
+echo Done
+
+exit 0
\ No newline at end of file
diff --git a/tmp_scripts/test-ssp-temperature-ctsm5.2.003.sh b/tmp_scripts/test-ssp-temperature-ctsm5.2.003.sh
new file mode 100755
index 0000000000..4c9ca5c39e
--- /dev/null
+++ b/tmp_scripts/test-ssp-temperature-ctsm5.2.003.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+set -e
+
+ssp=$1
+if [[ ${ssp} == "" ]]; then
+ echo "You must provide an SSP number (e.g., 245)" >&2
+ exit 1
+fi
+ssp_punctuation="$(echo ${ssp} | sed -E "s/(.)(.)(.)/\1-\2.\3/")"
+
+casedir="$HOME/cases_ctsm/test_cdeps_ssp-temperature"
+compset="SSP${ssp}_DATM%GSWP3v1_CLM51%BGC-CROP_SICE_SOCN_MOSART_CISM2%NOEVOLVE_SWAV"
+res="f10_f10_mg37"
+
+if [[ -d "${casedir}" ]]; then
+ rm -r "${casedir}"
+fi
+
+cime/scripts/create_newcase --run-unsupported --case "${casedir}" --compset ${compset} --res ${res} \
+ --handle-preexisting-dirs r
+
+cd "${casedir}"
+./case.setup
+
+#echo "anomaly_forcing = 'Anomaly.Forcing.Temperature'" >> user_nl_datm
+echo "anomaly_forcing = 'Anomaly.Forcing.cmip5.rcp45'" >> user_nl_datm
+echo "flanduse_timeseries = '/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/surfdata_esmf/ctsm5.2.0/landuse.timeseries_10x15_SSP${ssp_punctuation}_78_CMIP6_1850-2100_c230517.nc'" >> user_nl_clm
+
+echo "Generating namelists..."
+./preview_namelists 1>/dev/null
+
+./xmlquery COMPSET
+grep "" CaseDocs/datm.streams.xml | grep anomaly_forcing | grep '.tas.'
+
+exit 0