From eff9a1aa411e0b5fd9f5b0bd90fb07ac30dd1728 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 8 May 2024 17:20:44 -0600 Subject: [PATCH 01/16] Add Anomaly.Forcing.cmip5.rcp45. --- datm/cime_config/namelist_definition_datm.xml | 2 +- datm/cime_config/stream_definition_datm.xml | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 491b6f6d..472cd3fe 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -218,7 +218,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 + Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave 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 310c5097..aaf99e84 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -1126,6 +1126,44 @@ + + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/domain.permafrostRCN_P2.c2013.nc + + + $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.allvars.ccsm4.rcp45.2006-2300.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 + 0 + + nearest + + + cycle + + + 1.5 + + single + From e4bd386dc564cbe2c89872947e2fc4c5c480480f Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 9 May 2024 13:40:29 -0600 Subject: [PATCH 02/16] Fix 'anomoly_forcing' typo. --- datm/cime_config/stream_definition_datm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index aaf99e84..1d6edba9 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -206,7 +206,7 @@ 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 From 7444e810ecd20f19753f649e16bd353a1214cecb Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 8 Aug 2024 16:12:03 -0600 Subject: [PATCH 03/16] Update meshfile used for Anomaly.Forcing.*. --- datm/cime_config/stream_definition_datm.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index 1d6edba9..da4e14f3 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -1129,7 +1129,7 @@ - $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.allvars.ccsm4.rcp45.2006-2300.nc @@ -1167,7 +1167,7 @@ - $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 @@ -1198,7 +1198,7 @@ - $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.tas.ccsm4.rcp45.2006-2300.nc @@ -1229,7 +1229,7 @@ - $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 @@ -1260,7 +1260,7 @@ - $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 @@ -1291,7 +1291,7 @@ - $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.uas.ccsm4.rcp45.2006-2300.nc @@ -1322,7 +1322,7 @@ - $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.vas.ccsm4.rcp45.2006-2300.nc @@ -1353,7 +1353,7 @@ - $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 @@ -1384,7 +1384,7 @@ - $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 From 462c7a9cff10e7ce9a7ab2d670f159f91d96d2cb Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 8 Aug 2024 16:21:45 -0600 Subject: [PATCH 04/16] Fix more typos of "anomaly." --- datm/cime_config/stream_definition_datm.xml | 2 +- datm/datm_datamode_clmncep_mod.F90 | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/datm/cime_config/stream_definition_datm.xml b/datm/cime_config/stream_definition_datm.xml index da4e14f3..8e71201d 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -1124,7 +1124,7 @@ - + diff --git a/datm/datm_datamode_clmncep_mod.F90 b/datm/datm_datamode_clmncep_mod.F90 index 41a9725c..b892bc9e 100644 --- a/datm/datm_datamode_clmncep_mod.F90 +++ b/datm/datm_datamode_clmncep_mod.F90 @@ -76,15 +76,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() @@ -249,7 +249,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) From 759c5910e147b322a5ac833ddc760d9a27b90477 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 8 Aug 2024 17:31:59 -0600 Subject: [PATCH 05/16] Add Anomaly.Forcing.cmip6.ssp126. --- datm/cime_config/namelist_definition_datm.xml | 2 +- datm/cime_config/stream_definition_datm.xml | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 472cd3fe..443b08a4 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -218,7 +218,7 @@ char(10) datm datm_nml - Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave + Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave 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 8e71201d..e278810b 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -1165,6 +1165,44 @@ single + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.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 + 2015 + 2015 + 2100 + 0 + + nearest + + + cycle + + + 1.5 + + single + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc From 84669d7984e8a941b3e675c0d331c72deec932b3 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 8 Aug 2024 18:25:07 -0600 Subject: [PATCH 06/16] Add Anomaly.Forcing.cmip6.245, 370, 585. --- datm/cime_config/namelist_definition_datm.xml | 2 +- datm/cime_config/stream_definition_datm.xml | 114 ++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 443b08a4..898deeba 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -218,7 +218,7 @@ char(10) datm datm_nml - Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave + Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.cmip6.ssp245,Anomaly.Forcing.cmip6.ssp370,Anomaly.Forcing.cmip6.ssp585,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave 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 e278810b..e00ddce6 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -1203,6 +1203,120 @@ single + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.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 + 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 + 2015 + 2015 + 2100 + 0 + + nearest + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.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 + 2015 + 2015 + 2100 + 0 + + nearest + + + cycle + + + 1.5 + + single + + + + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.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 + 2015 + 2015 + 2100 + 0 + + nearest + + + cycle + + + 1.5 + + single + + $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc From d2ba05b8900da65249e1d79a1f8ad0dd2efbbd92 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Wed, 4 Sep 2024 16:50:16 -0600 Subject: [PATCH 07/16] anomaly_forcing now automatically set based on compset (ISSP*). --- datm/cime_config/namelist_definition_datm.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 898deeba..521908d0 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -223,7 +223,11 @@ If set, include anomaly forcing streams in namelist. - + null + Anomaly.Forcing.cmip6.ssp126 + Anomaly.Forcing.cmip6.ssp245 + Anomaly.Forcing.cmip6.ssp370 + Anomaly.Forcing.cmip6.ssp585 From 6071ab55fea6434e0219538ae5e816d12755f461 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 08:56:27 -0600 Subject: [PATCH 08/16] Now actually sets anomaly_forcing based on compset. This reverts commit 3f36622b3bd6358d324f1aca5e90009db306963e, which tried to do this in namelist_definition_datm.xml, and instead does it in datm/cime_config/buildnml. Only looks at compset if anomaly_forcing not specified in namelist. --- datm/cime_config/buildnml | 11 +++++++++++ datm/cime_config/namelist_definition_datm.xml | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index afee5034..193e6ed7 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 = {} @@ -198,9 +201,17 @@ 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 anomaly_forcing = nmlgen.get_value("anomaly_forcing") + ssp = re.search(r"^SSP\d+", compset).group() + # First by looking in namelist if anomaly_forcing[0] is not None: streamlist += anomaly_forcing + # If not in namelist, look at compset + elif ssp: + anomaly_forcing = "Anomaly.Forcing.cmip6." + ssp.lower() + streamlist += [anomaly_forcing] # Generate datm.streams.xml outfile = os.path.join(confdir, "datm.streams"+inst_string+".xml" ) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 521908d0..898deeba 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -223,11 +223,7 @@ If set, include anomaly forcing streams in namelist. - null - Anomaly.Forcing.cmip6.ssp126 - Anomaly.Forcing.cmip6.ssp245 - Anomaly.Forcing.cmip6.ssp370 - Anomaly.Forcing.cmip6.ssp585 + From 82fde5120f22448d1544cd3247a896532ffcf701 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 10:46:13 -0600 Subject: [PATCH 09/16] SSP compsets now automatically get anomaly_forcing in datm_in. --- datm/cime_config/buildnml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 193e6ed7..9c985003 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -175,6 +175,16 @@ 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 anomaly_forcing[0] is None: + # If not in namelist, check whether it's an SSP compset + ssp = re.search(r"^SSP\d+", compset).group() + if ssp: + 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']) @@ -202,16 +212,10 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path if bias_correct is not None: streamlist.append(bias_correct) - # Set anomaly forcing + # Set anomaly forcing in datm.streams.xml anomaly_forcing = nmlgen.get_value("anomaly_forcing") - ssp = re.search(r"^SSP\d+", compset).group() - # First by looking in namelist if anomaly_forcing[0] is not None: streamlist += anomaly_forcing - # If not in namelist, look at compset - elif ssp: - anomaly_forcing = "Anomaly.Forcing.cmip6." + ssp.lower() - streamlist += [anomaly_forcing] # Generate datm.streams.xml outfile = os.path.join(confdir, "datm.streams"+inst_string+".xml" ) From 7927c1a34d3ca8bad5f4f0fd04e2630e91578c6f Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 11:26:06 -0600 Subject: [PATCH 10/16] Remove Anomaly.Forcing.Precip, Anomaly.Forcing.Temperature, etc. --- datm/cime_config/namelist_definition_datm.xml | 2 +- datm/cime_config/stream_definition_datm.xml | 260 +----------------- 2 files changed, 6 insertions(+), 256 deletions(-) diff --git a/datm/cime_config/namelist_definition_datm.xml b/datm/cime_config/namelist_definition_datm.xml index 898deeba..7a1635bf 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -218,7 +218,7 @@ char(10) datm datm_nml - Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.cmip6.ssp245,Anomaly.Forcing.cmip6.ssp370,Anomaly.Forcing.cmip6.ssp585,Anomaly.Forcing.Precip,Anomaly.Forcing.Temperature,Anomaly.Forcing.Pressure,Anomaly.Forcing.Humidity,Anomaly.Forcing.Uwind,Anomaly.Forcing.Vwind,Anomaly.Forcing.Shortwave,Anomaly.Forcing.Longwave + 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 e00ddce6..b1ea2838 100644 --- a/datm/cime_config/stream_definition_datm.xml +++ b/datm/cime_config/stream_definition_datm.xml @@ -208,14 +208,11 @@ ======================== 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) @@ -1317,253 +1314,6 @@ single - - - $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 - - - pr Faxa_prec_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.tas.ccsm4.rcp45.2006-2300.nc - - - tas Sa_tbot_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $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 - - - ps Sa_pbot_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $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 - - - huss Sa_shum_af - - null - - bilinear - - null - 2006 - 2300 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.uas.ccsm4.rcp45.2006-2300.nc - - - uas Sa_u_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $DIN_LOC_ROOT/share/meshes/fv0.9x1.25_141008_polemod_ESMFmesh.nc - - - $DIN_LOC_ROOT/atm/datm7/anomaly_forcing/af.vas.ccsm4.rcp45.2006-2300.nc - - - vas Sa_v_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $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 - - - rsds Faxa_swdn_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - - - - - $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 - - - rlds Faxa_lwdn_af - - null - - bilinear - - null - 2006 - 2006 - 2300 - 0 - - nearest - - - cycle - - - 1.5 - - single - From cecc4a2898f7548cc2c6d8f2530674d264a38231 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 12:15:40 -0600 Subject: [PATCH 11/16] Set anomaly_forcing = 'none' to not use anomalies in an SSP compset. --- datm/cime_config/buildnml | 2 +- datm/cime_config/namelist_definition_datm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index 9c985003..bafd2fe8 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -214,7 +214,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # 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 7a1635bf..3b3f3a84 100644 --- a/datm/cime_config/namelist_definition_datm.xml +++ b/datm/cime_config/namelist_definition_datm.xml @@ -218,7 +218,7 @@ char(10) datm datm_nml - Anomaly.Forcing.cmip5.rcp45,Anomaly.Forcing.cmip6.ssp126,Anomaly.Forcing.cmip6.ssp245,Anomaly.Forcing.cmip6.ssp370,Anomaly.Forcing.cmip6.ssp585 + 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. From e0b75941cd890b14f287e57b3191678455ac3bdd Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 13:00:09 -0600 Subject: [PATCH 12/16] Only set anomaly_forcing for DATM SSP compsets. --- datm/cime_config/buildnml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index bafd2fe8..ad8975d6 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -180,8 +180,9 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path anomaly_forcing = nmlgen.get_value("anomaly_forcing") if anomaly_forcing[0] is None: # If not in namelist, check whether it's an SSP compset - ssp = re.search(r"^SSP\d+", compset).group() + ssp = re.search(r"^SSP\d+_DATM", compset).group() if ssp: + ssp = ssp.replace("_DATM", "") anomaly_forcing = ["Anomaly.Forcing.cmip6." + ssp.lower()] nmlgen.set_value("anomaly_forcing", anomaly_forcing) From 1e403a8574096d58cfb332cd620faaea156359eb Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 13:43:43 -0600 Subject: [PATCH 13/16] Provide hint in error message if namelist variable invalid due to surrounding quote marks. --- cime_config/stream_cdeps.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/cime_config/stream_cdeps.py b/cime_config/stream_cdeps.py index 1f702a13..5a9b4b82 100644 --- a/cime_config/stream_cdeps.py +++ b/cime_config/stream_cdeps.py @@ -315,14 +315,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": From b1f17519a57d2b99aa6651235a713836e0844eb8 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 15:15:11 -0600 Subject: [PATCH 14/16] Make datm buildnml more robust. --- datm/cime_config/buildnml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index ad8975d6..fffc0445 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -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) From 25c7b920de8fdf1a90b00276a0d7b003b4a845a9 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Thu, 5 Sep 2024 15:47:54 -0600 Subject: [PATCH 15/16] Bugfix to future-proofing of datm buildnml. --- datm/cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datm/cime_config/buildnml b/datm/cime_config/buildnml index fffc0445..379b09eb 100755 --- a/datm/cime_config/buildnml +++ b/datm/cime_config/buildnml @@ -178,7 +178,7 @@ 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 and anomaly_forcing[0] is None: + 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: From 7cb5040af8bfd6edc0cb2607e42ba63f1e2f0a0d Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Fri, 6 Sep 2024 09:52:17 -0600 Subject: [PATCH 16/16] Add aux_cdeps tests for SSPs other than 585. Resolves ESCOMP/CDEPS#310. --- datm/cime_config/testdefs/testlist_datm.xml | 27 +++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/datm/cime_config/testdefs/testlist_datm.xml b/datm/cime_config/testdefs/testlist_datm.xml index a20e5630..72315c9c 100644 --- a/datm/cime_config/testdefs/testlist_datm.xml +++ b/datm/cime_config/testdefs/testlist_datm.xml @@ -52,6 +52,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +