From 26e55b856d3c14ea37ccbc75a96fb0ecf69ee0dd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 12:13:48 -0700 Subject: [PATCH 001/164] Rename clm specific names to slim --- .../2000_CMIP6_AMIP_1deg_ensemble/user_nl_slim} | 0 .../{clm/default/user_nl_clm => slim/default/user_nl_slim} | 0 .../testdefs/testmods_dirs/{clm => slim}/g16_SOM/shell_commands | 0 .../testmods_dirs/{clm => slim}/g16_SOM/user_docn.streams.txt.som | 0 .../testmods_dirs/{clm => slim}/global_uniform/include_user_mods | 0 .../{clm => slim}/global_uniform_g16_SOM/include_user_mods | 0 .../{clm => slim}/realistic_fromCLM5_1850/include_user_mods | 0 .../include_user_mods | 0 .../testdefs/testmods_dirs/{clm => slim}/save_cplhist/user_nl_cpl | 0 cime_config/{user_nl_clm => user_nl_slim} | 0 10 files changed, 0 insertions(+), 0 deletions(-) rename cime_config/testdefs/testmods_dirs/{clm/2000_CMIP6_AMIP_1deg_ensemble/user_nl_clm => slim/2000_CMIP6_AMIP_1deg_ensemble/user_nl_slim} (100%) rename cime_config/testdefs/testmods_dirs/{clm/default/user_nl_clm => slim/default/user_nl_slim} (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/g16_SOM/shell_commands (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/g16_SOM/user_docn.streams.txt.som (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/global_uniform/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/global_uniform_g16_SOM/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/realistic_fromCLM5_1850/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/realistic_fromCLM5_1850_g16_SOM_save_cplhist/include_user_mods (100%) rename cime_config/testdefs/testmods_dirs/{clm => slim}/save_cplhist/user_nl_cpl (100%) rename cime_config/{user_nl_clm => user_nl_slim} (100%) diff --git a/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/user_nl_clm b/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble/user_nl_slim similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/user_nl_clm rename to cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble/user_nl_slim diff --git a/cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm b/cime_config/testdefs/testmods_dirs/slim/default/user_nl_slim similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/default/user_nl_clm rename to cime_config/testdefs/testmods_dirs/slim/default/user_nl_slim diff --git a/cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands rename to cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn.streams.txt.som b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/user_docn.streams.txt.som similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn.streams.txt.som rename to cime_config/testdefs/testmods_dirs/slim/g16_SOM/user_docn.streams.txt.som diff --git a/cime_config/testdefs/testmods_dirs/clm/global_uniform/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/global_uniform/include_user_mods rename to cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/global_uniform_g16_SOM/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/global_uniform_g16_SOM/include_user_mods rename to cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/realistic_fromCLM5_1850/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/realistic_fromCLM5_1850/include_user_mods rename to cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/realistic_fromCLM5_1850_g16_SOM_save_cplhist/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/include_user_mods similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/realistic_fromCLM5_1850_g16_SOM_save_cplhist/include_user_mods rename to cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/include_user_mods diff --git a/cime_config/testdefs/testmods_dirs/clm/save_cplhist/user_nl_cpl b/cime_config/testdefs/testmods_dirs/slim/save_cplhist/user_nl_cpl similarity index 100% rename from cime_config/testdefs/testmods_dirs/clm/save_cplhist/user_nl_cpl rename to cime_config/testdefs/testmods_dirs/slim/save_cplhist/user_nl_cpl diff --git a/cime_config/user_nl_clm b/cime_config/user_nl_slim similarity index 100% rename from cime_config/user_nl_clm rename to cime_config/user_nl_slim From 92e74282666be9ebd925455b8b7ead339992cc41 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 12:19:30 -0700 Subject: [PATCH 002/164] Change clm in many filenames to slim and in compsets --- cime_config/testdefs/{testlist_clm.xml => testlist_slim.xml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cime_config/testdefs/{testlist_clm.xml => testlist_slim.xml} (100%) diff --git a/cime_config/testdefs/testlist_clm.xml b/cime_config/testdefs/testlist_slim.xml similarity index 100% rename from cime_config/testdefs/testlist_clm.xml rename to cime_config/testdefs/testlist_slim.xml From 7d3c3e3a62f56f64e577277ab4256cf167e3dc25 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 13:26:47 -0700 Subject: [PATCH 003/164] More changing to slim component name --- cime_config/buildlib | 22 ++--- cime_config/config_archive.xml | 18 ++-- cime_config/config_component.xml | 85 ++++++------------- cime_config/config_compsets.xml | 53 ++++-------- cime_config/config_pes.xml | 39 +-------- cime_config/testdefs/ExpectedTestFails.xml | 26 +++--- cime_config/testdefs/testlist_slim.xml | 56 +++++------- .../testmods_dirs/slim/g16_SOM/shell_commands | 2 +- cime_config/user_nl_slim | 4 +- .../{user_nl_clm => user_nl_slim} | 0 .../{user_nl_clm => user_nl_slim} | 0 .../{user_nl_clm => user_nl_slim} | 0 12 files changed, 94 insertions(+), 211 deletions(-) rename cime_config/usermods_dirs/global_uniform/{user_nl_clm => user_nl_slim} (100%) rename cime_config/usermods_dirs/realistic_fromCLM5_1850/{user_nl_clm => user_nl_slim} (100%) rename cime_config/usermods_dirs/realistic_fromCLM5_2000/{user_nl_clm => user_nl_slim} (100%) diff --git a/cime_config/buildlib b/cime_config/buildlib index 43016826..3f572559 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -1,7 +1,7 @@ #!/usr/bin/env python """ -build clm library +build slim ibrary """ import sys, os, time, filecmp, shutil, imp @@ -34,28 +34,17 @@ def _main_func(): mach = case.get_value("MACH") nthrds = case.get_value("LND_NTHRDS") - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5 or clm5_0 physics") - if ( nthrds > 1 ): expect(False, "LND_NTHRDS must be 1 as threading isn't implemented (see issue #14)" ) #------------------------------------------------------- - # create Filepath file for clm4_5 or clm5_0 + # create Filepath file #------------------------------------------------------- filepath_file = os.path.join(bldroot,"Filepath") if not os.path.isfile(filepath_file): caseroot = case.get_value("CASEROOT") - paths = [os.path.join(caseroot,"SourceMods","src.clm"), + paths = [os.path.join(caseroot,"SourceMods","src.slim"), os.path.join(lnd_root,"src","main"), - os.path.join(lnd_root,"src","biogeophys"), - os.path.join(lnd_root,"src","biogeochem"), - os.path.join(lnd_root,"src","soilbiogeochem"), os.path.join(lnd_root,"src","init_interp"), os.path.join(lnd_root,"src","utils"), os.path.join(lnd_root,"src","cpl")] @@ -68,12 +57,11 @@ def _main_func(): # create the library in libroot #------------------------------------------------------- - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - complib = os.path.join(libroot,"libclm.a") + complib = os.path.join(libroot,"libslim.a") makefile = os.path.join(casetools, "Makefile") macfile = os.path.join(caseroot, "Macros.%s" % mach) - cmd = "%s complib -j %d MODEL=clm COMPLIB=%s -f %s MACFILE=%s " \ + cmd = "%s complib -j %d MODEL=slim COMPLIB=%s -f %s MACFILE=%s " \ % (gmake, gmake_j, complib, makefile, macfile ) rc, out, err = run_cmd(cmd) diff --git a/cime_config/config_archive.xml b/cime_config/config_archive.xml index 4c2412a0..9b3e93b7 100644 --- a/cime_config/config_archive.xml +++ b/cime_config/config_archive.xml @@ -1,5 +1,5 @@ - + r rh\d? h\d*.*\.nc$ @@ -7,18 +7,18 @@ locfnh rpointer.lnd$NINST_STRING - ./$CASE.clm2$NINST_STRING.r.$DATENAME.nc + ./$CASE.slim$NINST_STRING.r.$DATENAME.nc rpointer.lnd rpointer.lnd_9999 - casename.clm2.r.1976-01-01-00000.nc - casename.clm2.rh4.1976-01-01-00000.nc - casename.clm2.h0.1976-01-01-00000.nc - casename.clm2.h0.1976-01-01-00000.nc.base - casename.clm2_0002.e.postassim.1976-01-01-00000.nc - casename.clm2_0002.e.preassim.1976-01-01-00000.nc - anothercasename.clm2.i.1976-01-01-00000.nc + casename.slim.r.1976-01-01-00000.nc + casename.slim.rh4.1976-01-01-00000.nc + casename.slim.h0.1976-01-01-00000.nc + casename.slim.h0.1976-01-01-00000.nc.base + casename.slim_0002.e.postassim.1976-01-01-00000.nc + casename.slim_0002.e.preassim.1976-01-01-00000.nc + anothercasename.slim.i.1976-01-01-00000.nc diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index ab8a8c9e..d7aeeadd 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -14,40 +14,19 @@ - clm4.5: - clm5.0: - Satellite phenology: - BGC (vert. resol. CN and methane): + Simple Land Model: char - clm - clm + slim + slim case_comp env_case.xml Name of land component - - char - - - -phys clm4_5 - -phys clm5_0 - - build_component_clm - env_build.xml - Provides option(s) for the CLM configure utility. - CLM_CONFIG_OPTS are normally set as compset variables (e.g., -bgc cn) - and in general should not be modified for supported compsets. - It is recommended that if you want to modify this value for your experiment, - you should use your own user-defined component sets via using create_newcase - with a compset_file argument. - This is an advanced flag and should only be used by expert users. - - - + char UNSET @@ -55,32 +34,26 @@ 2000_control 1850_control - run_component_clm + run_component_slim env_run.xml - CLM namelist use_case. - Determines the use-case that will be sent to the CLM build-namelist utility. + SLIM namelist use_case. + Determines the use-case that will be sent to the SLIM build-namelist utility. This is normally set by the component set. This is an advanced flag and should only be used by expert users. - - - + + char - -bgc sp - -bgc bgc - - -bgc sp - -bgc bgc - run_component_clm + run_component_slim env_run.xml - CLM build-namelist options + SLIM build-namelist options - + char constant,diagnostic,prognostic constant @@ -90,25 +63,25 @@ prognostic diagnostic - run_component_clm + run_component_slim env_run.xml - Determines how CLM will determine where CO2 is set. + Determines how SLIM will determine where CO2 is set. If value is constant, it will be set to CCSM_CO2_PPMV, if value is either diagnostic or prognostic, the atmosphere model - MUST send it to CLM. CLM_CO2_TYPE is normally set by the specific + MUST send it to SLIM. SLIM_CO2_TYPE is normally set by the specific compset, since it HAS to be coordinated with settings for the atmospheric model. Do not modify this variable. If you want to modify for your experiment, use your own user-defined component set This is an advanced flag and should only be used by expert users. - + char - run_component_clm + run_component_slim env_run.xml - CLM-specific namelist settings for -namelist option in the CLM - build-namelist. CLM_NAMELIST_OPTS is normally set as a compset variable + SLIM-specific namelist settings for -namelist option in the SLIM + build-namelist. SLIM_NAMELIST_OPTS is normally set as a compset variable and in general should not be modified for supported compsets. It is recommended that if you want to modify this value for your experiment, you should use your own user-defined component sets via using create_newcase @@ -116,32 +89,22 @@ This is an advanced flag and should only be used by expert users. - - char - off - off - run_component_clm - env_run.xml - Turn on any settings for accellerating the model spinup. This is unused for SLIM! - - - - + char on,off off - run_component_clm + run_component_slim env_run.xml - Flag to the CLM build-namelist command to force CLM to do a + Flag to the SLIM build-namelist command to force SLIM to do a cold start (finidat will be set to blanks). A value of on forces the model to spin up from a cold-start (arbitrary initial conditions). Setting this value in the xml file will take - precedence over any settings for finidat in the $CASEROOT/user_clm_clm file. + precedence over any settings for finidat in the $CASEROOT/user_nl_slim file. ========================================= - CLM naming conventions + SLIM naming conventions ========================================= note: [^_]* means match zero or more of any character BUT an underbar. (in other words make sure there is NOT a underbar before the string afterwards) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 58a14813..469eaf32 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -14,7 +14,7 @@ Where for the CAM specific compsets below the following is supported TIME = Time period (e.g. 2000, HIST, RCP8...) ATM = [CAM40, CAM50, CAM55] - LND = [CLM45, CLM50, SLND] + LND = [SLIM, SLND] ICE = [CICE, DICE, SICE] OCN = [DOCN, ,AQUAP, SOCN] ROF = [RTM, SROF] @@ -39,88 +39,69 @@ H_MML_2000_CAM6 - 2000_CAM60_CLM50%SP_CICE_DOCN%SOM_SROF_SGLC_SWAV + 2000_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV H_MML_1850_CAM6 - 1850_CAM60_CLM50%SP_CICE_DOCN%SOM_SROF_SGLC_SWAV + 1850_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV F2000Cam6SlimRsGs - 2000_CAM60_CLM50%SP_CICE%PRES_DOCN%DOM_SROF_SGLC_SWAV + 2000_CAM60_SLIM_CICE%PRES_DOCN%DOM_SROF_SGLC_SWAV - + H_MML_2000_CAM5 - 2000_CAM50_CLM45%SP_CICE_DOCN%SOM_SROF_SGLC_SWAV + 2000_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - - - H_MML_2000_CAM5_BGC - 2000_CAM50_CLM45%BGC_CICE_DOCN%SOM_SROF_SGLC_SWAV - - + FHistCam5SlimRsGs - HIST_CAM50_CLM45%SP_CICE_DOCN%SOM_SROF_SGLC_SWAV + HIST_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV K1850MMLOFFLINE_CPLHIST - 1850_DATM%CPLHIST_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV + 1850_DATM%CPLHIST_SLIM_SICE_SOCN_SROF_SGLC_SWAV K2000MMLOFFLINE_CPLHIST - 2000_DATM%CPLHIST_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV + 2000_DATM%CPLHIST_SLIM_SICE_SOCN_SROF_SGLC_SWAV K1850MMLOFFLINE_CRU - 1850_DATM%CRUv7_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV + 1850_DATM%CRUv7_SLIM_SICE_SOCN_SROF_SGLC_SWAV K1850MMLOFFLINE_GSWP3 - 1850_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV + 1850_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV K_HIST_MMLOFFLINE_GSWP3 - HIST_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_SROF_SGLC_SWAV + HIST_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV K_HIST_MMLOFFLINE_QIA - HIST_DATM%QIA_CLM50%BGC_SICE_SOCN_SROF_SGLC_SWAV + HIST_DATM%QIA_SLIM_SICE_SOCN_SROF_SGLC_SWAV - IHistClm45BgcQianGs - HIST_DATM%QIA_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - - - IHistSlim50QianGs - HIST_DATM%QIA_CLM50%SP_SICE_SOCN_SROF_SGLC_SWAV + IHistSlimQianGs + HIST_DATM%QIA_SLIM_SICE_SOCN_RTM_SGLC_SWAV - - - - I1850Clm45BgcGs - 1850_DATM%GSWP3v1_CLM45%BGC_SICE_SOCN_RTM_SGLC_SWAV - - - I2000SlimRsGs - 2000_DATM%GSWP3v1_CLM45%SP_SICE_SOCN_SROF_SGLC_SWAV + 2000_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV diff --git a/cime_config/config_pes.xml b/cime_config/config_pes.xml index 42005741..ed50a0f7 100644 --- a/cime_config/config_pes.xml +++ b/cime_config/config_pes.xml @@ -41,7 +41,7 @@ - + -10 -10 @@ -223,43 +223,6 @@ - - - - none - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - - - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index a58ea3d0..f04cec7d 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,79 +29,79 @@ - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#25? - + FAIL marysa/SimpleLand#17 - + FAIL marysa/SimpleLand#17 diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index d812b44b..a6ab388c 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -106,8 +106,8 @@ - - + + @@ -121,7 +121,7 @@ - + @@ -131,17 +131,7 @@ - - - - - - - - - - - + @@ -153,7 +143,7 @@ - + @@ -162,7 +152,7 @@ - + @@ -171,7 +161,7 @@ - + @@ -181,7 +171,7 @@ - + @@ -190,7 +180,7 @@ - + @@ -200,7 +190,7 @@ - + @@ -210,7 +200,7 @@ - + @@ -219,7 +209,7 @@ - + @@ -231,7 +221,7 @@ - + @@ -241,7 +231,7 @@ - + diff --git a/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands index 28fa386d..1638132d 100755 --- a/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands +++ b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands @@ -1,3 +1,3 @@ #!/bin/bash CIMEROOT=`./xmlquery --value -s CIMEROOT` -cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn* . +cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/slim/g16_SOM/user_docn* . diff --git a/cime_config/user_nl_slim b/cime_config/user_nl_slim index b225eb1d..7ac0af68 100644 --- a/cime_config/user_nl_slim +++ b/cime_config/user_nl_slim @@ -3,14 +3,12 @@ ! namelist_var = new_namelist_value ! ! EXCEPTIONS: -! Set use_cn by the compset you use and CLM_BLDNML_OPTS -bgc setting ! Set co2_ppmv with CCSM_CO2_PPMV option ! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) -! or with CLM_FORCE_COLDSTART to do a cold start +! or with SLIM_FORCE_COLDSTART to do a cold start ! or set it with an explicit filename here. -! Set maxpatch_glcmec with GLC_NEC option !---------------------------------------------------------------------------------- diff --git a/cime_config/usermods_dirs/global_uniform/user_nl_clm b/cime_config/usermods_dirs/global_uniform/user_nl_slim similarity index 100% rename from cime_config/usermods_dirs/global_uniform/user_nl_clm rename to cime_config/usermods_dirs/global_uniform/user_nl_slim diff --git a/cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_clm b/cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim similarity index 100% rename from cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_clm rename to cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim diff --git a/cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_clm b/cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim similarity index 100% rename from cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_clm rename to cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim From 8cd128c66d5119a9f9c6b879f3238705d1f0fe2a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 13:30:26 -0700 Subject: [PATCH 004/164] Change head files to slim componenent name --- .config_files.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.config_files.xml b/.config_files.xml index e07f99db..22860601 100644 --- a/.config_files.xml +++ b/.config_files.xml @@ -5,19 +5,19 @@ char unset - $SRCROOT + $SRCROOT $CIMEROOT/src/components/data_comps/dlnd $CIMEROOT/src/components/stub_comps/slnd $CIMEROOT/src/components/xcpl_comps/xlnd From 16f6ee7303465602308d3f20aed36c24d06f48e4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 13:31:28 -0700 Subject: [PATCH 005/164] Remove the complete bld subdirectory as we can replace it with a python only build just under cime_config --- bld/CESM_cppdefs | 1 - bld/CLMBuildNamelist.pm | 2462 ----------------- bld/Filepath | 8 - bld/build-namelist | 23 - bld/config_cache.xml | 29 - bld/config_files/clm_phys_vers.pm | 196 -- bld/config_files/config_defaults.xml | 7 - bld/config_files/config_definition.xsl | 72 - bld/config_files/config_definition_clm4_5.xml | 45 - bld/configure | 559 ---- bld/env_run.xml | 13 - bld/namelist_files/LogMessages.pm | 244 -- bld/namelist_files/namelist_defaults.xsl | 176 -- .../namelist_defaults_clm4_5.xml | 2125 -------------- .../namelist_defaults_overall.xml | 102 - bld/namelist_files/namelist_definition.xsl | 363 --- .../namelist_definition_clm4_5.xml | 1675 ----------- .../namelist_definition_drv.xml | 17 - bld/namelist_files/use_cases/1850_control.xml | 11 - bld/namelist_files/use_cases/2000_control.xml | 11 - 20 files changed, 8139 deletions(-) delete mode 100644 bld/CESM_cppdefs delete mode 100644 bld/CLMBuildNamelist.pm delete mode 100644 bld/Filepath delete mode 100755 bld/build-namelist delete mode 100644 bld/config_cache.xml delete mode 100755 bld/config_files/clm_phys_vers.pm delete mode 100644 bld/config_files/config_defaults.xml delete mode 100644 bld/config_files/config_definition.xsl delete mode 100644 bld/config_files/config_definition_clm4_5.xml delete mode 100755 bld/configure delete mode 100644 bld/env_run.xml delete mode 100755 bld/namelist_files/LogMessages.pm delete mode 100644 bld/namelist_files/namelist_defaults.xsl delete mode 100644 bld/namelist_files/namelist_defaults_clm4_5.xml delete mode 100644 bld/namelist_files/namelist_defaults_overall.xml delete mode 100644 bld/namelist_files/namelist_definition.xsl delete mode 100644 bld/namelist_files/namelist_definition_clm4_5.xml delete mode 100644 bld/namelist_files/namelist_definition_drv.xml delete mode 100644 bld/namelist_files/use_cases/1850_control.xml delete mode 100644 bld/namelist_files/use_cases/2000_control.xml diff --git a/bld/CESM_cppdefs b/bld/CESM_cppdefs deleted file mode 100644 index 8d1c8b69..00000000 --- a/bld/CESM_cppdefs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/bld/CLMBuildNamelist.pm b/bld/CLMBuildNamelist.pm deleted file mode 100644 index 458b8daa..00000000 --- a/bld/CLMBuildNamelist.pm +++ /dev/null @@ -1,2462 +0,0 @@ -# build-namelist -# -# This script builds the namelists for CLM -# -# The simplest use of build-namelist is to execute it from the build directory where configure -# was run. By default it will use the config_cache.xml file that was written by configure to -# determine the build time properties of the executable, and will write the files that contain -# the output namelists in that same directory. But if multiple runs are to made using the -# same executable, successive invocations of build-namelist will overwrite previously generated -# namelist files. So generally the best strategy is to invoke build-namelist from the run -# directory and use the -config option to provide the filepath of the config_cache.xml file. -# -# -# Date Contributor Modification -# ------------------------------------------------------------------------------------------- -# 2009-01-20 Vertenstein Original version -# 2010-04-27 Kluzek Add ndep streams capability -# 2011-07-25 Kluzek Add multiple ensemble's of namelists -# 2012-03-23 Kluzek Add megan namelist and do checking on it -# 2012-07-01 Kluzek Add some common CESM namelist options -# 2013-12 Andre Refactor everything into subroutines -# 2013-12 Muszala Add Ecosystem Demography functionality -# 2017-08-17 Lague Add namelist options for simple land model (MML) -#-------------------------------------------------------------------------------------------- - -package CLMBuildNamelist; - -require 5; - -use strict; -#use warnings; -#use diagnostics; - -use Cwd qw(getcwd abs_path); -use File::Basename qw(dirname); -use English; -use Getopt::Long; -use IO::File; -use File::Glob ':glob'; - -#------------------------------------------------------------------------------- -# -# Define a small number of global variables -# -#------------------------------------------------------------------------------- - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; -$ProgName = "CLM " . "$ProgName"; - -my $cwd = abs_path(getcwd()); # absolute path of the current working directory -my $log; # Log messages object -- will be set in main, declaring it global here means it can be used everywhere - -#------------------------------------------------------------------------------- - -sub usage { - die < Glacier number of elevation classes [0 | 3 | 5 | 10 | 36] - (default is 0) (standard option with land-ice model is 10) - -help [or -h] Print usage to STDOUT. - -ignore_ic_date Ignore the date on the initial condition files - when determining what input initial condition file to use. - -ignore_ic_year Ignore just the year part of the date on the initial condition files - when determining what input initial condition file to use. - -ignore_warnings Allow build-namelist to continue, rather than stopping on - warnings - -infile "filepath" Specify a file (or list of files) containing namelists to - read values from. - - If used with a CLM build with multiple ensembles (ninst_lnd>1) - and the filename entered is a directory to files of the - form filepath/filepath and filepath/filepath_\$n where \$n - is the ensemble member number. the "filepath/filepath" - input namelist file is the master input namelist file - that is applied to ALL ensemble members. - - (by default for CESM this is setup for files of the - form \$CASEDIR/user_nl_clm/user_nl_clm_????) - -inputdata "filepath" Writes out a list containing pathnames for required input datasets in - file specified. - -l_ncpl "LND_NCPL" Number of CLM coupling time-steps in a day. - -mask "landmask" Type of land-mask (default, navy, gx3v5, gx1v5 etc.) - "-mask list" to list valid land masks. - -namelist "namelist" Specify namelist settings directly on the commandline by supplying - a string containing FORTRAN namelist syntax, e.g., - -namelist "&clm_inparm dt=1800 /" - -[no-]note Add note to output namelist [do NOT add note] about the - arguments to build-namelist. - -output_reals Output real parameters to the given output file. - -rcp "value" Representative concentration pathway (rcp) to use for - future scenarios. - "-rcp list" to list valid rcp settings. - -s Turns on silent mode - only fatal messages issued. - -test Enable checking that input datasets exist on local filesystem. - -use_case "case" Specify a use case which will provide default values. - "-use_case list" to list valid use-cases. - -verbose [or -v] Turn on verbose echoing of informational messages. - -version Echo the SVN tag name used to check out this CLM distribution. - - -Note: The precedence for setting the values of namelist variables is (highest to lowest): - 0. namelist values set by specific command-line options, like, -d, -sim_year - (i.e. compset choice and CLM_BLDNML_OPTS, CLM_ACCELERATED_SPINUP, LND_TUNING_MODE env_run variables) - (NOTE: If you try to contradict these settings by methods below, an error will be triggered) - 1. values set on the command-line using the -namelist option, - (i.e. CLM_NAMELIST_OPTS env_run variable) - 2. values read from the file(s) specified by -infile, - (i.e. user_nl_clm files) - 4. values set from a use-case scenario, e.g., -use_case - (i.e. CLM_NML_USE_CASE env_run variable) - 5. values from the namelist defaults file. -EOF -} - -#------------------------------------------------------------------------------- - -sub process_commandline { - # Process command-line options and return the hash - my ($nl_flags) = @_; - - # Save the command line arguments to the script. NOTE: this must be - # before GetOptions() is called because items are removed from from - # the array! - $nl_flags->{'cmdline'} = "@ARGV"; - - my %opts = ( cimeroot => undef, - config => "config_cache.xml", - csmdata => undef, - co2_type => undef, - co2_ppmv => undef, - clm_demand => "null", - help => 0, - glc_nec => "default", - l_ncpl => undef, - lnd_frac => undef, - dir => "$cwd", - rcp => "default", - sim_year => "default", - chk_res => undef, - note => undef, - output_reals_filename => undef, - res => "default", - silent => 0, - ignore_warnings => 0, - mask => "default", - test => 0, - bgc => "default", - envxml_dir => ".", - maxpft => "default", - ); - - GetOptions( - "cimeroot=s" => \$opts{'cimeroot'}, - "clm_demand=s" => \$opts{'clm_demand'}, - "co2_ppmv=f" => \$opts{'co2_ppmv'}, - "co2_type=s" => \$opts{'co2_type'}, - "config=s" => \$opts{'config'}, - "csmdata=s" => \$opts{'csmdata'}, - "envxml_dir=s" => \$opts{'envxml_dir'}, - "ignore_warnings!" => \$opts{'ignore_warnings'}, - "chk_res!" => \$opts{'chk_res'}, - "note!" => \$opts{'note'}, - "glc_nec=i" => \$opts{'glc_nec'}, - "d:s" => \$opts{'dir'}, - "h|help" => \$opts{'help'}, - "ignore_ic_date" => \$opts{'ignore_ic_date'}, - "ignore_ic_year" => \$opts{'ignore_ic_year'}, - "infile=s" => \$opts{'infile'}, - "lnd_frac=s" => \$opts{'lnd_frac'}, - "l_ncpl=i" => \$opts{'l_ncpl'}, - "inputdata=s" => \$opts{'inputdata'}, - "mask=s" => \$opts{'mask'}, - "namelist=s" => \$opts{'namelist'}, - "res=s" => \$opts{'res'}, - "rcp=s" => \$opts{'rcp'}, - "s|silent" => \$opts{'silent'}, - "sim_year=s" => \$opts{'sim_year'}, - "output_reals=s" => \$opts{'output_reals_filename'}, - "clm_start_type=s" => \$opts{'clm_start_type'}, - "test" => \$opts{'test'}, - "use_case=s" => \$opts{'use_case'}, - "bgc=s" => \$opts{'bgc'}, - "maxpft=i" => \$opts{'maxpft'}, - "v|verbose" => \$opts{'verbose'}, - "version" => \$opts{'version'}, - ) or usage(); - - # Give usage message. - usage() if $opts{'help'}; - - # Check for unparsed arguments - if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); - } - return %opts; -} - -#------------------------------------------------------------------------------- - -sub check_for_perl_utils { - - my $cfgdir = shift; - my $opts_ref = shift; - - # Determine CIME root directory and perl5lib root directory - my $cimeroot = $opts_ref->{'cimeroot'}; - if ( ! defined($cimeroot) ) { - $cimeroot = "$cfgdir/../cime"; - if ( -d $cimeroot ) { - } elsif ( -d "$cfgdir/../../../cime" ) { - $cimeroot = "$cfgdir/../../../cime"; - } else { - die <<"EOF"; -** Cannot find the root of the cime directory enter it using the -cimeroot option - Did you run the checkout_externals scripts? -EOF - } - } - - my $perl5lib_dir = "$cimeroot/utils/perl5lib"; - - #----------------------------------------------------------------------------- - # Add $perl5lib_dir to the list of paths that Perl searches for modules - my @dirs = ( $ProgDir, $cfgdir, "$perl5lib_dir"); - unshift @INC, @dirs; - - require config_files::clm_phys_vers; - require namelist_files::LogMessages; - - my $locallog = namelist_files::LogMessages->new( $ProgName, $opts_ref ); - # The XML::Lite module is required to parse the XML files. - (-f "$perl5lib_dir/XML/Lite.pm") or - $locallog->fatal_error("Cannot find perl module \"XML/Lite.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::Config module provides utilities to access the configuration information - # in the config_cache.xml file - (-f "$perl5lib_dir/Build/Config.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/Config.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::NamelistDefinition module provides utilities to validate that the output - # namelists are consistent with the namelist definition file - (-f "$perl5lib_dir/Build/NamelistDefinition.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/NamelistDefinition.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::NamelistDefaults module provides a utility to obtain default values of namelist - # variables based on finding a best fit with the attributes specified in the defaults file. - (-f "$perl5lib_dir/Build/NamelistDefaults.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/NamelistDefaults.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - # The Build::Namelist module provides utilities to parse input namelists, to query and modify - # namelists, and to write output namelists. - (-f "$perl5lib_dir/Build/Namelist.pm") or - $locallog->fatal_error("Cannot find perl module \"Build/Namelist.pm\" in directory\n" . - "\"$perl5lib_dir\""); - - - # required cesm perl modules - require XML::Lite; - require Build::Config; - require Build::NamelistDefinition; - require Build::NamelistDefaults; - require Build::Namelist; - require Config::SetupTools; -} - -#------------------------------------------------------------------------------- - -sub read_configure_definition { - # Read the configure definition and specific config_cache file for this case - # configure are the build-time settings for CLM - my ($cfgdir, $opts) = @_; - - $log->verbose_message("Setting CLM configuration script directory to $cfgdir"); - - # Create a configuration object from the default config_definition file - my $configfile; - if ( -f $opts->{'config'} ) { - $configfile = $opts->{'config'}; - } else { - $configfile = "$cfgdir/config_files/config_definition.xml"; - } - - # Check that configuration cache file exists. - $log->verbose_message("Using CLM configuration cache file $opts->{'config'}"); - if ( $configfile ne $opts->{'config'} ) { - $log->fatal_error("Cannot find configuration cache file: \"$opts->{'config'}\""); - } - - my $cfg = Build::Config->new("$configfile"); - - return $cfg; -} - -#----------------------------------------------------------------------------------------------- - -sub read_namelist_definition { - my ($cfgdir, $opts, $nl_flags, $physv) = @_; - - # The namelist definition file contains entries for all namelist - # variables that can be output by build-namelist. - my $phys = $physv->as_filename( ); - my @nl_definition_files = ( "$cfgdir/namelist_files/namelist_definition_drv.xml", - "$cfgdir/namelist_files/namelist_definition_$phys.xml" ); - foreach my $nl_defin_file ( @nl_definition_files ) { - (-f "$nl_defin_file") or $log->fatal_error("Cannot find namelist definition file \"$nl_defin_file\""); - - $log->verbose_message("Using namelist definition file $nl_defin_file"); - } - - # Create a namelist definition object. This object provides a - # method for verifying that the output namelist variables are in the - # definition file, and are output in the correct namelist groups. - my $definition = Build::NamelistDefinition->new( shift(@nl_definition_files) ); - foreach my $nl_defin_file ( @nl_definition_files ) { - $definition->add( "$nl_defin_file" ); - } - - return $definition; -} - -#----------------------------------------------------------------------------------------------- - -sub read_envxml_case_files { - # read the contents of the env*.xml files in the case directory - my ($opts) = @_; - - my %envxml = (); - if ( defined($opts->{'envxml_dir'}) ) { - (-d $opts->{'envxml_dir'}) or $log->fatal_error( "envxml_dir is not a directory" ); - my @files = glob( $opts->{'envxml_dir'}."/env_*xml" ); - ($#files >= 0) or $log->fatal_error( "there are no env_*xml files in the envxml_dir" ); - foreach my $file (@files) { - $log->verbose_message( "Open env.xml file: $file" ); - my $xml = XML::Lite->new( "$file" ); - my @e = $xml->elements_by_name('entry'); - while ( my $e = shift @e ) { - my %a = $e->get_attributes(); - $envxml{$a{'id'}} = $a{'value'}; - } - } - foreach my $attr (keys %envxml) { - if ( $envxml{$attr} =~ m/\$/ ) { - $envxml{$attr} = SetupTools::expand_xml_var( $envxml{$attr}, \%envxml ); - } - } - } else { - $log->fatal_error( "The -envxml_dir option was NOT given and it is a REQUIRED option" ); - } - return( %envxml ); -} - -#----------------------------------------------------------------------------------------------- - -sub read_namelist_defaults { - my ($cfgdir, $opts, $nl_flags, $cfg, $physv) = @_; - - my $phys = $physv->as_filename( ); - # The namelist defaults file contains default values for all required namelist variables. - my @nl_defaults_files = ( "$cfgdir/namelist_files/namelist_defaults_overall.xml", - "$cfgdir/namelist_files/namelist_defaults_$phys.xml" ); - - # Add the location of the use case defaults files to the options hash - $opts->{'use_case_dir'} = "$cfgdir/namelist_files/use_cases"; - - if (defined $opts->{'use_case'}) { - if ( $opts->{'use_case'} ne "list" ) { - unshift( @nl_defaults_files, "$opts->{'use_case_dir'}/$opts->{'use_case'}.xml" ); - } - } - - foreach my $nl_defaults_file ( @nl_defaults_files ) { - (-f "$nl_defaults_file") or $log->fatal_error("Cannot find namelist defaults file \"$nl_defaults_file\""); - - $log->verbose_message("Using namelist defaults file $nl_defaults_file"); - } - - # Create a namelist defaults object. This object provides default - # values for variables contained in the input defaults file. The - # configuration object provides attribute values that are relevent - # for the CLM executable for which the namelist is being produced. - my $defaults = Build::NamelistDefaults->new( shift( @nl_defaults_files ), $cfg); - foreach my $nl_defaults_file ( @nl_defaults_files ) { - $defaults->add( "$nl_defaults_file" ); - } - return $defaults; -} - -#------------------------------------------------------------------------------- - -sub check_cesm_inputdata { - # Check that the CESM inputdata root directory has been specified. This must be - # a local or nfs mounted directory. - - my ($opts, $nl_flags) = @_; - - $nl_flags->{'inputdata_rootdir'} = undef; - if (defined($opts->{'csmdata'})) { - $nl_flags->{'inputdata_rootdir'} = $opts->{'csmdata'}; - } - elsif (defined $ENV{'CSMDATA'}) { - $nl_flags->{'inputdata_rootdir'} = $ENV{'CSMDATA'}; - } - else { - $log->fatal_error("CESM inputdata root directory must be specified by either -csmdata\n" . - "argument or by the CSMDATA environment variable."); - } - if ( ! defined($ENV{'DIN_LOC_ROOT'}) ) { - $ENV{'DIN_LOC_ROOT'} = $nl_flags->{'inputdata_rootdir'}; - } - - if ($opts->{'test'}) { - (-d $nl_flags->{'inputdata_rootdir'}) or $log->fatal_error("CESM inputdata root is not a directory: \"$nl_flags->{'inputdata_rootdir'}\""); - } - - $log->verbose_message("CESM inputdata root directory: $nl_flags->{'inputdata_rootdir'}"); -} - -#------------------------------------------------------------------------------- - -sub process_namelist_user_input { - # Process the user input in general by order of precedence. At each point - # we'll only add new values to the namelist and not overwrite - # previously specified specified values which have higher - # precedence. The one exception to this rule are the specifc command-line - # options which are done last as if the user contradicts these settings - # CLM build-namelist will abort with an error. - # - # 1. values set on the command-line using the -namelist option, - # (i.e. CLM_NAMELIST_OPTS env_run variable) - # 2. values read from the file(s) specified by -infile, - # (i.e. user_nl_clm files) - # After the above are done the command line options are processed and they - # are made sure the user hasn't contradicted any of their settings with - # anything above. Because of this they are condsidered to have the highest - # precedence. - # 0. namelist values set by specific command-line options, like, -d, -sim_year - # (i.e. CLM_BLDNML_OPTS env_run variable) - # The results of these are needed for the final two user input - # 4. values set from a use-case scenario, e.g., -use_case - # (i.e. CLM_NML_USE_CASE env_run variable) - # - # Finally after all the above is done, the defaults are found from the - # namelist defaults file (outside of this routine). - # - - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - # Get the inputs that will be coming from the user... - process_namelist_commandline_namelist($opts, $definition, $nl, $envxml_ref); - process_namelist_commandline_infile($opts, $definition, $nl, $envxml_ref); - - # Apply the commandline options and make sure the user didn't change it above - process_namelist_commandline_options($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - - # The last two process command line arguments for use_case - # They require that process_namelist_commandline_options was called before this - process_namelist_commandline_use_case($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv); - - # Set the start_type by the command line setting for clm_start_type - process_namelist_commandline_clm_start_type($opts, $nl_flags, $definition, $defaults, $nl); - -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_options { - # First process the commandline args that provide specific namelist values. - # - # First get the command-line specified overall values or their defaults - # Obtain default values for the following build-namelist input arguments - # : res, mask, rcp, sim_year, sim_year_range. - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - setup_cmdl_chk_res($opts, $defaults); - setup_cmdl_resolution($opts, $nl_flags, $definition, $defaults); - setup_cmdl_mask($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_bgc($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_maxpft($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv); - setup_cmdl_glc_nec($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_rcp($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_simulation_year($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_run_type($opts, $nl_flags, $definition, $defaults, $nl); - setup_cmdl_output_reals($opts, $nl_flags, $definition, $defaults, $nl, $physv); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_chk_res { - my ($opts, $defaults) = @_; - - my $var = "chk_res"; - if ( ! defined($opts->{$var}) ) { - $opts->{$var} = $defaults->get_value($var); - } -} - -sub setup_cmdl_resolution { - my ($opts, $nl_flags, $definition, $defaults) = @_; - - my $var = "res"; - my $val; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val= $defaults->get_value($var); - } - - $nl_flags->{'res'} = $val; - $log->verbose_message("CLM atm resolution is $nl_flags->{'res'}"); - $opts->{$var} = $val; - if ( $opts->{'chk_res'} ) { - $val = "e_string( $nl_flags->{'res'} ); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_mask { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $var = "mask"; - my $val; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - my %tmp = ( 'hgrid'=>$nl_flags->{'res'} ); - $val = $defaults->get_value($var, \%tmp ); - } - - $nl_flags->{'mask'} = $val; - $opts->{'mask'} = $nl_flags->{'mask'}; - if ( $opts->{'chk_res'} ) { - $val = "e_string( $val ); - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - $log->verbose_message("CLM land mask is $nl_flags->{'mask'}"); -} - -#------------------------------------------------------------------------------- -sub setup_cmdl_bgc { - # BGC - alias for group of biogeochemistry related use_XXX namelists - - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var = "bgc"; - - $val = $opts->{$var}; - $nl_flags->{'bgc_mode'} = $val; - - my $var = "bgc_mode"; - if ( $nl_flags->{$var} eq "default" ) { - $nl_flags->{$var} = $defaults->get_value($var); - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $nl_flags->{$var} ) ); - if ( ! $definition->is_valid_value( $var, quote_string( $nl_flags->{$var}) ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value (".$nl_flags->{$var}.") that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Using $nl_flags->{$var} for bgc."); - - # now set the actual name list variables based on the bgc alias - if ($nl_flags->{$var} eq "bgc" ) { - $nl_flags->{'use_cn'} = ".true."; - } else { - $nl_flags->{'use_cn'} = ".false."; - } - if ( defined($nl->get_value("use_cn")) && ($nl_flags->{'use_cn'} ne $nl->get_value("use_cn")) ) { - $log->fatal_error("The namelist variable use_cn is inconsistent with the -bgc option"); - } - - { - # If the variable has already been set use it, if not set to the value defined by the bgc_mode - my @list = ( "use_lch4", "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp" ); - my $ndiff = 0; - my %settings = ( 'bgc_mode'=>$nl_flags->{'bgc_mode'} ); - foreach my $var ( @list ) { - my $default_setting = $defaults->get_value($var, \%settings ); - if ( ! defined($nl->get_value($var)) ) { - $nl_flags->{$var} = $default_setting; - } else { - if ( $nl->get_value($var) ne $default_setting ) { - $ndiff += 1; - } - $nl_flags->{$var} = $nl->get_value($var); - } - $val = $nl_flags->{$var}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - # If all the variables are different report it as an error - if ( $ndiff == ($#list + 1) ) { - $log->fatal_error("You are contradicting the -bgc setting with the namelist variables: @list" ); - } - } - - # Now set use_cn - foreach $var ( "use_cn" ) { - $val = $nl_flags->{$var}; - $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - } - my $var = "use_fun"; - if ( ! defined($nl->get_value($var)) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'phys'=>$nl_flags->{'phys'}, 'use_cn'=>$nl_flags->{'use_cn'}, - 'use_nitrif_denitrif'=>$nl_flags->{'use_nitrif_denitrif'} ); - } - if ( (! &value_is_true($nl_flags->{'use_nitrif_denitrif'}) ) && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("When FUN is on, use_nitrif_denitrif MUST also be on!"); - } -} # end bgc - - -#------------------------------------------------------------------------------- - -sub setup_cmdl_maxpft { - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $physv) = @_; - - my $val; - my $var = "maxpft"; - my $maxpatchpft = 17; - if ( $opts->{$var} ne "default") { - $val = $opts->{$var}; - } else { - $val = $maxpatchpft; - } - $nl_flags->{'maxpft'} = $val; - - if ( ($nl_flags->{'bgc_mode'} ne "sp") && ($nl_flags->{'maxpft'} != $maxpatchpft) ) { - $log->fatal_error("** For CN or BGC mode you MUST set max patch PFT's to $maxpatchpft\n" . - "**\n" . - "** Set the bgc mode, crop and maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -bgc and -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} > $maxpatchpft ) { - $log->fatal_error("** Max patch PFT's can NOT exceed $maxpatchpft\n" . - "**\n" . - "** Set maxpft by the following means from highest to lowest precedence:\n" . - "** * by the command-line options -maxpft\n" . - "** * by a default configuration file, specified by -defaults\n" . - "**"); - } - if ( $nl_flags->{'maxpft'} != $maxpatchpft ) { - $log->warning("running with maxpft NOT equal to $maxpatchpft is " . - "NOT validated / scientifically supported." ); - } - $log->verbose_message("Using $nl_flags->{'maxpft'} for maxpft."); - - $var = "maxpatch_pft"; - $val = $nl_flags->{'maxpft'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_glc_nec { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "glc_nec"; - - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - - $nl_flags->{'glc_nec'} = $val; - $opts->{'glc_nec'} = $val; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("Glacier number of elevation classes is $val"); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_rcp { - # representative concentration pathway - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "rcp"; - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - $nl_flags->{'rcp'} = $val; - $opts->{'rcp'} = $nl_flags->{'rcp'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val); - if ( ! $definition->is_valid_value( $var, $val ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var has a value ($val) that is NOT valid. Valid values are: @valid_values"); - } - $log->verbose_message("CLM future scenario representative concentration is $nl_flags->{'rcp'}"); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_simulation_year { - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg) = @_; - - my $val; - my $var = "sim_year"; - if ( $opts->{$var} ne "default" ) { - $val = $opts->{$var}; - } else { - $val = $defaults->get_value($var); - } - - $nl_flags->{'sim_year_range'} = $defaults->get_value("sim_year_range"); - $nl_flags->{'sim_year'} = $val; - if ( $val =~ /([0-9]+)-([0-9]+)/ ) { - $nl_flags->{'sim_year'} = $1; - $nl_flags->{'sim_year_range'} = $val; - } - $val = $nl_flags->{'sim_year'}; - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val ); - if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var of $val is NOT valid. Valid values are: @valid_values"); - } - $nl->set_variable_value($group, $var, $val ); - $log->verbose_message("CLM sim_year is $nl_flags->{'sim_year'}"); - - $var = "sim_year_range"; - $val = $nl_flags->{'sim_year_range'}; - if ( $val ne "constant" ) { - $opts->{$var} = $val; - $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $val ); - if ( ! $definition->is_valid_value( $var, $val, 'noquotes'=>1 ) ) { - my @valid_values = $definition->get_valid_values( $var ); - $log->fatal_error("$var of $val is NOT valid. Valid values are: @valid_values"); - } - $val = "'".$defaults->get_value($var)."'"; - $nl->set_variable_value($group, $var, $val ); - $log->verbose_message("CLM sim_year_range is $nl_flags->{'sim_year_range'}"); - } -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_run_type { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $val; - my $var = "clm_start_type"; - if (defined $opts->{$var}) { - if ($opts->{$var} eq "default" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'} ); - } else { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, quote_string( $opts->{$var} ) ); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, - 'use_cndv'=>$nl_flags->{'use_cndv'} ); - } - $nl_flags->{'clm_start_type'} = $nl->get_value($var); -} - -#------------------------------------------------------------------------------- - -sub setup_cmdl_output_reals { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "output_reals_filename"; - my $file = $opts->{$var}; - if ( defined($file) ) { - # Make sure can open file and if not die with an error - my $fh = IO::File->new($file, '>') or $log->fatal_error("can't create real parameter filename: $file"); - $fh->close(); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_namelist { - # Process the commandline '-namelist' arg. - my ($opts, $definition, $nl, $envxml_ref) = @_; - - if (defined $opts->{'namelist'}) { - # Parse commandline namelist - my $nl_arg = Build::Namelist->new($opts->{'namelist'}); - - # Validate input namelist -- trap exceptions - my $nl_arg_valid; - eval { $nl_arg_valid = $definition->validate($nl_arg); }; - if ($@) { - $log->fatal_error("Invalid namelist variable in commandline arg '-namelist'.\n $@"); - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_arg_valid, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_arg_valid); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_infile { - # Process the commandline '-infile' arg. - my ($opts, $definition, $nl, $envxml_ref) = @_; - - if (defined $opts->{'infile'}) { - my @infiles = split( /,/, $opts->{'infile'} ); - foreach my $infile ( @infiles ) { - # Make sure a valid file was found - if ( -f "$infile" ) { - # Otherwise abort as a valid file doesn't exist - } else { - $log->fatal_error("input namelist file does NOT exist $infile.\n $@"); - } - # Parse namelist input from the next file - my $nl_infile = Build::Namelist->new($infile); - - # Validate input namelist -- trap exceptions - my $nl_infile_valid; - eval { $nl_infile_valid = $definition->validate($nl_infile); }; - if ($@) { - $log->fatal_error("Invalid namelist variable in '-infile' $infile.\n $@"); - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_infile_valid, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_infile_valid); - } - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_use_case { - # Now process the -use_case arg. - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - if (defined $opts->{'use_case'}) { - - # The use case definition is contained in an xml file with the same format as the defaults file. - # Create a new NamelistDefaults object. - my $uc_defaults = Build::NamelistDefaults->new("$opts->{'use_case_dir'}/$opts->{'use_case'}.xml", $cfg); - - my %settings; - $settings{'res'} = $nl_flags->{'res'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'mask'} = $nl_flags->{'mask'}; - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; - $settings{'phys'} = $nl_flags->{'phys'}; - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'cnfireson'} = $nl_flags->{'cnfireson'}; - # Loop over the variables specified in the use case. - # Add each one to the namelist. - my @vars = $uc_defaults->get_variable_names(); - my $nl_usecase = Build::Namelist->new(); - foreach my $var (@vars) { - my $val = $uc_defaults->get_value($var, \%settings ); - - if ( defined($val) ) { - $log->message("CLM adding use_case $opts->{'use_case'} defaults for var '$var' with val '$val'"); - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl_usecase, $var, 'val'=>$val); - } - } - # Go through all variables and expand any XML env settings in them - expand_xml_variables_in_namelist( $nl_usecase, $envxml_ref ); - - # Merge input values into namelist. Previously specified values have higher precedence - # and are not overwritten. - $nl->merge_nl($nl_usecase); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_commandline_clm_start_type { - # Set the start_type according to the command line clm_start_type option - - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - # Run type for driver namelist - note that arb_ic implies that the run is startup - my $var = "start_type"; - if ($nl_flags->{'clm_start_type'} eq "'cold'" || $nl_flags->{'clm_start_type'} eq "'arb_ic'") { - # Add default is used here, but the value is explicitly set - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>'startup' ); - } else { - # Add default is used here, but the value is explicitly set - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'clm_start_type'} ); - } -} - -#------------------------------------------------------------------------------- - -sub process_namelist_inline_logic { - # Use the namelist default object to add default values for required - # namelist variables that have not been previously set. - my ($opts, $nl_flags, $definition, $defaults, $nl, $cfg, $envxml_ref, $physv) = @_; - - - ############################## - # namelist group: clm_inparm # - ############################## - setup_logic_lnd_frac($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref); - setup_logic_co2_type($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_start_type($opts, $nl_flags, $nl); - setup_logic_delta_time($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_decomp_performance($opts, $nl_flags, $definition, $defaults, $nl); - setup_logic_glacier($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv); - setup_logic_dynamic_plant_nitrogen_alloc($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_hydrstress($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_dynamic_roots($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_params_file($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_create_crop_landunit($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_soilstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_demand($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_surface_dataset($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_initial_conditions($opts, $nl_flags, $definition, $defaults, $nl, $physv); - setup_logic_snowpack($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: atm2lnd_inparm - ######################################### - setup_logic_atm_forcing($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ######################################### - # namelist group: lnd2atm_inparm - ######################################### - setup_logic_lnd2atm($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################### - # namelist group: clmu_inparm # - ############################### - setup_logic_urban($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ################################## - # namelist group: bgc_shared - ################################## - setup_logic_bgc_shared($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soilwater_movement_inparm # - ############################################# - setup_logic_soilwater_movement($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: rooting_profile_inparm # - ############################################# - setup_logic_rooting_profile($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - #################################### - # namelist group: cnvegcarbonstate # - #################################### - setup_logic_cnvegcarbonstate($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: soil_resis_inparm # - ############################################# - setup_logic_soil_resis($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ############################################# - # namelist group: canopyhydrology_inparm # - ############################################# - setup_logic_canopyhydrology($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ##################################### - # namelist group: clm_canopy_inparm # - ##################################### - setup_logic_canopy($opts, $nl_flags, $definition, $defaults, $nl, $physv); - - ####################################################################### - # namelist groups: clm_hydrology1_inparm and clm_soilhydrology_inparm # - ####################################################################### - setup_logic_hydrology_switches($nl, $physv); - -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd_frac { - - my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref) = @_; - - my $var = "lnd_frac"; - if ( defined($opts->{$var}) ) { - if ( defined($nl->get_value('fatmlndfrc')) ) { - $log->fatal_error("Can NOT set both -lnd_frac option (set via LND_DOMAIN_PATH/LND_DOMAIN_FILE " . - "env variables) AND fatmlndfrac on namelist"); - } - my $lnd_frac = SetupTools::expand_xml_var( $opts->{$var}, $envxml_ref); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fatmlndfrc','val'=>$lnd_frac ); - } - - # Get the fraction file - if (defined $nl->get_value('fatmlndfrc')) { - # do nothing - use value provided by config_grid.xml and clm.cpl7.template - } else { - $log->fatal_error("fatmlndfrc was NOT sent into CLM build-namelist."); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_co2_type { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - my $var = "co2_type"; - if ( defined($opts->{$var}) ) { - if ( ! defined($nl->get_value($var)) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'co2_type','val'=>"$opts->{'co2_type'}"); - } else { - $log->fatal_error("co2_type set on namelist as well as -co2_type option."); - } - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'co2_type'); - if ( $nl->get_value('co2_type') =~ /constant/ ) { - my $var = 'co2_ppmv'; - if ( defined($opts->{$var}) ) { - if ( $opts->{$var} <= 0.0 ) { - $log->fatal_error("co2_ppmv can NOT be less than or equal to zero."); - } - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, $opts->{$var}); - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'sim_year'=>$nl_flags->{'sim_year'} ); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_start_type { - my ($opts, $nl_flags, $nl) = @_; - - my $var = "start_type"; - my $drv_start_type = $nl->get_value($var); - my $my_start_type = $nl_flags->{'clm_start_type'}; - my $nsrest = $nl->get_value('override_nsrest'); - - if ( defined($nsrest) ) { - if ( $nsrest == 0 ) { $my_start_type = "startup"; } - if ( $nsrest == 1 ) { $my_start_type = "continue"; } - if ( $nsrest == 3 ) { $my_start_type = "branch"; } - if ( "$my_start_type" eq "$drv_start_type" ) { - $log->fatal_error("no need to set override_nsrest to same as start_type."); - } - if ( "$drv_start_type" !~ /startup/ ) { - $log->fatal_error("can NOT set override_nsrest if driver is NOT a startup type."); - } - } - - if ( $my_start_type =~ /branch/ ) { - if (not defined $nl->get_value('nrevsn')) { - $log->fatal_error("nrevsn is required for a branch type."); - } - } else { - if (defined $nl->get_value('nrevsn')) { - $log->fatal_error("nrevsn should ONLY be set for a branch type."); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_delta_time { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - if ( defined($opts->{'l_ncpl'}) ) { - my $l_ncpl = $opts->{'l_ncpl'}; - if ( $l_ncpl <= 0 ) { - $log->fatal_error("bad value for -l_ncpl option."); - } - my $val = ( 3600 * 24 ) / $l_ncpl; - my $dtime = $nl->get_value('dtime'); - if ( ! defined($dtime) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'val'=>$val); - } elsif ( $dtime ne $val ) { - $log->fatal_error("can NOT set both -l_ncpl option (via LND_NCPL env variable) AND dtime namelist variable."); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtime', 'hgrid'=>$nl_flags->{'res'}); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_decomp_performance { - my ($opts, $nl_flags, $definition, $defaults, $nl) = @_; - - # Set the number of segments per clump - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nsegspc', 'hgrid'=>$nl_flags->{'res'}); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_glacier { - # - # Glacier multiple elevation class options - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $envxml_ref, $physv) = @_; - - my $var = "maxpatch_glcmec"; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, 'val'=>$nl_flags->{'glc_nec'} ); - - my $val = $nl->get_value($var); - if ( $val != $nl_flags->{'glc_nec'} ) { - $log->fatal_error("$var set to $val does NOT agree with -glc_nec argument of $nl_flags->{'glc_nec'} (set with GLC_NEC env variable)"); - } - - if ( $nl_flags->{'glc_nec'} < 1 ) { - $log->fatal_error("For clm4_5 and later, GLC_NEC must be at least 1."); - } - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glc_snow_persistence_max_days'); - - # Dependence of albice on glc_nec has gone away starting in CLM4_5. Thus, we - # can remove glc_nec from the following call once we ditch CLM4_0. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'albice', 'glc_nec'=>$nl_flags->{'glc_nec'}); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_melt_behavior'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glacier_region_ice_runoff_behavior'); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_params_file { - # get param data. For 4_0, pft-physiology, for 4_5 old - # pft-physiology was used but now now includes CN and BGC century - # parameters. - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'paramfile', - 'phys'=>$nl_flags->{'phys'}, - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_create_crop_landunit { - # Create crop land unit - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = 'create_crop_landunit'; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var ); -} -#------------------------------------------------------------------------------- - -sub setup_logic_urban { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'building_temp_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_hac'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'urban_traffic'); -} - -#------------------------------------------------------------------------------- - -sub error_if_set { - # do a fatal_error and exit if any of the input variable names are set - my ($nl, $error, @list) = @_; - foreach my $var ( @list ) { - if ( defined($nl->get_value($var)) ) { - $log->fatal_error( "$var $error" ); - } - } -} - - -#------------------------------------------------------------------------------- - -sub setup_logic_soilstate { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'organic_frac_squared' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_layerstruct' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_bedrock' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_demand { - # - # Deal with options that the user has said are required... - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my %settings; - $settings{'hgrid'} = $nl_flags->{'res'}; - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $settings{'sim_year_range'} = $nl_flags->{'sim_year_range'}; - $settings{'mask'} = $nl_flags->{'mask'}; - $settings{'rcp'} = $nl_flags->{'rcp'}; - $settings{'glc_nec'} = $nl_flags->{'glc_nec'}; - # necessary for demand to be set correctly - $settings{'use_cn'} = $nl_flags->{'use_cn'}; - $settings{'use_cndv'} = $nl_flags->{'use_cndv'}; - $settings{'use_lch4'} = $nl_flags->{'use_lch4'}; - $settings{'use_nitrif_denitrif'} = $nl_flags->{'use_nitrif_denitrif'}; - $settings{'use_vertsoilc'} = $nl_flags->{'use_vertsoilc'}; - $settings{'use_century_decomp'} = $nl_flags->{'use_century_decomp'}; - - my $demand = $nl->get_value('clm_demand'); - if (defined($demand)) { - $demand =~ s/\'//g; # Remove quotes - if ( $demand =~ /.+/ ) { - $opts->{'clm_demand'} .= ",$demand"; - } - } - - $demand = $defaults->get_value('clm_demand', \%settings); - if (defined($demand)) { - $demand =~ s/\'//g; # Remove quotes - if ( $demand =~ /.+/ ) { - $opts->{'clm_demand'} .= ",$demand"; - } - } - - my @demandlist = split( ",", $opts->{'clm_demand'} ); - foreach my $item ( @demandlist ) { - if ( $item eq "null" ) { - next; - } - if ( $item eq "finidat" ) { - $log->fatal_error( "Do NOT put findat in the clm_demand list, set the clm_start_type=startup so initial conditions are required"); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $item, %settings ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_surface_dataset { - # - # Get surface dataset after flanduse_timeseries so that we can get surface data - # consistent with it - # MUST BE AFTER: setup_logic_demand which is where flanduse_timeseries is set - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - $nl_flags->{'flanduse_timeseries'} = "null"; - my $flanduse_timeseries = $nl->get_value('flanduse_timeseries'); - if (defined($flanduse_timeseries)) { - $flanduse_timeseries =~ s!(.*)/!!; - $flanduse_timeseries =~ s/\'//; - $flanduse_timeseries =~ s/\"//; - if ( $flanduse_timeseries ne "" ) { - $nl_flags->{'flanduse_timeseries'} = $flanduse_timeseries; - } - } - $flanduse_timeseries = $nl_flags->{'flanduse_timeseries'}; - - if ($flanduse_timeseries ne "null" && &value_is_true($nl_flags->{'use_cndv'}) ) { - $log->fatal_error( "dynamic PFT's (setting flanduse_timeseries) are incompatible with dynamic vegetation (use_cndv=.true)." ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fsurdat', - 'hgrid'=>$nl_flags->{'res'}, - 'sim_year'=>$nl_flags->{'sim_year'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}); - - # MML: try and add my own namelist variable for mml_surdat forcing file - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'mml_surdat'); - - -} - -#------------------------------------------------------------------------------- - -sub setup_logic_initial_conditions { - # Initial conditions - # The initial date is an attribute in the defaults file which should be matched unless - # the user explicitly requests to ignore the initial date via the -ignore_ic_date option, - # or just ignore the year of the initial date via the -ignore_ic_year option. - # - # MUST BE AFTER: setup_logic_demand which is where flanduse_timeseries is set - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - my $var = "finidat"; - my $finidat = $nl->get_value($var); - if ( $nl_flags->{'clm_start_type'} =~ /cold/ ) { - if (defined $finidat ) { - $log->warning("setting $var (either explicitly in your user_nl_clm or by doing a hybrid or branch RUN_TYPE)\n is incomptable with using a cold start" . - " (by setting CLM_FORCE_COLDSTART=on)." ); - $log->warning("Overridding input $var file with one specifying that this is a cold start from arbitrary initial conditions." ); - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, "' '" ); - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - $var, 'val'=>"' '", 'no_abspath'=>1); - $finidat = $nl->get_value($var); - } elsif ( defined $finidat ) { - if ( string_is_undef_or_empty($finidat) ) { - print "You are setting $var to blank which signals arbitrary initial conditions.\n"; - print "But, CLM_FORCE_COLDSTART is off which is a contradiction. For arbitrary initial conditions just use the CLM_FORCE_COLDSTART option\n"; - $log->fatal_error("To do a cold-start set ./xmlchange CLM_FORCE_COLDSTART=on, and remove the setting of $var in the user_nl_clm file"); - } - } - my $useinitvar = "use_init_interp"; - - if (not defined $finidat ) { - my $ic_date = $nl->get_value('start_ymd'); - my $st_year = int( $ic_date / 10000); - my $nofail = 1; - my %settings; - $settings{'hgrid'} = $nl_flags->{'res'}; - $settings{'phys'} = $physv->as_string(); - $settings{'nofail'} = $nofail; - my $fsurdat = $nl->get_value('fsurdat'); - $fsurdat =~ s!(.*)/!!; - $settings{'fsurdat'} = $fsurdat; - # - # If not transient use sim_year, otherwise use date - # - if (string_is_undef_or_empty($nl->get_value('flanduse_timeseries'))) { - $settings{'sim_year'} = $nl_flags->{'sim_year'}; - $opts->{'ignore_ic_year'} = 1; - } else { - delete( $settings{'sim_year'} ); - } - foreach my $item ( "mask", "maxpft", "glc_nec", "use_cn", "use_cndv", - "use_nitrif_denitrif", "use_vertsoilc", "use_century_decomp", - ) { - $settings{$item} = $nl_flags->{$item}; - } - if ($opts->{'ignore_ic_year'}) { - $settings{'ic_md'} = $ic_date; - } else { - $settings{'ic_ymd'} = $ic_date; - } - my $try = 0; - my $done = 2; - my $use_init_interp_default = $nl->get_value($useinitvar); - if ( string_is_undef_or_empty( $use_init_interp_default ) ) { - $use_init_interp_default = ".false."; - } - $settings{$useinitvar} = $use_init_interp_default; - do { - $try++; - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var, %settings ); - # If couldn't find a matching finidat file, check if can turn on interpolation and try to find one again - $finidat = $nl->get_value($var); - if ( not defined $finidat ) { - # Delete any date settings - delete( $settings{'ic_ymd'} ); - delete( $settings{'ic_md'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_sim_years" ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_how_close" ); - foreach my $sim_yr ( split( /,/, $nl->get_value("init_interp_sim_years") )) { - if ( abs($st_year - $sim_yr) < $nl->get_value("init_interp_how_close") ) { - $settings{'sim_year'} = $sim_yr; - } - } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $useinitvar, - 'use_cndv'=>$nl_flags->{'use_cndv'}, 'phys'=>$physv->as_string(), - 'sim_year'=>$settings{'sim_year'}, 'nofail'=>1 ); - $settings{$useinitvar} = $nl->get_value($useinitvar); - if ( $try > 1 ) { - my $group = $definition->get_group_name($useinitvar); - $nl->set_variable_value($group, $useinitvar, $use_init_interp_default ); - } - if ( &value_is_true($nl->get_value($useinitvar) ) ) { - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, "init_interp_attributes", - 'sim_year'=>$settings{'sim_year'}, 'use_cndv'=>$nl_flags->{'use_cndv'}, - 'glc_nec'=>$nl_flags->{'glc_nec'}, - 'use_cn'=>$nl_flags->{'use_cn'}, 'nofail'=>1 ); - my $attributes_string = remove_leading_and_trailing_quotes($nl->get_value("init_interp_attributes")); - foreach my $pair ( split( /\s/, $attributes_string) ) { - if ( $pair =~ /^([a-z_]+)=([a-z._0-9]+)$/ ) { - $settings{$1} = $2; - } else { - $log->fatal_error("Problem interpreting init_interp_attributes"); - } - } - } else { - if ( $nl_flags->{'clm_start_type'} =~ /startup/ ) { - $log->fatal_error("clm_start_type is startup so an initial conditions ($var) file is required, but can't find one without $useinitvar being set to true"); - } - $try = $done; - } - } else { - $try = $done - } - } while( ($try < $done) && (not defined $finidat ) ); - if ( not defined $finidat ) { - my $group = $definition->get_group_name($var); - $nl->set_variable_value($group, $var, "' '" ); - } - } - $finidat = $nl->get_value($var); - if ( &value_is_true($nl->get_value($useinitvar) ) && string_is_undef_or_empty($finidat) ) { - $log->fatal_error("$useinitvar is set BUT $var is NOT, need to set both" ); - } -} # end initial conditions - -#------------------------------------------------------------------------------- - -sub setup_logic_bgc_shared { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( $nl_flags->{'bgc_mode'} ne "sp" ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'constrain_stress_deciduous_onset', 'phys'=>$physv->as_string() ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrology_switches { - # - # Check on Switches for hydrology - # - my ($nl, $physv) = @_; - - my $subgrid = $nl->get_value('subgridflag' ); - my $origflag = $nl->get_value('origflag' ); - my $h2osfcflag = $nl->get_value('h2osfcflag' ); - if ( $origflag == 1 && $subgrid == 1 ) { - $log->fatal_error("if origflag is ON, subgridflag can NOT also be on!"); - } - if ( $h2osfcflag == 1 && $subgrid != 1 ) { - $log->fatal_error("if h2osfcflag is ON, subgridflag can NOT be off!"); - } - # These should NOT be set for CLM5.0 and beyond - if ( $physv->as_long() > $physv->as_long("clm4_5") ) { - foreach my $var ( "origflag", "h2osfcflag", "oldfflag" ) { - my $val = $nl->get_value($var); - if ( defined($val) ) { - $log->fatal_error( "ERROR:: $var=$val is deprecated and can only be used with CLM4.5" ); - } - } - } - # Test bad configurations - my $lower = $nl->get_value( 'lower_boundary_condition' ); - my $use_bed = $nl->get_value( 'use_bedrock' ); - my $soilmtd = $nl->get_value( 'soilwater_movement_method' ); - if ( defined($soilmtd) && defined($lower) && $soilmtd == 0 && $lower != 4 ) { - $log->fatal_error( "If soil water movement method is zeng-decker -- lower_boundary_condition can only be aquifer" ); - } - if ( defined($soilmtd) && defined($lower) && $soilmtd == 1 && $lower == 4 ) { - $log->fatal_error( "If soil water movement method is adaptive -- lower_boundary_condition can NOT be aquifer" ); - } - if ( defined($use_bed) && defined($lower) && (&value_is_true($use_bed)) && $lower != 2 ) { - $log->fatal_error( "If use_bedrock is on -- lower_boundary_condition can only be flux" ); - } - if ( defined($h2osfcflag) && defined($lower) && $h2osfcflag == 0 && $lower != 4 ) { - $log->fatal_error( "If h2osfcflag is 0 lower_boundary_condition can only be aquifer" ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_plant_nitrogen_alloc { - # - # dynamic plant nitrogen allocation model, bgc=bgc - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( &value_is_true($nl_flags->{'use_cn'}) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_flexibleCN', - 'phys'=>$physv->as_string(), 'use_cn'=>$nl_flags->{'use_cn'} ); - $nl_flags->{'use_flexibleCN'} = $nl->get_value('use_flexibleCN'); - - if ( &value_is_true($nl_flags->{'use_flexibleCN'}) ) { - # TODO(bja, 2015-04) make this depend on > clm 5.0 and bgc mode at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'MM_Nuptake_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'downreg_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'plant_ndemand_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'substrate_term_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nscalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'temp_scalar_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CNratio_floating', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reduce_dayl_factor', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'vcmax_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_residual_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_partition_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'CN_evergreen_phenology_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'} ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'carbon_resp_opt', - 'use_flexibleCN'=>$nl_flags->{'use_flexibleCN'}, 'use_fun'=>$nl->get_value('use_fun') ); - if ( $nl->get_value('carbon_resp_opt') == 1 && &value_is_true($nl->get_value('use_fun')) ) { - $log->fatal_error("carbon_resp_opt should NOT be set to 1 when FUN is also on"); - } - } - } elsif ( ! &value_is_true($nl_flags->{'use_cn'}) ) { - if ( &value_is_true($nl->get_value('use_flexibleCN')) ) { - $log->fatal_error("use_flexibleCN can ONLY be set if CN is on"); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_hydrstress { - # - # Plant hydraulic stress model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # TODO(kwo, 2015-09) make this depend on > clm 5.0 at some point. - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_hydrstress' ); - $nl_flags->{'use_hydrstress'} = $nl->get_value('use_hydrstress'); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_dynamic_roots { - # - # dynamic root model - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_dynroot', 'phys'=>$physv->as_string(), 'bgc_mode'=>$nl_flags->{'bgc_mode'}); - my $use_dynroot = $nl->get_value('use_dynroot'); - if ( &value_is_true($use_dynroot) && ($nl_flags->{'bgc_mode'} eq "sp") ) { - $log->fatal_error("Cannot turn dynroot mode on mode bgc=sp\n" . - "Set the bgc mode to 'cn' or 'bgc'."); - } - if ( &value_is_true( $use_dynroot ) && &value_is_true( $nl_flags->{'use_hydrstress'} ) ) { - $log->fatal_error("Cannot turn use_dynroot on when use_hydrstress is on" ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopy { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - # - # Canopy state - # - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, - $nl, 'leaf_mr_vcm', 'phys'=>$nl_flags->{'phys'} ) -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soilwater_movement { - # soilwater_movement require clm4_5/clm5_0 - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soilwater_movement_method' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upper_boundary_condition' ); - - my $soilmtd = $nl->get_value("soilwater_movement_method"); - my $use_bed = $nl->get_value('use_bedrock' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, - 'lower_boundary_condition', - 'soilwater_movement_method'=>$soilmtd, 'use_bedrock'=>$use_bed - ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'dtmin' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'verySmall' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerUpper' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'xTolerLower' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'expensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'inexpensive' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'flux_calculation' ); -} -#------------------------------------------------------------------------------- - -sub setup_logic_cnvegcarbonstate { - # MUST be AFTER: setup_logic_dynamic_plant_nitrogen_alloc as depends on mm_nuptake_opt which is set there - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ( &value_is_true($nl->get_value('use_cn')) ) { - my $mmnuptake = $nl->get_value('mm_nuptake_opt'); - if ( ! defined($mmnuptake) ) { $mmnuptake = ".false."; } - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'initial_vegC', - 'use_cn' => $nl->get_value('use_cn'), 'mm_nuptake_opt' => $mmnuptake ); - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_rooting_profile { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_water' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'rooting_profile_method_carbon' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_soil_resis { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'soil_resis_method' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_canopyhydrology { - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'interception_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'maximum_leaf_wetted_fraction' ); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'use_clm5_fpi' ); -} - -#------------------------------------------------------------------------------- - -sub setup_logic_snowpack { - # - # Snowpack related options - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'nlevsno'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'h2osno_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'int_snow_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'n_melt_glcmec'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'wind_dependent_snow_density'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'snow_overburden_compaction_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lotmp_snowdensity_method'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'upplim_destruct_metamorph'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'fresh_snw_rds_max'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'reset_snow_glc_ela'); - - if (remove_leading_and_trailing_quotes($nl->get_value('snow_overburden_compaction_method')) eq 'Vionnet2012') { - # overburden_compress_tfactor isn't used if we're using the Vionnet2012 - # snow overburden compaction method, so make sure the user hasn't tried - # to set it - if (defined($nl->get_value('overburden_compress_tfactor'))) { - $log->fatal_error('overburden_compress_tfactor is set, but does not apply when using snow_overburden_compaction_method=Vionnet2012'); - } - } else { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'overburden_compress_tfactor'); - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_atm_forcing { - # - # Options related to atmospheric forcings - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'glcmec_downscale_longwave'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'repartition_rain_snow'); - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'lapse_rate'); - - my $var; - - foreach $var ("lapse_rate_longwave", - "longwave_downscaling_limit") { - if ( &value_is_true($nl->get_value("glcmec_downscale_longwave")) ) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if glcmec_downscale_longwave is true"); - } - } - } - - foreach $var ("precip_repartition_glc_all_snow_t", - "precip_repartition_glc_all_rain_t", - "precip_repartition_nonglc_all_snow_t", - "precip_repartition_nonglc_all_rain_t") { - if ( &value_is_true($nl->get_value("repartition_rain_snow")) ){ - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, $var); - } else { - if (defined($nl->get_value($var))) { - $log->fatal_error("$var can only be set if repartition_rain_snow is true"); - } - } - } - } -} - -#------------------------------------------------------------------------------- - -sub setup_logic_lnd2atm { - # - # Options related to fields sent to atmosphere - # - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - if ($physv->as_long() >= $physv->as_long("clm4_5")) { - add_default($opts, $nl_flags->{'inputdata_rootdir'}, $definition, $defaults, $nl, 'melt_non_icesheet_ice_runoff'); - } -} - -#------------------------------------------------------------------------------- - -sub write_output_files { - my ($opts, $nl_flags, $defaults, $nl, $physv) = @_; - - my $note = ""; - my $var = "note"; - if ( ! defined($opts->{$var}) ) { - $opts->{$var} = $defaults->get_value($var); - } - if ( $opts->{$var} ) { - $note = "Comment:\n" . - "This namelist was created using the following command-line:\n" . - " $nl_flags->{'cfgdir'}/$ProgName $nl_flags->{'cmdline'}\n" . - "For help on options use: $nl_flags->{'cfgdir'}/$ProgName -help"; - } - - # CLM component - my @groups = qw(clm_inparm - lai_streams atm2lnd_inparm lnd2atm_inparm - cnvegcarbonstate - finidat_consistency_checks - clm_initinterp_inparm - soilwater_movement_inparm rooting_profile_inparm - soil_resis_inparm bgc_shared - clmu_inparm clm_soilstate_inparm - clm_soilhydrology_inparm - clm_glacier_behavior); - - if ( $physv->as_long() >= $physv->as_long("clm4_5") ) { - push @groups, "cn_general"; - push @groups, "clm_canopy_inparm"; - } - - my $outfile; - $outfile = "$opts->{'dir'}/lnd_in"; - $nl->write($outfile, 'groups'=>\@groups, 'note'=>"$note" ); - $log->verbose_message("Writing clm namelist to $outfile"); -} - -sub write_output_real_parameter_file { - my ($opts, $nl_flags, $definition, $defaults, $nl, $physv) = @_; - - # Output real parameters - if ( defined($opts->{'output_reals_filename'}) ) { - my $file = $opts->{'output_reals_filename'}; - my $fh = IO::File->new($file, '>>') or $log->fatal_error("can't create real parameter filename: $file"); - foreach my $var ( $definition->get_var_names() ) { - my $type = $definition->get_var_type($var); - my $doc = $definition->get_var_doc($var); - $doc =~ s/\n//g; - if ( $type =~ /real/ ) { - my $val = $nl->get_value($var); - if ( ! defined($val) ) { $val = "?.??"; } - print $fh "\! $doc\n$var = $val\n"; - } - } - $fh->close(); - } -} - -#------------------------------------------------------------------------------- - -sub add_default { - -# Add a value for the specified variable to the specified namelist object. The variables -# already in the object have the higher precedence, so if the specified variable is already -# defined in the object then don't overwrite it, just return. -# -# This method checks the definition file and adds the variable to the correct -# namelist group. -# -# The value can be provided by using the optional argument key 'val' in the -# calling list. Otherwise a default value is obtained from the namelist -# defaults object. If no default value is found this method throws an exception -# unless the 'nofail' option is set true. -# -# Example 1: Specify the default value $val for the namelist variable $var in namelist -# object $nl: -# -# add_default($inputdata_rootdir, $definition, $defaults, $nl, $var, 'val'=>$val) -# -# Example 2: Add a default for variable $var if an appropriate value is found. Otherwise -# don't add the variable -# -# add_default($inputdata_rootdir, $definition, $defaults, $nl, $var, 'nofail'=>1) -# -# -# ***** N.B. ***** This routine assumes the following variables are in package main:: -# $definition -- the namelist definition object -# $defaults -- the namelist defaults object -# $inputdata_rootdir -- CESM inputdata root directory - - my $opts = shift; - my $inputdata_rootdir = shift; - my $definition = shift; - my $defaults = shift; - my $nl = shift; - my $var = shift; - my %settings = @_; - - my $test_files = $opts->{'test'}; - #my $nl = shift; # namelist object - #my $var = shift; # name of namelist variable - #my %settings = @_; # options - - # If variable has quotes around it - if ( $var =~ /'(.+)'/ ) { - $var = $1; - } - # Query the definition to find which group the variable belongs to. Exit if not found. - - my $group = $definition->get_group_name($var); - unless ($group) { - my $fname = $definition->get_file_name(); - $log->fatal_error("variable \"$var\" not found in namelist definition file $fname."); - } - - # check whether the variable has a value in the namelist object -- if so then skip to end - my $val = $nl->get_variable_value($group, $var); - if (! defined $val) { - - # Look for a specified value in the options hash - - if (defined $settings{'val'}) { - $val = $settings{'val'}; - } - # or else get a value from namelist defaults object. - # Note that if the 'val' key isn't in the hash, then just pass anything else - # in %settings to the get_value method to be used as attributes that are matched - # when looking for default values. - else { - - $val = $defaults->get_value($var, \%settings); - - # Truncate model_version appropriately - - if ( $var eq "model_version" ) { - $val =~ /(URL: https:\/\/[a-zA-Z0-9._-]+\/)([a-zA-Z0-9\/._-]+)(\/bld\/.+)/; - $val = $2; - } - } - - # if no value is found then exit w/ error (unless 'nofail' option set) - unless ( defined($val) ) { - unless ($settings{'nofail'}) { - if ($var eq 'finidat') { - $log->message("No default value found for $var.\n" . - " Are defaults provided for this resolution and land mask?" ); - } else { - $log->fatal_error("No default value found for $var.\n" . - " Are defaults provided for this resolution and land mask?"); - } - } - else { - return; - } - } - - # query the definition to find out if the variable is an input pathname - my $is_input_pathname = $definition->is_input_pathname($var); - - # The default values for input pathnames are relative. If the namelist - # variable is defined to be an absolute pathname, then prepend - # the CESM inputdata root directory. - if (not defined $settings{'no_abspath'}) { - if (defined $settings{'set_abspath'}) { - $val = set_abs_filepath($val, $settings{'set_abspath'}); - } else { - if ($is_input_pathname eq 'abs') { - $val = set_abs_filepath($val, $inputdata_rootdir); - if ( $test_files and ($val !~ /null/) and (! -f "$val") ) { - $log->fatal_error("file not found: $var = $val"); - } - } - } - } - - # query the definition to find out if the variable takes a string value. - # The returned string length will be >0 if $var is a string, and 0 if not. - my $str_len = $definition->get_str_len($var); - - # If the variable is a string, then add quotes if they're missing - if ($str_len > 0) { - $val = quote_string($val); - } - - # set the value in the namelist - $nl->set_variable_value($group, $var, $val); - } - -} - -#------------------------------------------------------------------------------- - -sub expand_xml_variables_in_namelist { - # Go through all variables in the namelist and expand any XML env settings in them - my ($nl, $xmlvar_ref) = @_; - - foreach my $group ( $nl->get_group_names() ) { - foreach my $var ( $nl->get_variable_names($group) ) { - my $val = $nl->get_variable_value($group, $var); - my $newval = SetupTools::expand_xml_var( $val, $xmlvar_ref ); - if ( $newval ne $val ) { - $nl->set_variable_value($group, $var, $newval); - } - } - } -} - -#------------------------------------------------------------------------------- - -sub check_input_files { - -# For each variable in the namelist which is an input dataset, check to see if it -# exists locally. -# -# ***** N.B. ***** This routine assumes the following variables are in package main:: -# $definition -- the namelist definition object -# $nl -- namelist object -# $inputdata_rootdir -- if false prints test, else creates inputdata file - - my ($nl, $inputdata_rootdir, $outfile, $definition) = @_; - - open(OUTFILE, ">>$outfile") if defined $inputdata_rootdir; - - # Look through all namelist groups - my @groups = $nl->get_group_names(); - foreach my $group (@groups) { - - # Look through all variables in each group - my @vars = $nl->get_variable_names($group); - foreach my $var (@vars) { - - # Is the variable an input dataset? - my $input_pathname_type = $definition->is_input_pathname($var); - - # If it is, check whether it exists locally and print status - if ($input_pathname_type) { - - # Get pathname of input dataset - my $pathname = $nl->get_variable_value($group, $var); - # Need to strip the quotes - $pathname =~ s/['"]//g; - - if ($input_pathname_type eq 'abs') { - if ($inputdata_rootdir) { - #MV $pathname =~ s:$inputdata_rootdir::; - print OUTFILE "$var = $pathname\n"; - } - else { - if (-e $pathname) { # use -e rather than -f since the absolute pathname - # might be a directory - print "OK -- found $var = $pathname\n"; - } - else { - print "NOT FOUND: $var = $pathname\n"; - } - } - } - elsif ($input_pathname_type =~ m/rel:(.+)/o) { - # The match provides the namelist variable that contains the - # root directory for a relative filename - my $rootdir_var = $1; - my $rootdir = $nl->get_variable_value($group, $rootdir_var); - $rootdir =~ s/['"]//g; - if ($inputdata_rootdir) { - $pathname = "$rootdir/$pathname"; - #MV $pathname =~ s:$inputdata_rootdir::; - print OUTFILE "$var = $pathname\n"; - } - else { - if (-f "$rootdir/$pathname") { - print "OK -- found $var = $rootdir/$pathname\n"; - } - else { - print "NOT FOUND: $var = $rootdir/$pathname\n"; - } - } - } - } - } - } - close OUTFILE if defined $inputdata_rootdir; - return 0 if defined $inputdata_rootdir; -} - -#------------------------------------------------------------------------------- - -sub set_abs_filepath { - -# check whether the input filepath is an absolute path, and if it isn't then -# prepend a root directory - - my ($filepath, $rootdir) = @_; - - # strip any leading/trailing whitespace and quotes - $filepath = trim($filepath); - $filepath = remove_leading_and_trailing_quotes($filepath); - $rootdir = trim($rootdir); - $rootdir = remove_leading_and_trailing_quotes($rootdir); - - my $out = $filepath; - unless ( $filepath =~ /^\// ) { # unless $filepath starts with a / - $out = "$rootdir/$filepath"; # prepend the root directory - } - return $out; -} - -#------------------------------------------------------------------------------- - -sub valid_option { - - my ($val, @expect) = @_; - - my $expect; - - $val = trim($val); - - foreach $expect (@expect) { - if ($val =~ /^$expect$/i) { return $expect; } - } - return undef; -} - -#------------------------------------------------------------------------------- - -sub check_use_case_name { -# -# Check the use-case name and ensure it follows the naming convention. -# - my ($use_case) = @_; - - my $diestring = "bad use_case name $use_case, follow the conventions " . - "in namelist_files/use_cases/README\n"; - my $desc = "[a-zA-Z0-9]*"; - my $rcp = "rcp[0-9\.]+"; - if ( $use_case =~ /^[0-9]+-[0-9]+([a-zA-Z0-9_\.]*)_transient$/ ) { - my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { - # valid name - } elsif ( $string =~ /^_*($desc)$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } - } elsif ( $use_case =~ /^20thC([a-zA-Z0-9_\.]*)_transient$/ ) { - my $string = $1; - if ( $string =~ /^_($rcp)_*($desc)$/ ) { - # valid name - } elsif ( $string =~ /^_*($desc)$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } - } elsif ( $use_case =~ /^([0-9]+)_*($desc)_control$/ ) { - # valid name - } elsif ( $use_case =~ /^($desc)_pd$/ ) { - # valid name - } else { - $log->fatal_error($diestring); - } -} - -#------------------------------------------------------------------------------- - -sub validate_options { - -# $source -- text string declaring the source of the options being validated -# $cfg -- configure object -# $opts -- reference to hash that contains the options - - my ($source, $cfg, $opts) = @_; - - my ($opt, $old, @expect); - - # use_case - $opt = 'use_case'; - if (defined $opts->{$opt}) { - - if ( $opts->{$opt} ne "list" ) { - # create the @expect array by listing the files in $use_case_dir - # and strip off the ".xml" part of the filename - @expect = (); - my @files = glob("$opts->{'use_case_dir'}/*.xml"); - foreach my $file (@files) { - $file =~ m{.*/(.*)\.xml}; - &check_use_case_name( $1 ); - push @expect, $1; - } - - $old = $opts->{$opt}; - $opts->{$opt} = valid_option($old, @expect) - or $log->fatal_error("invalid value of $opt ($old) specified in $source\n" . - "expected one of: @expect"); - } else { - print "Use cases are:...\n\n"; - my @ucases; - foreach my $file( sort( glob($opts->{'use_case_dir'}."/*.xml") ) ) { - my $use_case; - if ( $file =~ /\/([^\/]+)\.xml$/ ) { - &check_use_case_name( $1 ); - $use_case = $1; - } else { - $log->fatal_error("Bad name for use case file = $file"); - } - my $uc_defaults = Build::NamelistDefaults->new("$file", $cfg); - printf "%15s = %s\n", $use_case, $uc_defaults->get_value("use_case_desc"); - push @ucases, $use_case; - } - $log->exit_message("use cases : @ucases"); - } - } -} - -#------------------------------------------------------------------------------- - -sub list_options { -# -# List the options for different command line values if asked for -# - my ($opts_cmdl, $definition, $defaults) = @_; - - # options to list values that are in the defaults files - my @opts_list = ( "res", "mask", "sim_year", "rcp" ); - my %opts_local; - foreach my $var ( "res", "mask", "sim_year", "rcp" ) { - my $val; - if ( $opts_cmdl->{$var} eq "list" ) { - $val = "default"; - } elsif ( $opts_cmdl->{$var} eq "default" ) { - $val = $defaults->get_value($var, \%opts_local ); - } else { - $val = $opts_cmdl->{$var}; - } - my $vname = $var; - if ( $vname eq "res" ) { $vname = "hgrid"; } - $opts_local{$vname} = $val; - } - foreach my $var ( @opts_list ) { - if (defined $opts_cmdl->{$var}) { - - if ( $opts_cmdl->{$var} eq "list" ) { - my @valid_values = $definition->get_valid_values( $var ); - if ( $var eq "sim_year" ) { - unshift( @valid_values, - $definition->get_valid_values( "sim_year_range" ) ); - } - unshift( @valid_values, "default" ); - # Strip out quotes and the constant value - for( my $i = 0; $i <= $#valid_values; $i++ ) { - $valid_values[$i] =~ s/('|')//g; - if ( $valid_values[$i] eq "constant" ) { $valid_values[$i] = undef; } - } - my $val= $defaults->get_value($var, \%opts_local); - my $doc = $definition->get_var_doc( $var ); - $doc =~ s/\n//; - chomp( $doc ); - $log->exit_message("valid values for $var ($doc) :\n" . - " Values: @valid_values\n" . - " Default = $val\n" . - " (NOTE: resolution and mask and other settings may influence what the default is)"); - } - } - } - # clm_demand - my $var = 'clm_demand'; - if (defined $opts_cmdl->{$var}) { - - if ( $opts_cmdl->{$var} eq "list" ) { - my @vars = $definition->get_var_names( ); - my @demands = ( "null" ); - foreach my $var ( @vars ) { - if ( $definition->get_group_name( $var ) ne "clm_inparm" ) { next; } - if ( defined($defaults->get_value($var, $opts_cmdl ) ) ) { - push( @demands, $var ); - } - } - my $doc = $definition->get_var_doc( 'clm_demand' ); - $doc =~ s/\n//; - chomp( $doc ); - $log->exit_message("valid values for $var ($doc) :\n" . - "Namelist options to require: @demands\n" . - "any valid namelist item for clm_inparm can be set. However, not all are\n" . - "available in the clm defaults file. The defaults are also dependent on\n" . - "resolution and landmask, as well as other settings. Hence, the list above\n" . - "will vary depending on what you set for resolution and landmask."); - } - } -} - -#------------------------------------------------------------------------------- - -sub trim { - # remove leading and trailing whitespace from a string. - my ($str) = @_; - $str =~ s/^\s+//; - $str =~ s/\s+$//; - return $str; -} - -#------------------------------------------------------------------------------- - -sub quote_string { - # Add quotes around a string, unless they are already there - my ($str) = @_; - $str = trim($str); - unless ($str =~ /^['"]/) { #"' - $str = "\'$str\'"; - } - return $str; - } - -#------------------------------------------------------------------------------- - -sub remove_leading_and_trailing_quotes { - # Remove leading and trailing single and double quotes from a string. Also - # removes leading spaces before the leading quotes, and trailing spaces after - # the trailing quotes. - - my ($str) = @_; - - $str = trim($str); - - # strip any leading/trailing quotes - $str =~ s/^['"]+//; - $str =~ s/["']+$//; - - return $str; -} - -#------------------------------------------------------------------------------- - -sub logical_to_fortran { - # Given a logical variable ('true' / 'false'), convert it to a fortran-style logical ('.true.' / '.false.') - # The result will be lowercase, regardless of the case of the input. - my ($var) = @_; - my $result; - - if (lc($var) eq 'true') { - $result = ".true."; - } - elsif (lc($var) eq 'false') { - $result = ".false."; - } - else { - $log->fatal_error("Unexpected value in logical_to_fortran: $var"); - } - - return $result; -} - -#------------------------------------------------------------------------------- - -sub string_is_undef_or_empty { - # Return true if the given string is undefined or only spaces, false otherwise. - # A quoted empty string (' ' or " ") is treated as being empty. - my ($str) = @_; - if (!defined($str)) { - return 1; - } - else { - $str = remove_leading_and_trailing_quotes($str); - if ($str =~ /^\s*$/) { - return 1; - } - else { - return 0; - } - } -} - -#------------------------------------------------------------------------------- - -sub value_is_true { - # Return true if the given namelist value is .true. - # An undefined value is treated as false (with the assumption that false is the default in the code) - my ($val) = @_; - - # Some regular expressions... - ###my $TRUE = qr/\.true\./i; - ###my $FALSE = qr/\.false\./i; - # **N.B.** the use of qr// for precompiling regexps isn't supported until perl 5.005. - my $TRUE = '\.?true\.?|[t]'; - my $FALSE = '\.?false\.?|[f]'; - my $is_true = 0; - if (defined($val)) { - if ($val =~ /$TRUE/i) { - $is_true = 1; - } - } - - return $is_true; -} - -#------------------------------------------------------------------------------- - -sub version { -# The version is found in CLM ChangeLog file. -# $cfgdir is set by the configure script to the name of its directory. - - my ($cfgdir) = @_; - - my $logfile = "$cfgdir/../doc/ChangeLog"; - - my $fh = IO::File->new($logfile, '<') or $log->fatal_error("can't open ChangeLog file: $logfile"); - - while (my $line = <$fh>) { - - if ($line =~ /^Tag name:\s*([a-zA-Z0-9_. -]*[clmcesm0-9_.-]+)$/ ) { - $log->exit_message("$1"); - } - } -} - -#------------------------------------------------------------------------------- - -sub main { - my %nl_flags; - $nl_flags{'cfgdir'} = dirname(abs_path($0)); - - my %opts = process_commandline(\%nl_flags); - my $cfgdir = $nl_flags{'cfgdir'}; - check_for_perl_utils($cfgdir, \%opts); - - $log = namelist_files::LogMessages->new( $ProgName, \%opts ); # global - version($cfgdir) if $opts{'version'}; - my $cfg = read_configure_definition($cfgdir, \%opts); - - my $physv = config_files::clm_phys_vers->new( $cfg->get('phys') ); - my $definition = read_namelist_definition($cfgdir, \%opts, \%nl_flags, $physv); - my $defaults = read_namelist_defaults($cfgdir, \%opts, \%nl_flags, $cfg, $physv); - - # List valid values if asked for - list_options(\%opts, $definition, $defaults); - - # Validate some of the commandline option values. - validate_options("commandline", $cfg, \%opts); - - # Create an empty namelist object. - my $nl = Build::Namelist->new(); - - check_cesm_inputdata(\%opts, \%nl_flags); - - # Read in the env_*.xml files - my %env_xml = read_envxml_case_files( \%opts ); - - # Process the user inputs - process_namelist_user_input(\%opts, \%nl_flags, $definition, $defaults, $nl, $cfg, \%env_xml, $physv ); - # Get any other defaults needed from the namelist defaults file - process_namelist_inline_logic(\%opts, \%nl_flags, $definition, $defaults, $nl, $cfg, \%env_xml, $physv); - - # Validate that the entire resultant namelist is valid - $definition->validate($nl); - write_output_files(\%opts, \%nl_flags, $defaults, $nl, $physv); - write_output_real_parameter_file(\%opts, \%nl_flags, $definition, $defaults, $nl, $physv); - - if ($opts{'inputdata'}) { - check_input_files($nl, $nl_flags{'inputdata_rootdir'}, $opts{'inputdata'}, $definition); - } - $log->final_exit("Successfully made CLM namelist file"); -} - -#------------------------------------------------------------------------------- - -1; diff --git a/bld/Filepath b/bld/Filepath deleted file mode 100644 index b8ec46d2..00000000 --- a/bld/Filepath +++ /dev/null @@ -1,8 +0,0 @@ -../SourceMods/src.clm -/glade/p/work/erik/SimpleLand/src/main -/glade/p/work/erik/SimpleLand/src/biogeophys -/glade/p/work/erik/SimpleLand/src/biogeochem -/glade/p/work/erik/SimpleLand/src/soilbiogeochem -/glade/p/work/erik/SimpleLand/src/init_interp -/glade/p/work/erik/SimpleLand/src/utils -/glade/p/work/erik/SimpleLand/src/cpl diff --git a/bld/build-namelist b/bld/build-namelist deleted file mode 100755 index 46e485d1..00000000 --- a/bld/build-namelist +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# clm build-namelist driver -# -# Placing all of build-namelist into CLMBuildNamelist.pm means we can unit test the module. -# -require 5; - -use strict; - -BEGIN { - # ensure that the cesm create_X scripts can find CLMBuildNamelist.pm - use File::Basename qw(dirname); - use Cwd qw(abs_path); - my $dirname = dirname(abs_path($0)); - my @dirs = ($dirname, ); - unshift @INC, @dirs; -} - -use CLMBuildNamelist qw(main); - -CLMBuildNamelist::main(); diff --git a/bld/config_cache.xml b/bld/config_cache.xml deleted file mode 100644 index 2875f0b1..00000000 --- a/bld/config_cache.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - -/glade/p/work/erik/SimpleLand/bld/configure - - -Root directory of CLM source distribution (directory above CLM configure). - - -Component framework interface to use -(Model Coupling Toolkit, or Earth System Modeling Framework) - - -User specified CPP defines to append to Makefile defaults. -Note: It's recommended to use configure options to set standard CPP values rather -than defining them here. - - -Specifies either clm4_5, or clm5_0 physics - - -User source directories to prepend to the filepath. Multiple directories -are specified as a comma separated list with no embedded white space. -Normally this is SourceMods/src.clm in your case. - - - diff --git a/bld/config_files/clm_phys_vers.pm b/bld/config_files/clm_phys_vers.pm deleted file mode 100755 index efd83609..00000000 --- a/bld/config_files/clm_phys_vers.pm +++ /dev/null @@ -1,196 +0,0 @@ -package config_files::clm_phys_vers; -my $pkg_nm = 'config_files::clm_phys_vers'; -#----------------------------------------------------------------------------------------------- -# -# SYNOPSIS -# -# require config_files::clm_phys_vers; -# -# my $phys = config_files::clm_phys_vers->new("clm4_5"); -# print $phys->as_float(); -# print $phys->as_long(); -# print $phys->as_string(); -# print $phys->as_filename(); -# -# DESCRIPTION -# -# Enter the physics version as a string, with a list of valid versions, and have the ability to convert it to -# different formats. -# -# COLLABORATORS: None -# -#----------------------------------------------------------------------------------------------- -# -# Date Author Modification -# 03/06/2014 Erik Kluzek creation -# -#-------------------------------------------------------------------------------------------- - -use strict; -use bigint; -#use warnings; -#use diagnostics; - -my $major_mask = 1000000; -my $minor_mask = 1000; -my @version_strings = ( "clm4_5", "clm5_0" ); -my @version_long = ( 4*$major_mask+5*$minor_mask, 5*$major_mask ); - -#------------------------------------------------------------------------------- - -sub new { - # Constructor, enter version string as argument - my $class = shift; - my $vers_string = shift; - - my $nm = "$class\:\:new"; - my $self = {}; - bless($self, $class); - $self->__validate_vers__( $vers_string ); - $self->{'vers_string'} = $vers_string; - return( $self ); -} - -#------------------------------------------------------------------------------- - -sub __validate_vers__ { - # Make sure the version string is a valid one - my $class = shift; - my $vers_string = shift; - - my $found = undef; - foreach my $i (0..$#version_strings) { - if ( $vers_string eq $version_strings[$i] ) { - $found = 1; - last; - } - } - if ( ! defined($found) ) { - die "NOT a valid CLM version: $vers_string\n"; - } -} - -#------------------------------------------------------------------------------- - -sub as_long { -# Return the physics version as a long - my $self = shift; - my $vers = shift; - - if ( ! defined($vers) ) { - $vers = $self->{'vers_string'}; - } else { - $self->__validate_vers__( $vers ); - } - my $phys = undef; - for( my $i = 0; $i <= $#version_strings; $i++ ) { - if ( $vers eq $version_strings[$i] ) { - $phys = $version_long[$i]; - last; - } - } - return( $phys ); -} - -#------------------------------------------------------------------------------- - -sub as_float { -# Return the physics version as a float - my $self = shift; - - my $long = $self->as_long(); - my $major = int($long / $major_mask); - my $minor = int(($long - $major*$major_mask)/ $minor_mask); - my $rev = $long - $major*$major_mask - $minor*$minor_mask; - { - no bigint; - use bignum; - - my $phys = $major*1.0 + $minor/10.0 + $rev / 10000.0; - return( $phys ); - } -} - -#------------------------------------------------------------------------------- - -sub as_string { -# Return the physics version as a string - my $self = shift; - - my $phys = $self->{'vers_string'}; - return( $phys ); -} - -#------------------------------------------------------------------------------- - -sub as_filename { -# Return the physics version string with clm4_5 and clm5_0 pointing to the same name - my $self = shift; - - my $phys = undef; - if ( $self->as_long() < 5*$major_mask ) { - $phys = $self->as_string(); - } else { - $phys = "clm4_5"; - } - return( $phys ); -} - -#----------------------------------------------------------------------------------------------- -# Unit testing of above -#----------------------------------------------------------------------------------------------- -if ( ! defined(caller) && $#ARGV == -1 ) { - package phys_vers_unit_tester; - - require Test::More; - Test::More->import( ); - - plan( tests=>8); - - sub testit { - print "unit tester\n"; - my %lastv; - my @vers_list = ( "clm4_5", "clm5_0" ); - foreach my $vers ( @vers_list ) { - my $phys = config_files::clm_phys_vers->new($vers); - isa_ok($phys, "config_files::clm_phys_vers", "created clm_phys_vers object"); - print "$vers: long: ".$phys->as_long()." float: ".$phys->as_float()." string: ".$phys->as_string()." file: ".$phys->as_filename()."\n"; - if ( exists($lastv{"long"}) ) { - is( $phys->as_long() > $lastv{'long'}, 1, "Definition of long is not increasing\n" ); - } - if ( exists($lastv{"float"}) ) { - is( $phys->as_float() > $lastv{'float'}, 1, "Definition of float is not increasing\n" ); - } - # Check that also can get results of any valid value for long - foreach my $chvers ( @vers_list ) { - my $lvalue = $phys->as_long($chvers); - print "Long value of $chvers = $lvalue\n"; - } - # Check that a bad value gives an error - eval { $phys->as_long('xxx'); }; - like( $@, qr/NOT a valid CLM version:/, "check that a bad version fails" ); - # Save last values to make sure increasing - $lastv{'long'} = $phys->as_long(); - $lastv{'float'} = $phys->as_float(); - } - my $phys = config_files::clm_phys_vers->new("clm4_5"); - no bigint; - use bignum; - is( 4.5, $phys->as_float(), "Make sure clm4_5 correct float value" ); - no bignum; - use bigint; - $phys = config_files::clm_phys_vers->new("clm5_0"); - is( 5.0, $phys->as_float(), "Make sure clm5_0 correct float value" ); - print "\nSuccessfully ran all tests\n"; - } -} - -#----------------------------------------------------------------------------------------------- -# Determine if you should run the unit test or if this is being called from a require statement -#----------------------------------------------------------------------------------------------- - -if ( defined(caller) ) { - 1 # to make use or require happy -} elsif ( $#ARGV == -1 ) { - &phys_vers_unit_tester::testit(); -} diff --git a/bld/config_files/config_defaults.xml b/bld/config_files/config_defaults.xml deleted file mode 100644 index 09d5634b..00000000 --- a/bld/config_files/config_defaults.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bld/config_files/config_definition.xsl b/bld/config_files/config_definition.xsl deleted file mode 100644 index f2f88609..00000000 --- a/bld/config_files/config_definition.xsl +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - CLM Configuration Definition - - -

CLM Configuration Definition

- - - - - - - - - - - - -
CLM Physics Configurations
NameValueDescription
Valid Values
- - - - - - - - - - - - -
CLM Biogeochemistry Configurations
NameValueDescription
Valid Value
- - - - - - - - - - - - -
Configuration Directories
NameValueDescription
Valid Value
- - -
- - - - - - - - - Valid values: - - - - -
diff --git a/bld/config_files/config_definition_clm4_5.xml b/bld/config_files/config_definition_clm4_5.xml deleted file mode 100644 index eb38cbe2..00000000 --- a/bld/config_files/config_definition_clm4_5.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - -Specifies either clm4_5, or clm5_0 physics - - - -Root directory of CLM source distribution (directory above CLM configure). - - - -Component framework interface to use -(Model Coupling Toolkit, or Earth System Modeling Framework) - - - -User source directories to prepend to the filepath. Multiple directories -are specified as a comma separated list with no embedded white space. -Normally this is SourceMods/src.clm in your case. - - - -User specified CPP defines to append to Makefile defaults. -Note: It's recommended to use configure options to set standard CPP values rather -than defining them here. - - - diff --git a/bld/configure b/bld/configure deleted file mode 100755 index 9823585f..00000000 --- a/bld/configure +++ /dev/null @@ -1,559 +0,0 @@ -#!/usr/bin/env perl -#----------------------------------------------------------------------------------------------- -# -# configure -# -# -# This utility allows the CLM user to specify compile-time configuration -# options via a commandline interface. The output from configure is a -# Makefile and a cache file that contains all configuration parameters -# required to produce the Makefile. A subsequent invocation of configure -# can use the cache file as input (via the -defaults argument) to reproduce -# the CLM configuration contained in it. Note that when a cache file is -# used to set default values only the model parameters are used. The -# parameters that are platform dependent (e.g., compiler options, library -# locations, etc) are ignored. -# -# As the build time configurable options of CLM are changed, this script -# must also be changed. Thus configure is maintained under revision -# control in the CLM source tree and it is assumed that only the version of -# configure in the source tree will be used to build CLM. Thus we assume -# that the root of the source tree can be derived from the location of this -# script. -# -#----------------------------------------------------------------------------------------------- - -use strict; -#use warnings; -#use diagnostics; -use Cwd qw(getcwd abs_path); -use English; -use Getopt::Long; -use IO::File; -use IO::Handle; -use File::Copy; - -#----------------------------------------------------------------------------------------------- - -sub usage { - die <). Any value that contains - white-space must be quoted. Long option names may be supplied with either single - or double leading dashes. A consequence of this is that single letter options may - NOT be bundled. - - -bgc Build CLM with BGC package [ none | cn | cndv ] - (default is none). - -cache Name of output cache file (default: config_cache.xml). - -cachedir Name of directory where output cache file is written - (default: CLM build directory). - -cimeroot REQUIRED: Path to cime directory - -clm_root Root directory of clm source code - (default: directory above location of this script) - -cppdefs A string of user specified CPP defines. Appended to - Makefile defaults. e.g. -cppdefs '-DVAR1 -DVAR2' - -crop Toggle for prognostic crop model. [on | off] (default is off) - (can ONLY be turned on when BGC type is CN or CNDV) - -comp_intf Component interface to use (ESMF or MCT) (default MCT) - -defaults Specify full path to a configuration file which will be used - to supply defaults instead of the defaults in bld/config_files. - This file is used to specify model configuration parameters only. - Parameters relating to the build which are system dependent will - be ignored. - -help [or -h] Print usage to STDOUT. - -nofire Turn off wildfires for BGC setting of CN - (default includes fire for CN) - -noio Turn history output completely off (typically for testing). - -phys Value of clm4_5, or clm5_0 (default is clm4_5) - -silent [or -s] Turns on silent mode - only fatal messages issued. - -sitespf_pt Setup for the given site specific single-point resolution. - -snicar_frc Turn on SNICAR radiative forcing calculation. [on | off] - (default is off) - -spinup CLM 4.0 Only. For CLM 4.5, spinup is controlled from build-namelist. - Turn on given spinup mode for BGC setting of CN (level) - AD Turn on Accelerated Decomposition from (2) - bare-soil - exit Jump directly from AD spinup to normal mode (1) - normal Normal decomposition ("final spinup mode") (0) - (default) - The recommended sequence is 2-1-0 - -usr_src [,[,[...]]] - Directories containing user source code. - -verbose [or -v] Turn on verbose echoing of settings made by configure. - -version Echo the SVN tag name used to check out this CLM distribution. -EOF -} - -#----------------------------------------------------------------------------------------------- -# Setting autoflush (an IO::Handle method) on STDOUT helps in debugging. It forces the test -# descriptions to be printed to STDOUT before the error messages start. - -*STDOUT->autoflush(); - -#----------------------------------------------------------------------------------------------- -# Set the directory that contains the CLM configuration scripts. If the configure command was -# issued using a relative or absolute path, that path is in $ProgDir. Otherwise assume the -# command was issued from the current working directory. - -(my $ProgName = $0) =~ s!(.*)/!!; # name of this script -my $ProgDir = $1; # name of directory containing this script -- may be a - # relative or absolute path, or null if the script is in - # the user's PATH -my $cwd = getcwd(); # current working directory -my $cfgdir; # absolute pathname of directory that contains this script -if ($ProgDir) { - $cfgdir = abs_path($ProgDir); -} else { - $cfgdir = $cwd; -} - -#----------------------------------------------------------------------------------------------- -# Save commandline -my $commandline = "$cfgdir/configure @ARGV"; - -#----------------------------------------------------------------------------------------------- -# Parse command-line options. -my %opts = ( - cache => "config_cache.xml", - phys => "clm4_5", - nofire => undef, - noio => undef, - cimeroot => undef, - clm_root => undef, - spinup => "normal", - ); -GetOptions( - "spinup=s" => \$opts{'spinup'}, - "bgc=s" => \$opts{'bgc'}, - "cache=s" => \$opts{'cache'}, - "cachedir=s" => \$opts{'cachedir'}, - "snicar_frc=s" => \$opts{'snicar_frc'}, - "cimeroot=s" => \$opts{'cimeroot'}, - "clm_root=s" => \$opts{'clm_root'}, - "cppdefs=s" => \$opts{'cppdefs'}, - "comp_intf=s" => \$opts{'comp_intf'}, - "defaults=s" => \$opts{'defaults'}, - "clm4me=s" => \$opts{'clm4me'}, - "h|help" => \$opts{'help'}, - "nofire" => \$opts{'nofire'}, - "noio" => \$opts{'noio'}, - "phys=s" => \$opts{'phys'}, - "snicar_frc=s" => \$opts{'snicar_frc'}, - "s|silent" => \$opts{'silent'}, - "sitespf_pt=s" => \$opts{'sitespf_pt'}, - "usr_src=s" => \$opts{'usr_src'}, - "v|verbose" => \$opts{'verbose'}, - "version" => \$opts{'version'}, - "crop=s" => \$opts{'crop'}, -) or usage(); - -# Give usage message. -usage() if $opts{'help'}; - -# Echo version info. -version($cfgdir) if $opts{'version'}; - -# Check for unparsed arguments -if (@ARGV) { - print "ERROR: unrecognized arguments: @ARGV\n"; - usage(); -} - -# Define 3 print levels: -# 0 - only issue fatal error messages -# 1 - only informs what files are created (default) -# 2 - verbose -my $print = 1; -if ($opts{'silent'}) { $print = 0; } -if ($opts{'verbose'}) { $print = 2; } -my $eol = "\n"; - -my %cfg = (); # build configuration - -#----------------------------------------------------------------------------------------------- -# Make sure we can find required perl modules and configuration files. -# Look for them in the directory that contains the configure script. - -my $cimeroot = $opts{'cimeroot'}; -if ( ! defined($cimeroot) ) { - $cimeroot = "$cfgdir/../cime"; - if ( -d $cimeroot ) { - } elsif ( -d "$cfgdir/../../../cime" ) { - $cimeroot = "$cfgdir/../../../cime"; - } else { - die <<"EOF"; -** Cannot find the root of the cime directory enter it using the -cimeroot option - Did you run the checkout_externals scripts? -EOF - } -} -my $casecfgdir = "$cimeroot/scripts/Tools"; -my $perl5lib = "$cimeroot/utils/perl5lib/"; - -# The Build::Config module provides utilities to store and manipulate the configuration. -my $file = "$perl5lib/Build/Config.pm"; -(-f "$file") or die <<"EOF"; -** Cannot find perl module \"Build/Config.pm\" in path - \"$file\" ** -EOF -#----------------------------------------------------------------------------------------------- -# Add $cfgdir/perl5lib to the list of paths that Perl searches for modules -my @dirs = ( $cfgdir, "$perl5lib", $casecfgdir); -unshift @INC, @dirs; -require Build::Config; -require config_files::clm_phys_vers; - -# Get the physics version -my $phys = config_files::clm_phys_vers->new($opts{'phys'}); - -# Check for the physics specific configuration definition file. -my $phys_string = $phys->as_filename(); - -my $config_def_file = "config_definition_$phys_string.xml"; -(-f "$cfgdir/config_files/$config_def_file") or die <<"EOF"; -** Cannot find configuration definition file \"$config_def_file\" in directory - \"$cfgdir/config_files\" ** -EOF - -# The configuration defaults file modifies the generic defaults in the configuration -# definition file. Note that the -defaults option has precedence over all other options. -my $config_defaults_file; -my $std_config_defaults_file = "$cfgdir/config_files/config_defaults.xml"; -if ($opts{'defaults'}) { - $config_defaults_file = $opts{'defaults'}; -} else { - $config_defaults_file = "$std_config_defaults_file"; -} -(-f "$config_defaults_file") or die <<"EOF"; -** Cannot find configuration defaults file \"$config_defaults_file\" ** -EOF - -if ($print>=2) { print "Setting CLM configuration script directory to $cfgdir$eol"; } -if ($print>=2) { print "Using configuration defaults file $config_defaults_file$eol"; } - -# Initialize the configuration. The $config_def_file provides the definition of a CLM -# configuration, and the $config_defaults_file provides default values for a specific CLM -# configuration. $cfg_ref is a reference to the new configuration object. -my $cfg_ref = Build::Config->new("$cfgdir/config_files/$config_def_file", - "$config_defaults_file"); - -#----------------------------------------------------------------------------------------------- -# CLM root directory. -my $clm_root; - -if ( ! defined($opts{'clm_root'} ) ) { - $clm_root = abs_path("$cfgdir/.."); -} else { - $clm_root = $opts{'clm_root'}; -} - -if ( &is_valid_directory( "$clm_root/src", allowEnv=>0 ) ) { - $cfg_ref->set('clm_root', $clm_root); -} else { - die <<"EOF"; -** Invalid CLM root directory: $clm_root -** -** The CLM root directory must contain the subdirectory /src/. -** clm_root can be entered on the command line or it will be derived -** from the location of this script. -EOF -} - -if ($print>=2) { print "Setting CLM root directory to $clm_root$eol"; } - -#----------------------------------------------------------------------------------------------- -# CLM build directory is current directory -my $clm_bld = `pwd`; -chomp( $clm_bld ); - -# Make sure directory is valid -if ( ! &is_valid_directory( $clm_bld ) and ! mkdirp($clm_bld)) { - die <<"EOF"; -** Could not create the specified CLM build directory: $clm_bld -EOF -} - -if ($print>=2) { print "Setting CLM build directory to $clm_bld$eol"; } - -#----------------------------------------------------------------------------------------------- -# User source directories. -my $usr_src = ''; -if (defined $opts{'usr_src'}) { - my @dirs = split ',', $opts{'usr_src'}; - my @adirs; - while ( my $dir = shift @dirs ) { - if (&is_valid_directory( "$dir", allowEnv=>0 ) ) { - push @adirs, $dir; - } else { - die "** User source directory does not exist: $dir\n"; - } - } - $usr_src = join ',', @adirs; - $cfg_ref->set('usr_src', $usr_src); -} - -if ($print>=2) { print "Setting user source directories to $usr_src$eol"; } - -#----------------------------------------------------------------------------------------------- -# configuration cache directory and file. -my $config_cache_dir; -my $config_cache_file; -if (defined $opts{'cachedir'}) { - $config_cache_dir = abs_path($opts{'cachedir'}); -} -else { - $config_cache_dir = $clm_bld; -} - -if (&is_valid_directory( $config_cache_dir, allowEnv=>0 ) or mkdirp($config_cache_dir)) { - $config_cache_file = "$config_cache_dir/$opts{'cache'}"; -} else { - die <<"EOF"; -** Could not create the specified directory for configuration cache file: $config_cache_dir -EOF -} - -if ($print>=2) { print "The configuration cache file will be created in $config_cache_file$eol"; } - - -#----------------------------------------------------------------------------------------------- -# physics - -$cfg_ref->set('phys', $opts{'phys'}); -my $phys_string = $phys->as_string(); -if ($print>=2) { - if( defined($opts{'phys'}) ) { - print "Using version $phys_string physics.$eol"; - } -} - -#----------------------------------------------------------------------------------------------- -# comp_intf option -if (defined $opts{'comp_intf'}) { - $cfg_ref->set('comp_intf', $opts{'comp_intf'}); -} -my $comp_intf = $cfg_ref->get('comp_intf'); -if ($print>=2) { print "Using $comp_intf for comp_intf.$eol"; } - - -#----------------------------------------------------------------------------------------------- -# Makefile configuration ####################################################################### -#----------------------------------------------------------------------------------------------- - -#----------------------------------------------------------------------------------------------- -# Name of CLM executable. -my $clm_exe = "clm"; - -if ($print>=2) { print "Name of CLM executable: $clm_exe.$eol"; } - -#----------------------------------------------------------------------------------------------- -# For the CPP tokens, start with the defaults (from defaults file) and append the specifications -# from the commandline. That way the user can override defaults since the commandline versions -# occur last. -my $usr_cppdefs = $cfg_ref->get('cppdefs'); -if (defined $opts{'cppdefs'}) { - $usr_cppdefs .= " $opts{'cppdefs'}"; - print "Warning:: running with user defined cppdefs is NOT validated / " . - "scientifically supported.$eol"; -} -$cfg_ref->set('cppdefs', $usr_cppdefs); - -if ($usr_cppdefs and $print>=2) { print "Default and user CPP definitions: \'$usr_cppdefs\'$eol";} - -# The following CPP macro definitions are used to implement the compile-time options. They are -# determined by the configuration parameters that have been set above. They will be appended to -# the CPP definitions that were explicitly set in the defaults file or by the user on the commandline. -my $cfg_cppdefs = ''; -if ($phys->as_long() >= $phys->as_long("clm4_5") ) { - # clm4_5 cppdefs -- SHOULD NOT BE ANY! - if ( $cfg_cppdefs ne '' ) { - die <<"EOF"; -** CPP definitions should be empty for clm5_0 and is NOT ** -EOF - } -} elsif ($phys->as_long() == $phys->as_long("clm5_0") ) { - # clm5_0 cppdefs -- SHOULD NOT BE ANY! - if ( $cfg_cppdefs ne '' ) { - die <<"EOF"; -** CPP definitions should be empty for clm5_0 and is NOT ** -EOF - } -} else { - # this should NOT happen - die <<"EOF"; -** Bad CLM physics version ** -EOF -} -# CPP defines to put on Makefile -my $make_cppdefs = "$usr_cppdefs $cfg_cppdefs"; - -if ($print>=2) { print "CPP definitions set by configure: \'$cfg_cppdefs\'$eol"; } - -#----------------------------------------------------------------------------------------------- -# Write configuration files #################################################################### -#----------------------------------------------------------------------------------------------- - -my $fp_filename = 'Filepath'; # name of output filepath file -my $cpp_filename = 'CESM_cppdefs'; # name of output file for clm's cppdefs in cesm - -# Write the filepath file for cesm. -write_filepath_cesmbld("$clm_bld/$fp_filename", $cfg_ref, $phys, allowEnv=>0 ); -if ($print>=2) { print "creating $clm_bld/$fp_filename\n"; } - -# Write the file for clm's cppdefs needed in cesm. -write_cppdefs("$clm_bld/$cpp_filename", $make_cppdefs); -if ($print>=2) { print "creating $clm_bld/$cpp_filename\n"; } - -# Write the configuration file. -$cfg_ref->write_file($config_cache_file, $commandline); -if ($print>=2) { print "creating $config_cache_file\n"; } - -#----------------------------------------------------------------------------------------------- -# Done -chdir( $cwd ) || die <<"EOF"; -** Trouble changing directory back to $cwd -** -EOF -if ($print) { print "CLM configure done.\n"; } -exit; - -#----------------------------------------------------------------------------------------------- -# FINISHED #################################################################################### -#----------------------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- - -sub write_filepath_cesmbld -{ - my ($file, $cfg_ref, $phys, %opts) = @_; - my $fh = new IO::File; - - $fh->open(">$file") or die "** can't open filepath file: $file\n"; - - # configuration parameters used to determine paths - my $usr_src = $cfg_ref->get('usr_src'); - my $clm_root = $cfg_ref->get('clm_root'); - - # User specified source directories. - if ($usr_src =~ /\S+/) { - my @dirs = split ',', $usr_src; - while ( my $dir = shift @dirs ) { - print $fh "$dir\n"; - } - } else { - print $fh "../SourceMods/src.clm\n"; - } - - if ($phys->as_long() == $phys->as_long("clm4_0") ) { - # source root - my $srcdir = "$clm_root/src_clm40"; - if ( ! &is_valid_directory( "$srcdir", %opts ) ) { die "** source directory does not exist: $srcdir\n"; } - - # source directories under root - my @dirs = ( "main", "biogeophys", "biogeochem" ); - foreach my $dir ( @dirs ) { - if ( &is_valid_directory( "$srcdir/$dir", %opts ) ) { - print $fh "$srcdir/$dir\n"; - } else { - die "** source directory does not exist: $srcdir/$dir\n"; - } - } - } else { - # source root - my $srcdir = "$clm_root/src"; - if ( ! &is_valid_directory( "$srcdir", %opts ) ) { die "** source directory does not exist: $srcdir\n"; } - - # source directories under root - my @dirs = ( "main", - "biogeophys", - "biogeochem", - "soilbiogeochem", - "init_interp", - "utils", - "cpl" ); - - foreach my $dir ( @dirs ) { - if ( &is_valid_directory( "$srcdir/$dir", %opts ) ) { - print $fh "$srcdir/$dir\n"; - } else { - die "** source directory does not exist: $srcdir/$dir\n"; - } - } - } - - - $fh->close; -} -#------------------------------------------------------------------------------- - -sub write_cppdefs -{ - my ($file, $make_cppdefs) = @_; - my $fh = new IO::File; - - $fh->open(">$file") or die "** can't open cpp defs file: $file\n"; - - print $fh "$make_cppdefs\n"; - $fh->close; -} - -#------------------------------------------------------------------------------- - -sub mkdirp { - my ($dir) = @_; - my (@dirs) = split /\//, $dir; - my (@subdirs, $path); - - # if $dir is absolute pathname then @dirs will start with "" - if ($dirs[0] eq "") { push @subdirs, shift @dirs; } - - while ( @dirs ) { # check that each subdir exists and mkdir if it doesn't - push @subdirs, shift @dirs; - $path = join '/', @subdirs; - unless (-d $path or mkdir($path, 0777)) { return 0; } - } - return 1; -} - -#------------------------------------------------------------------------------- - -sub version { -# The version is found in CLM's ChangeLog file. -# $cfgdir is set by the configure script to the name of its directory. - - my ($cfgdir) = @_; - - my $logfile = "$cfgdir/../doc/ChangeLog"; - - my $fh = IO::File->new($logfile, '<') or die "** can't open ChangeLog file: $logfile\n"; - - while (my $line = <$fh>) { - - if ($line =~ /^Tag name:\s*[clm0-9_.-]*\s*[toin]*\s*([cesmclm0-9_.-]+)$/ ) { - print "$1\n"; - exit; - } - } - -} - -#------------------------------------------------------------------------------- - -sub is_valid_directory { -# -# Validate that the input is a valid existing directory. -# - my ($dir, %opts) = @_; - my $nm = "is_valid_directory"; - - my $valid = 0; - if ( -d $dir ) { $valid = 1; } - return( $valid ); - -} - diff --git a/bld/env_run.xml b/bld/env_run.xml deleted file mode 100644 index 8bf59d09..00000000 --- a/bld/env_run.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - diff --git a/bld/namelist_files/LogMessages.pm b/bld/namelist_files/LogMessages.pm deleted file mode 100755 index 77f0569b..00000000 --- a/bld/namelist_files/LogMessages.pm +++ /dev/null @@ -1,244 +0,0 @@ -package namelist_files::LogMessages; -my $pkg_nm = 'namelist_files::LogMessages'; -#----------------------------------------------------------------------------------------------- -# -# SYNOPSIS -# -# require namelist_files::LogMessages; -# -# my %opts; -# my $log = namelist_files::LogMessages->new("ProgName", \%opts); -# $log->message("message to print"); -# $log->verbose_message("message to print only if verbose mode is on"); -# $log->warning("Warning message"); -# $log->exit_message("clean exit"); -# $log->fatal_error("die with fatal error"); -# $log->final_exit("Final message to send (and exit"); -# -# -# DESCRIPTION -# -# Handles log messages for perl. Sets up log messages according to verbose -# or silent setting. It also handles warnings printing them, but on finalization -# aborting unless ignore_warnings was set. -# -# COLLABORATORS: None -# -#----------------------------------------------------------------------------------------------- -# -# Date Author Modification -# 10/06/2017 Erik Kluzek creation -# -#-------------------------------------------------------------------------------------------- - -use strict; -#use warnings; -#use diagnostics; - -#------------------------------------------------------------------------------- - -sub new { - my $class = shift; - my $ProgName = shift; - my %opts = %{shift()}; - - my $nm = "$class\:\:new"; - my $self = {}; - bless($self, $class); - $self->{'nwarns'} = 0; - $self->{'verbosity'} = 1; - $self->{'NO_EXIT'} = $opts{'NO_EXIT'}; - $self->{'ProgName'} = $ProgName; - $self->{'ignore_warnings'} = $opts{'ignore_warnings'}; - $self->__set_print_level( \%opts ); - return( $self ); -} - - -#------------------------------------------------------------------------------- - -sub __set_print_level { - my $self = shift; - # Define print levels: - # 0 - only issue fatal error messages - # 1 - only informs what files are created (default) - # 2 - verbose - my %opts = %{shift()}; - - if ( $opts{'silent'} && $opts{'verbose'} ) { - $self->fatal_error( "Can not set both the -silent and the -verbose options -- set one or the other" ); - } - my $verbosity = 1; - if ($opts{'silent'}) { $verbosity = 0; } - if ($opts{'verbose'}) { $verbosity = 2; } - $self->{'verbosity'} = $verbosity; - $self->{'print_verbose'} = 2; -} - -#------------------------------------------------------------------------------- - -sub message { - my $self = shift; - my ($message) = @_; - if ($self->{'verbosity'} > 0) { - print "$message\n"; - } -} - -#------------------------------------------------------------------------------- - -sub verbose_message { - my $self = shift; - - my ($message) = @_; - if ($self->{'verbosity'} >= $self->{'print_verbose'}) { - print "$message\n"; - } -} -#------------------------------------------------------------------------------- - -sub nwarns { - my $self = shift; - - return( $self->{'nwarns'} ); -} - -#------------------------------------------------------------------------------- - -sub final_exit { - my $self = shift; - my ($message) = @_; - if ( $self->{'nwarns'} > 0 ) { - $self->message( "\n\nYou ran with the -ignore_warnings options and allowed $self->{'nwarns'} to go past\n" ); - } - $self->verbose_message( $message ); - if ( $self->{'NO_EXIT'} ) { - die - } else { - exit; - } -} - -#------------------------------------------------------------------------------- -# Some simple subroutines to do a clean exit, print warning, or a fatal error - -sub exit_message { - my $self = shift; - my ($message) = @_; - print "$self->{ProgName} : $message\n"; - if ( $self->{'NO_EXIT'} ) { - die - } else { - exit; - } -} - -#------------------------------------------------------------------------------- - -sub warning { - my $self = shift; - my $message = shift; - - $self->{'nwarns'} = $self->{'nwarns'} + 1; - my $func_name = (caller(1))[3]; - if ( $self->{'ignore_warnings'} ) { - print "Warning : $self->{ProgName}::${func_name}() : $message\n\n"; - } else { - die "Warning : $self->{ProgName}::${func_name}() : $message\n" . - " -- Add -ignore_warnings option to CLM_BLDNML_OPTS to ignore this warning\n\n"; - } -} - -#------------------------------------------------------------------------------- - -sub fatal_error { - my $self = shift; - my ($message) = @_; - my $func_name = (caller(1))[3]; - die "ERROR : $self->{ProgName}::${func_name}() : $message\n"; -} - -#------------------------------------------------------------------------------- - -#----------------------------------------------------------------------------------------------- -# Unit testing of above -#----------------------------------------------------------------------------------------------- -if ( ! defined(caller) && $#ARGV == -1 ) { - package LogMessage_unit_tester; - - require Test::More; - Test::More->import( ); - - plan( tests=>11 ); - - sub testit { - print "unit tester\n"; - my %opts; - my $message; - - # Standard verbose level, test all methods - $opts{'NO_EXIT'} = 1; - my $log = namelist_files::LogMessages->new("ProgName", \%opts); - isa_ok($log, "namelist_files::LogMessages", "Created LogMessages object"); - $log->message("message to print"); - $log->verbose_message("YOU SHOULD NOT SEE THIS MESSAGE BECAUSE IT IS VERBOSE AND VERBOSE NOT ON"); - $message = "Warning message"; - is ( $log->nwarns(), 0, "Make sure have zero warnings" ); - eval{ $log->warning($message); }; - like( $@, qr/$message/, "check that a warning dies without ignore_warnings option" ); - is ( $log->nwarns(), 1, "Make sure have one warning" ); - $message = "die with fatal error"; - eval{ $log->fatal_error($message); }; - like( $@, qr/$message/, "check that a fatal_error dies" ); - $message = "exit with exit message"; - eval{ $log->exit_message($message); }; - like( $@, qr/Died/, "check that a exit_message exits" ); - $message = "Final message to send"; - eval{ $log->final_exit($message); }; - like( $@, qr/Died/, "check that a final exits" ); - - # Test ignore_warnings option and verbose mode - $opts{'ignore_warnings'} = 1; - $opts{'verbose'} = 1; - $opts{'NO_EXIT'} = 1; - $log = namelist_files::LogMessages->new("ProgName", \%opts); - isa_ok($log, "namelist_files::LogMessages", "Created LogMessages object"); - $log->verbose_message("message to print only if verbose mode is on"); - $log->warning("Warning message"); - $log->warning("Warning message2"); - $log->warning("Warning message3"); - $log->warning("Warning message4"); - $log->warning("Warning message5"); - is ( $log->nwarns(), 5, "Make sure have five warnings" ); - eval{ $log->final_exit($message); }; - print "content: $@\n"; - like( $@, qr/Died/, "check that a final_exit with warning exits" ); - # silent mode - $opts{'ignore_warnings'} = 0; - $opts{'verbose'} = 0; - $opts{'silent'} = 1; - $opts{'NO_EXIT'} = 1; - $log = namelist_files::LogMessages->new("ProgName", \%opts); - $log->message("YOU SHOULD NOT SEE THIS MESSAGE BECAUSE SILENT MODE IS ON"); - $log->verbose_message("YOU SHOULD NOT SEE THIS VERBOSE MESSAGE BECAUSE SILENT MODE IS ON"); - # Should die with error if both silent and verbose mode is on - $opts{'ignore_warnings'} = 0; - $opts{'verbose'} = 1; - $opts{'silent'} = 1; - $opts{'NO_EXIT'} = 1; - eval{ $log = namelist_files::LogMessages->new("ProgName", \%opts); }; - print "content: $@\n"; - like( $@, qr/ERROR : /, "check that died if both verbose and silent mode is on" ); - print "\nSuccessfully ran all tests\n"; - } -} - -#----------------------------------------------------------------------------------------------- -# Determine if you should run the unit test or if this is being called from a require statement -#----------------------------------------------------------------------------------------------- - -if ( defined(caller) ) { - 1 # to make use or require happy -} elsif ( $#ARGV == -1 ) { - &LogMessage_unit_tester::testit(); -} diff --git a/bld/namelist_files/namelist_defaults.xsl b/bld/namelist_files/namelist_defaults.xsl deleted file mode 100644 index 96cb2b6e..00000000 --- a/bld/namelist_files/namelist_defaults.xsl +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - CLM Namelist Defaults - - -

Default Values for Namelist Variables

-

Included in the table are the following pieces of information:

-

Table headers include:

-
    -
  • Name of variable
  • -
  • Horizontal grid resolution
  • -
  • Land ocean mask type
  • -
  • Simulation year
  • -
  • Simulation year range (for transient datasets)
  • -
-

Miscellaneous items include:

-
    -
  1. Biogeochemistry (BGC) type (none, CN, CNDV)
  2. -
  3. Initial condition date (ymd - year month day)
  4. -
  5. Initial condition time of day (tod) (sec)
  6. -
  7. Maximum number of Plant Function Types (maxpft)
  8. -
  9. Number of glacier multiple elevation classes (glc_nec)
  10. -
  11. Site specific point name (sitespf_pt)
  12. -
  13. Crop model (crop)
  14. -
  15. Data model forcing source (forcing)
  16. -
  17. Representative concentration pathway for future scenarios (rcp)
  18. -
  19. New good wood harvest (newwoodharv)
  20. -
  21. CN Spin-up mode (spinup)
  22. -
  23. Type of file (type)
  24. -
  25. Grid mapping to (to_hgrid)
  26. -
  27. Land-mask mapping to (to_lmask)
  28. -
  29. High resolution file? (hires)
  30. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Namelist Defaults
NameHorz. GridMaskSim yearSim year rangeMiscellaneous
Default Value for this Configuration
- - - - - - - - - - - All res - - - - - - - - - - - - - - - MODIS - - - All masks - - - - - - - - - All yrs - - - - - - - - - All sim-yr-rng - - - - - bgc= - - - ymd= - - - tod= - - - maxpft= - - - glc_nec= - - - sitespf_pt= - - - datm_presaero= - - - crop= - - - irrig= - - - spinup= - - - forcing= - - - rcp= - - - newwoodharv= - - - type= - - - to_hgrid= - - - to_lmask= - - - hires= - -
Value:
- - - - -
- -
diff --git a/bld/namelist_files/namelist_defaults_clm4_5.xml b/bld/namelist_files/namelist_defaults_clm4_5.xml deleted file mode 100644 index 6d7e927c..00000000 --- a/bld/namelist_files/namelist_defaults_clm4_5.xml +++ /dev/null @@ -1,2125 +0,0 @@ - - - - - - - - - - -0.9x1.25 - -2000 - - -1800 - - -379.0 -379.0 -284.7 - - -constant - - -sp - - -0.50,0.30 -0.60,0.40 - - -ON_WASTEHEAT -ON - -1 -0 - - -.false. - - -.true. -.false. - -20SL_8.5m -10SL_3.5m - -.false. -.false. -.true. -.false. - - - -1 -0 - -1 -1 - - -1 -0 - - -.true. -.false. - -.true. - - -0.006 - - -0.032 - -0.5 - -0. -2. - -0. -2. - --2. -0. - - -.false. -.true. - - -.true. -1.0 -0.05 - -.false. -0.25 -1.0 - - -0 -1 - -1 -1 - -4 -2 -2 -3 - -60. -1.e-8 -1.e-1 -1.e-2 -42 -1 -1 - - -0.0 -21600 -14400 --3400. -0.6 -1.0 -0.5 -0.1 - - -.false. -.false. - - -OFF -ON_RAD - - -12 -5 -10000.0 -1000.0 - -2000. - -1.e30 - -10.0d00 -10.0 - -.true. -.false. - -'Vionnet2012' -'Anderson1976' - -'Slater2017' -'TruncatedAnderson1976' - -100.d00 -175.d00 - -54.526d00 -204.526d00 - -0.08d00 - -.false. -.false. - -1.e9 - - -'single_at_atm_topo','virtual','virtual','multiple' - - -'remains_in_place','replaced_by_ice','replaced_by_ice','replaced_by_ice' - - -'melted','melted','remains_ice','remains_ice' - - -0 -7300 - - - - -lnd/clm2/paramdata/clm5_params.c171117.nc -lnd/clm2/paramdata/clm_params.c170913.nc - - - - - -lnd/clm2/paramdata/fates_params_2troppftclones.c171018.nc - - - - -.true. -.false. -.false. - - -.true. -.false. -.false. - - -.true. -.false. -3 -.true. -.true. -.true. -.true. -.false. -3 -1 -1 -1 -1 -0 - - - - - - -.true. -.false. - -.false. -.true. -.true. - -0.093563 - -.false. -.false. -.true. - -3.d00 -1.d00 - - - -0.5 -10.0 - - -.false. -.true. - - -.false. -.false. -.false. -.false. -.false. - - -.false. -.false. -.true. - - -.false. -.false. -.true. - - - -75 - - -1850,2000 - - -.true. -.true. -.false. - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.false. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=17 mask=gx1v6 use_cn=.false. use_nitrif_denitrif=.false. use_vertsoilc=.false. use_crop=.false. irrigate=.true. glc_nec=10 - - -hgrid=0.9x1.25 maxpft=79 mask=gx1v7 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.false. glc_nec=10 - - -hgrid=1.9x2.5 maxpft=79 mask=gx1v6 use_cn=.true. use_nitrif_denitrif=.true. use_vertsoilc=.true. use_crop=.true. irrigate=.true. glc_nec=10 - - - - - - -lnd/slim/surdat/mml_1.9x2.5_default_cdf5_c20211105.nc - - - - -lnd/clm2/initdata_map/clmi.I1850Clm45BgcGs.0901-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm45BgcCruGs.1101-01-01.0.9x1.25_gx1v6_simyr1850_c180204.nc - - -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50Sp.0181-01-01.0.9x1.25_gx1v6_simyr1850_c171214.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCrop.1366-01-01.0.9x1.25_gx1v6_simyr1850_c171213.nc - - - -lnd/clm2/initdata_map/clmi.I1850Clm50BgcCropCru.1526-01-01.0.9x1.25_gx1v6_simyr1850_c180109.nc - - - -lnd/clm2/initdata_map/clmi.B1850.0161-01-01.0.9x1.25_gx1v7_simyr1850_c180130.nc - - -lnd/clm2/initdata_map/clmi.I1850Clm50SpCru.1706-01-01.0.9x1.25_gx1v6_simyr1850_c180110.nc - - - - - - -lnd/clm2/initdata_map/clmi.IGM2000GSWP3CLM50BGCCROPIRR.2011-01-01.1.9x2.5_gx1v6_gl5_simyr2000_c170419.nc - - - -lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0121-01-01.4x5_mgx3v7_simyr2000_c180122.nc - - -lnd/clm2/initdata_map/clmi.I2000Clm45Fates.0101-01-01.1x1_brazil_simyr2000_c180120.nc - - - - - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr2000_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_5x5_amazon_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_64x128_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr2000_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_0.125x0.125_mp24_simyr2000_c150114.nc - -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr2000_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr2000_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne16np4_78pfts_CMIP6_simyr2000_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_1x1_camdenNJ_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_vancouverCAN_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_mexicocityMEX_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_urbanc_alpha_16pfts_Irrig_CMIP6_simyr2000_c171214.nc - - - -lnd/clm2/surfdata_map/surfdata_360x720cru_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_16pfts_Irrig_CMIP6_simyr1850_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_16pfts_Irrig_CMIP6_simyr1850_c171214.nc - - - -lnd/clm2/surfdata_map/surfdata_ne120np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne30np4_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - - - -lnd/clm2/surfdata_map/surfdata_360x720cru_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_48x96_78pfts_CMIP6_simyr1850_c170824.nc - - -lnd/clm2/surfdata_map/surfdata_0.47x0.63_78pfts_CMIP6_simyr1850_c170919.nc - -lnd/clm2/surfdata_map/surfdata_0.9x1.25_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1.9x2.5_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_10x15_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_4x5_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_1x1_smallvilleIA_78pfts_CMIP6_simyr1850_c171214.nc - -lnd/clm2/surfdata_map/surfdata_1x1_numaIA_78pfts_CMIP6_simyr1850_c170917.nc - - -lnd/clm2/surfdata_map/surfdata_1x1_brazil_78pfts_CMIP6_simyr1850_c171214.nc - - -lnd/clm2/surfdata_map/surfdata_ne30np4_78pfts_CMIP6_simyr1850_c170824.nc - -lnd/clm2/surfdata_map/surfdata_ne120np4_78pfts_CMIP6_simyr1850_c170824.nc - - - - - -lnd/clm2/surfdata_map/landuse.timeseries_0.47x0.63_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c171025.nc -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - - - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1x1_numaIA_hist_78pfts_CMIP6_simyr1850-2015_c170917.nc - -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_simyr1850-1855_c160127.nc - - - - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_16pfts_Irrig_CMIP6_simyr1850-2015_c170824.nc - - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_1x1_brazil_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne120np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - -lnd/clm2/surfdata_map/landuse.timeseries_360x720cru_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_0.9x1.25_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_1.9x2.5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_10x15_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_4x5_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_48x96_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc -lnd/clm2/surfdata_map/landuse.timeseries_ne30np4_hist_78pfts_CMIP6_simyr1850-2015_c170824.nc - - -.true. -.false. - - -0.015d00 -0.015d00 - - -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 -20.0d00, 20.0d00, 20.0d00 -200.0d00, 200.0d00, 200.0d00 - -1.50d00 -0.3 -1.50d00 -0.3 - -100.d00 -20.d00 -1.d00 -1.d00 - - - -lnd/clm2/snicardata/snicar_optics_5bnd_c090915.nc -lnd/clm2/snicardata/snicar_drdt_bst_fit_60_c070416.nc - - -.false. -2001 -2013 -2001 - -lnd/clm2/lai_streams/MODISPFTLAI_0.5x0.5_c140711.nc - -bilinear - -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn -nn - - -.true. -.false. - - - - - - -35 - - - - - - - - -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.1x0.1_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_AVHRR_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.25x0.25_MODIS_to_0.1x0.1_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.5x0.5_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_10x10min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_3x3min_MODIS-wCsp_to_0.1x0.1_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_IGBP-GSDP_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ISRIC-WISE_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_ORNL-Soil_to_0.1x0.1_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_5x5min_nomask_to_0.1x0.1_nomask_aave_da_c120406.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne120np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_4x5_nomask_to_0.1x0.1_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1.9x2.5_nomask_to_0.1x0.1_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_ne240np4_nomask_to_0.1x0.1_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_0.9x1.25_GRDC_to_0.1x0.1_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_360x720_cruncep_to_0.1x0.1_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.1x0.1/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.1x0.1_nomask_aave_da_c130405.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_AVHRR_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.25x0.25_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.5x0.5_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_10x10min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_MODIS-wCsp_to_1x1_asphaltjungleNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_USGS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_LandScan2004_to_1x1_asphaltjungleNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_IGBP-GSDP_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ISRIC-WISE_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_ORNL-Soil_to_1x1_asphaltjungleNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_5x5min_nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_asphaltjungleNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_0.9x1.25_GRDC_to_1x1_asphaltjungleNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_360x720_cruncep_to_1x1_asphaltjungleNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_asphaltjungleNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_asphaltjungleNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_AVHRR_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.25x0.25_MODIS_to_1x1_brazil_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.5x0.5_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_10x10min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_MODIS-wCsp_to_1x1_brazil_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_USGS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_LandScan2004_to_1x1_brazil_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_IGBP-GSDP_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ISRIC-WISE_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_ORNL-Soil_to_1x1_brazil_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_5x5min_nomask_to_1x1_brazil_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_brazil_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_0.9x1.25_GRDC_to_1x1_brazil_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_360x720_cruncep_to_1x1_brazil_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_brazil/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_brazil_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_AVHRR_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.25x0.25_MODIS_to_1x1_camdenNJ_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.5x0.5_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_10x10min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_MODIS-wCsp_to_1x1_camdenNJ_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_USGS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_LandScan2004_to_1x1_camdenNJ_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_IGBP-GSDP_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ISRIC-WISE_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_ORNL-Soil_to_1x1_camdenNJ_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_5x5min_nomask_to_1x1_camdenNJ_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_camdenNJ_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_0.9x1.25_GRDC_to_1x1_camdenNJ_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_360x720_cruncep_to_1x1_camdenNJ_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_camdenNJ/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_camdenNJ_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_AVHRR_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.25x0.25_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.5x0.5_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_10x10min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_MODIS-wCsp_to_1x1_mexicocityMEX_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_USGS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_LandScan2004_to_1x1_mexicocityMEX_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_IGBP-GSDP_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ISRIC-WISE_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_ORNL-Soil_to_1x1_mexicocityMEX_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_5x5min_nomask_to_1x1_mexicocityMEX_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_mexicocityMEX_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_0.9x1.25_GRDC_to_1x1_mexicocityMEX_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_360x720_cruncep_to_1x1_mexicocityMEX_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_mexicocityMEX/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_mexicocityMEX_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_AVHRR_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.25x0.25_MODIS_to_1x1_numaIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.5x0.5_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_10x10min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_MODIS-wCsp_to_1x1_numaIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_USGS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_LandScan2004_to_1x1_numaIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_IGBP-GSDP_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ISRIC-WISE_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_ORNL-Soil_to_1x1_numaIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_5x5min_nomask_to_1x1_numaIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_numaIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_0.9x1.25_GRDC_to_1x1_numaIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_360x720_cruncep_to_1x1_numaIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_numaIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_numaIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_AVHRR_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.25x0.25_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.5x0.5_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_10x10min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_MODIS-wCsp_to_1x1_smallvilleIA_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_USGS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_LandScan2004_to_1x1_smallvilleIA_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_IGBP-GSDP_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ISRIC-WISE_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_ORNL-Soil_to_1x1_smallvilleIA_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_5x5min_nomask_to_1x1_smallvilleIA_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_smallvilleIA_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_0.9x1.25_GRDC_to_1x1_smallvilleIA_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_360x720_cruncep_to_1x1_smallvilleIA_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_smallvilleIA/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_smallvilleIA_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_AVHRR_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.25x0.25_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.5x0.5_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_10x10min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_MODIS-wCsp_to_1x1_urbanc_alpha_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_USGS_to_1x1_urbanc_alpha_nomask_aave_da_c120928.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_LandScan2004_to_1x1_urbanc_alpha_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_IGBP-GSDP_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ISRIC-WISE_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_ORNL-Soil_to_1x1_urbanc_alpha_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_5x5min_nomask_to_1x1_urbanc_alpha_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_urbanc_alpha_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_0.9x1.25_GRDC_to_1x1_urbanc_alpha_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_360x720_cruncep_to_1x1_urbanc_alpha_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_urbanc_alpha/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_urbanc_alpha_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_AVHRR_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.25x0.25_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.5x0.5_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_10x10min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_MODIS-wCsp_to_1x1_vancouverCAN_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_USGS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_LandScan2004_to_1x1_vancouverCAN_nomask_aave_da_c121114.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_IGBP-GSDP_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ISRIC-WISE_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_ORNL-Soil_to_1x1_vancouverCAN_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_5x5min_nomask_to_1x1_vancouverCAN_nomask_aave_da_c120717.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_3x3min_GLOBE-Gardner-mergeGIS_to_1x1_vancouverCAN_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_0.9x1.25_GRDC_to_1x1_vancouverCAN_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_360x720_cruncep_to_1x1_vancouverCAN_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1x1_vancouverCAN/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1x1_vancouverCAN_nomask_aave_da_c130403.nc - - - - - -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.25x0.25_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_AVHRR_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.5x0.5_MODIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_0.9x1.25_GRDC_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_IGBPmergeICESatGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_10x10min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_360x720cru_cruncep_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_GLOBE-Gardner_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_LandScan2004_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_MODIS-wCsp_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_3x3min_USGS_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_IGBP-GSDP_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ISRIC-WISE_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_nomask_to_0.47x0.63_nomask_aave_da_c170914.nc -lnd/clm2/mappingdata/maps/0.47x0.63/map_5x5min_ORNL-Soil_to_0.47x0.63_nomask_aave_da_c170914.nc - - - - -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_landuse_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.25x0.25_MODIS_to_0.9x1.25_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.5x0.5_lanwat_to_0.9x1.25_aave_da_110307.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_10minx10min_topo_to_0.9x1.25_aave_da_110630.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_soitex_to_0.9x1.25_aave_da_110722.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5minx5min_irrig_to_0.9x1.25_aave_da_110529.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ISRIC-WISE_to_0.9x1.25_nomask_aave_da_c120525.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_5x5min_ORNL-Soil_to_0.9x1.25_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS_to_0.9x1.25_nomask_aave_da_c120523.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_MODIS-wCsp_to_0.9x1.25_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_USGS_to_0.9x1.25_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_LandScan2004_to_0.9x1.25_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.9x1.25_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_0.9x1.25_GRDC_to_0.9x1.25_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_360x720_cruncep_to_0.9x1.25_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.9x1.25/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.9x1.25_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_landuse_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.25x0.25_MODIS_to_1.9x2.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.5x0.5_lanwat_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_10minx10min_topo_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5minx5min_soitex_to_1.9x2.5_aave_da_110307.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_nomask_to_1.9x2.5_nomask_aave_da_c120606.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ISRIC-WISE_to_1.9x2.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_5x5min_ORNL-Soil_to_1.9x2.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS_to_1.9x2.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_MODIS-wCsp_to_1.9x2.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_USGS_to_1.9x2.5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_LandScan2004_to_1.9x2.5_nomask_aave_da_c120522.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_1.9x2.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_0.9x1.25_GRDC_to_1.9x2.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_360x720_cruncep_to_1.9x2.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/1.9x2.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_1.9x2.5_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_landuse_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_0.25x0.25_MODIS_to_10x15_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/10x15/map_0.5x0.5_lanwat_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_10minx10min_topo_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5minx5min_soitex_to_10x15_aave_da_110307.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_nomask_to_10x15_nomask_aave_da_c120327.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ISRIC-WISE_to_10x15_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/10x15/map_5x5min_ORNL-Soil_to_10x15_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS_to_10x15_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_MODIS-wCsp_to_10x15_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_USGS_to_10x15_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_LandScan2004_to_10x15_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_3x3min_GLOBE-Gardner-mergeGIS_to_10x15_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/10x15/map_0.9x1.25_GRDC_to_10x15_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/10x15/map_360x720_cruncep_to_10x15_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/10x15/map_1km-merge-10min_HYDRO1K-merge-nomask_to_10x15_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_0.25x0.25_MODIS_to_360x720cru_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/360x720/map_0.5x0.5_AVHRR_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_10x10min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_IGBP-GSDP_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_nomask_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ISRIC-WISE_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_5x5min_ORNL-Soil_to_360x720cru_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS_to_360x720_nomask_aave_da_c120830.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_MODIS-wCsp_to_360x720cru_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_USGS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_LandScan2004_to_360x720_nomask_aave_da_c121017.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_3x3min_GLOBE-Gardner-mergeGIS_to_360x720_nomask_aave_da_c121128.nc -lnd/clm2/mappingdata/maps/360x720/map_0.9x1.25_GRDC_to_360x720_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/360x720/map_360x720_cruncep_to_360x720_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/360x720/map_1km-merge-10min_HYDRO1K-merge-nomask_to_360x720_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_MODIS_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.25x0.25_MODIS_to_512x1024_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.5x0.5_AVHRR_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_10x10min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_IGBP-GSDP_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_nomask_to_512x1024_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ISRIC-WISE_to_512x1024_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/512x1024/map_5x5min_ORNL-Soil_to_512x1024_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS_to_512x1024_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_MODIS-wCsp_to_512x1024_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_USGS_to_512x1024_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_LandScan2004_to_512x1024_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_3x3min_GLOBE-Gardner-mergeGIS_to_512x1024_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/512x1024/map_0.9x1.25_GRDC_to_512x1024_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/512x1024/map_360x720_cruncep_to_512x1024_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/512x1024/map_1km-merge-10min_HYDRO1K-merge-nomask_to_512x1024_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_MODIS_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_0.25x0.25_MODIS_to_128x256_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/128x256/map_0.5x0.5_AVHRR_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_10x10min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_IGBP-GSDP_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_nomask_to_128x256_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ISRIC-WISE_to_128x256_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/128x256/map_5x5min_ORNL-Soil_to_128x256_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS_to_128x256_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_MODIS-wCsp_to_128x256_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_USGS_to_128x256_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_LandScan2004_to_128x256_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_3x3min_GLOBE-Gardner-mergeGIS_to_128x256_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/128x256/map_0.9x1.25_GRDC_to_128x256_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/128x256/map_360x720_cruncep_to_128x256_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/128x256/map_1km-merge-10min_HYDRO1K-merge-nomask_to_128x256_nomask_aave_da_c130403.nc - - -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_MODIS_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_0.25x0.25_MODIS_to_64x128_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/64x128/map_0.5x0.5_AVHRR_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_10x10min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_IGBP-GSDP_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_nomask_to_64x128_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ISRIC-WISE_to_64x128_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/64x128/map_5x5min_ORNL-Soil_to_64x128_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS_to_64x128_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_MODIS-wCsp_to_64x128_nomask_aave_da_c160428.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_USGS_to_64x128_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_LandScan2004_to_64x128_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_3x3min_GLOBE-Gardner-mergeGIS_to_64x128_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/64x128/map_0.9x1.25_GRDC_to_64x128_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/64x128/map_360x720_cruncep_to_64x128_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/64x128/map_1km-merge-10min_HYDRO1K-merge-nomask_to_64x128_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_MODIS_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_0.25x0.25_MODIS_to_48x96_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/48x96/map_0.5x0.5_AVHRR_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_10x10min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_IGBP-GSDP_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_nomask_to_48x96_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ISRIC-WISE_to_48x96_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/48x96/map_5x5min_ORNL-Soil_to_48x96_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS_to_48x96_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_MODIS-wCsp_to_48x96_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_USGS_to_48x96_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_LandScan2004_to_48x96_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_3x3min_GLOBE-Gardner-mergeGIS_to_48x96_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/48x96/map_0.9x1.25_GRDC_to_48x96_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/48x96/map_360x720_cruncep_to_48x96_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/48x96/map_1km-merge-10min_HYDRO1K-merge-nomask_to_48x96_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_MODIS_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_0.25x0.25_MODIS_to_32x64_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/32x64/map_0.5x0.5_AVHRR_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_10x10min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_IGBP-GSDP_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_nomask_to_32x64_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ISRIC-WISE_to_32x64_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/32x64/map_5x5min_ORNL-Soil_to_32x64_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS_to_32x64_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_MODIS-wCsp_to_32x64_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_USGS_to_32x64_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_LandScan2004_to_32x64_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_3x3min_GLOBE-Gardner-mergeGIS_to_32x64_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/32x64/map_0.9x1.25_GRDC_to_32x64_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/32x64/map_360x720_cruncep_to_32x64_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/32x64/map_1km-merge-10min_HYDRO1K-merge-nomask_to_32x64_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_MODIS_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_0.25x0.25_MODIS_to_8x16_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/8x16/map_0.5x0.5_AVHRR_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_10x10min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_IGBP-GSDP_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_nomask_to_8x16_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ISRIC-WISE_to_8x16_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/8x16/map_5x5min_ORNL-Soil_to_8x16_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS_to_8x16_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_MODIS-wCsp_to_8x16_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_USGS_to_8x16_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_LandScan2004_to_8x16_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_3x3min_GLOBE-Gardner-mergeGIS_to_8x16_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/8x16/map_0.9x1.25_GRDC_to_8x16_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/8x16/map_360x720_cruncep_to_8x16_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/8x16/map_1km-merge-10min_HYDRO1K-merge-nomask_to_8x16_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_MODIS_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_0.25x0.25_MODIS_to_4x5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/4x5/map_0.5x0.5_AVHRR_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_10x10min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_IGBP-GSDP_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_nomask_to_4x5_nomask_aave_da_c110822.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ISRIC-WISE_to_4x5_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/4x5/map_5x5min_ORNL-Soil_to_4x5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS_to_4x5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_MODIS-wCsp_to_4x5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_USGS_to_4x5_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_LandScan2004_to_4x5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_3x3min_GLOBE-Gardner-mergeGIS_to_4x5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/4x5/map_0.9x1.25_GRDC_to_4x5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/4x5/map_360x720_cruncep_to_4x5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/4x5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_4x5_nomask_aave_da_c130411.nc - -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_MODIS_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.25x0.25_MODIS_to_0.23x0.31_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.5x0.5_AVHRR_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_10x10min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_IGBP-GSDP_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_nomask_to_0.23x0.31_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ISRIC-WISE_to_0.23x0.31_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_5x5min_ORNL-Soil_to_0.23x0.31_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS_to_0.23x0.31_nomask_aave_da_c110930.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_MODIS-wCsp_to_0.23x0.31_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_USGS_to_0.23x0.31_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.23x0.31_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_3x3min_LandScan2004_to_0.23x0.31_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_0.9x1.25_GRDC_to_0.23x0.31_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_360x720_cruncep_to_0.23x0.31_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.23x0.31/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.23x0.31_nomask_aave_da_c130405.nc - - -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_MODIS_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.25x0.25_MODIS_to_2.5x3.33_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.5x0.5_AVHRR_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_10x10min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_IGBP-GSDP_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_nomask_to_2.5x3.33_nomask_aave_da_c110823.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ISRIC-WISE_to_2.5x3.33_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_5x5min_ORNL-Soil_to_2.5x3.33_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS_to_2.5x3.33_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_MODIS-wCsp_to_2.5x3.33_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_USGS_to_2.5x3.33_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_LandScan2004_to_2.5x3.33_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_3x3min_GLOBE-Gardner-mergeGIS_to_2.5x3.33_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_0.9x1.25_GRDC_to_2.5x3.33_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_360x720_cruncep_to_2.5x3.33_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/2.5x3.33/map_1km-merge-10min_HYDRO1K-merge-nomask_to_2.5x3.33_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_AVHRR_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.25x0.25_MODIS_to_0.5x0.5_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_MODIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.5x0.5_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_IGBPmergeICESatGIS_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_10x10min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_IGBP-GSDP_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_nomask_to_0.5x0.5_nomask_aave_da_c111021.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS_to_0.5x0.5_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_MODIS-wCsp_to_0.5x0.5_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ISRIC-WISE_to_0.5x0.5_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_5x5min_ORNL-Soil_to_0.5x0.5_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_LandScan2004_to_0.5x0.5_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.5x0.5_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.1x0.1_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_4x5_nomask_to_0.5x0.5_nomask_aave_da_c120706.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1.9x2.5_nomask_to_0.5x0.5_nomask_aave_da_c120709.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_ne120np4_nomask_to_0.5x0.5_nomask_aave_da_c120711.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_3x3_USGS_nomask_to_0.5x0.5_nomask_aave_da_c120912.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_0.9x1.25_GRDC_to_0.5x0.5_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_360x720_cruncep_to_0.5x0.5_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/0.5x0.5/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.5x0.5_nomask_aave_da_c130405.nc - - - -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_MODIS_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.25x0.25_MODIS_to_ne4np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.5x0.5_AVHRR_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_10x10min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_IGBP-GSDP_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_nomask_to_ne4np4_nomask_aave_da_c110923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ISRIC-WISE_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_5x5min_ORNL-Soil_to_ne4np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS_to_ne4np4_nomask_aave_da_c120906.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_MODIS-wCsp_to_ne4np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_USGS_to_ne4np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner_to_ne4np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne4np4_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/ne4np4/map_3x3min_LandScan2004_to_ne4np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne4np4/map_0.9x1.25_GRDC_to_ne4np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne4np4/map_360x720_cruncep_to_ne4np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne4np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne4np4_nomask_aave_da_c130411.nc -lnd/clm2/mappingdata/maps/ne4np4/map_ne4np4_nomask_to_0.5x0.5_nomask_aave_da_c110923.nc - - -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_MODIS_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.25x0.25_MODIS_to_ne16np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.5x0.5_AVHRR_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_10x10min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_IGBP-GSDP_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_nomask_to_ne16np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ISRIC-WISE_to_ne16np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne16np4/map_5x5min_ORNL-Soil_to_ne16np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS_to_ne16np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_MODIS-wCsp_to_ne16np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_USGS_to_ne16np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_LandScan2004_to_ne16np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne16np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne16np4/map_0.9x1.25_GRDC_to_ne16np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne16np4/map_360x720_cruncep_to_ne16np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne16np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne16np4_nomask_aave_da_c130408.nc -lnd/clm2/mappingdata/maps/ne16np4/map_ne16np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_landuse_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.25x0.25_MODIS_to_ne30np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.5x0.5_lanwat_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_10minx10min_topo_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_soitex_to_ne30np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5minx5min_irrig_to_ne30np4_aave_da_110720.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ISRIC-WISE_to_ne30np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne30np4/map_5x5min_ORNL-Soil_to_ne30np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS_to_ne30np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_MODIS-wCsp_to_ne30np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_USGS_to_ne30np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_LandScan2004_to_ne30np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne30np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne30np4/map_0.9x1.25_GRDC_to_ne30np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne30np4/map_360x720_cruncep_to_ne30np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne30np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne30np4_nomask_aave_da_c130405.nc - -lnd/clm2/mappingdata/maps/ne30np4/map_ne30np4_to_0.5x0.5rtm_aave_da_110320.nc - -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_MODIS_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.25x0.25_MODIS_to_ne60np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.5x0.5_AVHRR_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_10x10min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_IGBP-GSDP_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_nomask_to_ne60np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ISRIC-WISE_to_ne60np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne60np4/map_5x5min_ORNL-Soil_to_ne60np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS_to_ne60np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_MODIS-wCsp_to_ne60np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_USGS_to_ne60np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_LandScan2004_to_ne60np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne60np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne60np4/map_0.9x1.25_GRDC_to_ne60np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne60np4/map_360x720_cruncep_to_ne60np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne60np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne60np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne60np4/map_ne60np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_landuse_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.25x0.25_MODIS_to_ne120np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.5x0.5_lanwat_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_10minx10min_topo_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_soitex_to_ne120np4_aave_da_110320.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ISRIC-WISE_to_ne120np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5x5min_ORNL-Soil_to_ne120np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne120np4/map_5minx5min_irrig_to_ne120np4_aave_da_110817.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS_to_ne120np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_MODIS-wCsp_to_ne120np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_LandScan2004_to_ne120np4_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne120np4_nomask_aave_da_c120924.nc -lnd/clm2/mappingdata/maps/ne120np4/map_3x3min_USGS_to_ne120np4_nomask_aave_da_c120913.nc -lnd/clm2/mappingdata/maps/ne120np4/map_0.9x1.25_GRDC_to_ne120np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne120np4/map_360x720_cruncep_to_ne120np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne120np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne120np4_nomask_aave_da_c130405.nc - - - - -lnd/clm2/mappingdata/maps/ne120np4/map_0.1x0.1_nomask_to_ne120np4_nomask_aave_da_c120706.nc - - - -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_MODIS_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.25x0.25_MODIS_to_5x5_amazon_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.5x0.5_AVHRR_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_10x10min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_IGBP-GSDP_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_nomask_to_5x5_amazon_nomask_aave_da_c110920.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ISRIC-WISE_to_5x5_amazon_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_5x5min_ORNL-Soil_to_5x5_amazon_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS_to_5x5_amazon_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_MODIS-wCsp_to_5x5_amazon_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_USGS_to_5x5_amazon_nomask_aave_da_c120927.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_LandScan2004_to_5x5_amazon_nomask_aave_da_c120518.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_3x3min_GLOBE-Gardner-mergeGIS_to_5x5_amazon_nomask_aave_da_c120923.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_0.9x1.25_GRDC_to_5x5_amazon_nomask_aave_da_c130309.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_360x720_cruncep_to_5x5_amazon_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/5x5_amazon/map_1km-merge-10min_HYDRO1K-merge-nomask_to_5x5_amazon_nomask_aave_da_c130403.nc - -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_MODIS_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.25x0.25_MODIS_to_ne240np4_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.5x0.5_AVHRR_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_10x10min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_IGBP-GSDP_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_nomask_to_ne240np4_nomask_aave_da_c110922.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ISRIC-WISE_to_ne240np4_nomask_aave_da_c111115.nc -lnd/clm2/mappingdata/maps/ne240np4/map_5x5min_ORNL-Soil_to_ne240np4_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS_to_ne240np4_nomask_aave_da_c111111.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_MODIS-wCsp_to_ne240np4_nomask_aave_da_c160425.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_USGS_to_ne240np4_nomask_aave_da_c120926.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_LandScan2004_to_ne240np4_nomask_aave_da_c120521.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_3x3min_GLOBE-Gardner-mergeGIS_to_ne240np4_nomask_aave_da_c120925.nc -lnd/clm2/mappingdata/maps/ne240np4/map_0.9x1.25_GRDC_to_ne240np4_nomask_aave_da_c130308.nc -lnd/clm2/mappingdata/maps/ne240np4/map_360x720_cruncep_to_ne240np4_nomask_aave_da_c130326.nc -lnd/clm2/mappingdata/maps/ne240np4/map_1km-merge-10min_HYDRO1K-merge-nomask_to_ne240np4_nomask_aave_da_c130405.nc -lnd/clm2/mappingdata/maps/ne240np4/map_ne240np4_nomask_to_0.5x0.5_nomask_aave_da_c110922.nc - - - - -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_AVHRR_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.5x0.5_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.25x0.25_MODIS_to_0.125x0.125_nomask_aave_da_c170321.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_0.9x1.25_GRDC_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_IGBPmergeICESatGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_10x10min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_1km-merge-10min_HYDRO1K-merge-nomask_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_360x720cru_cruncep_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner-mergeGIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_GLOBE-Gardner_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_LandScan2004_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_MODIS-wCsp_to_0.125x0.125_nomask_aave_da_c160427.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_3x3min_USGS_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_IGBP-GSDP_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ISRIC-WISE_to_0.125x0.125_nomask_aave_da_c140702.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_ORNL-Soil_to_0.125x0.125_nomask_aave_da_c170706.nc -lnd/clm2/mappingdata/maps/0.125x0.125/map_5x5min_nomask_to_0.125x0.125_nomask_aave_da_c140702.nc - - - - - - - -. -. - - - - - -.false. -.false. -.false. -.false. - -.false. -.false. -.false. -.false. - -.true. -.true. -.true. -.true. - -.true. -.true. -.false. -.false. - - -.false. -.false. -.false. -.false. -.false. -.false. - - diff --git a/bld/namelist_files/namelist_defaults_overall.xml b/bld/namelist_files/namelist_defaults_overall.xml deleted file mode 100644 index 9d8e3da4..00000000 --- a/bld/namelist_files/namelist_defaults_overall.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - -startup -startup -arb_ic -arb_ic -arb_ic -arb_ic -cold - - -/fs/cgd/csm/inputdata - - -1.9x2.5 -1x1_brazil -5x5_amazon -1x1_camdenNJ -1x1_vancouverCAN -1x1_mexicocityMEX -1x1_asphaltjungleNJ -1x1_urbanc_alpha -1x1_numaIA -1x1_smallvilleIA - - -2000 - - -constant - - -1 -0 - - -1 -0 - - --999.9 - - -.false. - - -gx1v6 -gx1v6 -gx1v6 -gx1v6 -gx3v7 -gx3v7 -USGS - -cruncep -USGS -USGS -gx3v7 -USGS -USGS - -T62 - -gx1v6 -gx1v6 -gx1v6 - -navy -navy -navy -navy -navy -navy -test -navy -test -gx1v6 - - - -.false. -0 -1 -3 -5 -10 -36 - - diff --git a/bld/namelist_files/namelist_definition.xsl b/bld/namelist_files/namelist_definition.xsl deleted file mode 100644 index 545d810e..00000000 --- a/bld/namelist_files/namelist_definition.xsl +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - - - - - CLM Namelist Definition - - -

-

-
-

-

-

Definition of CLM namelist variables

-

We list all of the relevant namelist variables for CLM I cases. This includes - CLM Namelist items as well as CLM build-namelist settings and namelist settings - for CLM offline tools.

-
-

Definition of CLM namelist variables

-

Note, these all would go into the user_nl_clm file - before configure):

-

Included in the table are the following pieces of information:

-
    -
  • Variable name.
  • -
  • Variable type (char, integer, - real, or logical). The type - char has the length appended - following an asterisk, e.g., char*256. Variables that are - arrays have their dimension specifier appended inside parentheses. For - example char*1(6) denotes a array of six - char*1 values. -
  • -
  • Variable description (includes information on defaults).
  • -
  • Valid values (if restricted).
  • -
- - - - - - - - - - - - -
CLM Namelist Physics Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Lake Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Biogeochemistry (BGC) Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Biogeochemistry Namelist Nitrogen Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Methane Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Vertical CN Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Carbon Isotope Model Options
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Datasets
NameTypeDescription -
Valid values
- - - - - - - - - - - - -
CLM Namelist History output settings
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Restart settings
NameTypeDescription
Valid values
- - - - - - - - - - - - -
CLM Namelist Performance Tuning
NameTypeDescription
Valid values
- -

-

-
-

-

-

Command Line Options to CLM Build-namelist

-

Variables that are entered as options to build-namelist (but NOT used by - namelists in code). Most of these are options that could be added to - CLM_BLDNML_OPTS. Included in the table are the following pieces - of information:

-
    -
  • Variable name.
  • -
  • Type.
  • -
  • Valid values.
  • -
  • Variable description.
  • -
- - - - - - - - - - - - -
CLM Namelist Default Settings
NameTypeDescription
Valid values, if restricted at all
-

-

-
-

-

-

Command Line Options to CLM Build-namelist

-

Variables that are entered as options to build-namelist (but NOT used by - namelists in code). Most of these are options that could be added to - CLM_BLDNML_OPTS. Included in the table are the following pieces - of information:

-
    -
  • Variable name.
  • -
  • Type.
  • -
  • Valid values.
  • -
  • Variable description.
  • -
- - - - - - - - - - - - -
CLM Namelist Default Settings
NameTypeDescription
Valid values, if restricted at all
-

-

-
-

-

-

Namelist items for CLM Tools

-

These are namelist items that appear in the CLM Tools under components/clm/tools. -

- - - - - - - - - - - -
CLM mksurfdata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkgriddata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkmapdata
NameTypeDescription
Valid values
- - - - - - - - - - - -
CLM mkgriddata
NameTypeDescription
Valid values
- - - - - - - - - - - -
Miscellaneous CLM tools
NameTypeDescription
Valid values
- -
- -

Namelist items for Driver MEGAN Physics

- - - - - - - - - - - -
Driver Physics
NameTypeDescription
Valid values
- - -

Namelist items for Driver Dry Deposition

- - - - - - - - - - - -
Driver Dry-Deposition Namelist Options
NameTypeDescription
Valid values, if restricted at all
- -
- - -
- - - - - - - - - Valid Values: - - - - -
diff --git a/bld/namelist_files/namelist_definition_clm4_5.xml b/bld/namelist_files/namelist_definition_clm4_5.xml deleted file mode 100644 index 0ded4814..00000000 --- a/bld/namelist_files/namelist_definition_clm4_5.xml +++ /dev/null @@ -1,1675 +0,0 @@ - - - - - - - - - - - -If use_init_interp is set to .true., interpinic will be called to interpolate -the file given by finidat, creating the output file specified by finidat_interp_dest. - - - -Full pathname of initial conditions file. If blank CLM will startup from -arbitrary initial conditions. - - - -If set to .true., interpinic will be called to interpolate the file given by finidat, -creating the output file specified by finidat_interp_dest. - -This requires that finidat be non-blank. - - - -Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) -(Set with RUN_REFCASE and RUN_REFDATE) - - - -Full pathname of land fraction data file. - - - -Clumps per processor. - - - -Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) -(Set by CCSM_CO2_PPMV) - - - -Type of CO2 feedback. - constant = use the input co2_ppmv value - prognostic = use the prognostic value sent from the atmosphere - diagnostic = use the diagnostic value sent from the atmosphere - - - - -Supplemental Nitrogen mode and for what type of vegetation it's turned on for. -In this mode Nitrogen is unlimited rather than prognosed and in general vegetation is -over-productive. - NONE = No vegetation types get supplemental Nitrogen - ALL = Supplemental Nitrogen is active for all vegetation types - - - -If TRUE, separate the vegetated landunit into a crop landunit and a natural vegetation landunit - - - -If TRUE, make ALL pfts, columns and landunits active, even those with 0 weight. -This means that computations will be run even over these 0-weight points. - -THIS IS ONLY FOR TESTING PURPOSES - IT HAS NOT BEEN CHECKED FOR SCIENTIFIC VALIDITY. - - - -If TRUE, square the organic fraction when it's used (as was done in CLM4.5) -Otherwise use the fraction straight up (the default for CLM5.0) - - - -10SL_3.5m = standard CLM4 and CLM4.5 version -23SL_3.5m = more vertical layers for permafrost simulations -49SL_10m = 49 layer soil column, 10m of soil, 5 bedrock layers -20SL_8.5m = 20 layer soil column, 8m of soil, 5 bedrock layers - - - -If TRUE, use variable soil depth. - -If present on surface dataset, use depth to bedrock information to -specify spatially variable soil thickness. If not present, use bottom -of soil column (nlevsoi). - - - -Index of rooting profile for water - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of rooting profile for soil carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Variant index of rooting profile for water -(Currently only used for Jackson 1996 method) - - - -Variant index of rooting profile for carbon and soil carbon -(Currently only used for Jackson 1996 method) - - - -Index of rooting profile for carbon - -Changes rooting profile from Zeng 2001 double exponential (0) to -Jackson 1996 single exponential (1) to Koven uniform exponential (2). - - - -Index of evaporative resistance method. - -Changes soil evaporative resistance method from Sakaguchi and Zeng -2009 Beta function (0) to Swenson and Lawrence 2014 dry surface layer -formulation (1). - - - -Slope of free living Nitrogen fixation with annual ET - - - -Intercept of free living Nitrogen fixation with zero annual ET - - - -Fraction of intercepted precipitation - - - -If TRUE use clm5 equation for fraction of intercepted precipitation - - - -Maximum fraction of leaf that may be wet prior to drip occuring - - - -Index of solution method of Richards equation. - -Change method for richards equation solution and boundary -conditions. - -CLM 4.5 - soilwater_movement_method = 0 (Zeng and Decker, 2009, method). -CLM 5.0 - soilwater_movement_method = 1 (adaptive time stepping moisture form from Martyn Clark). - -1 (adaptive time stepping moisture form - - - -Index of upper boundary condition for Richards equation. - - - -Index of lower boundary condition for Richards equation. - -lower_boundary_condition = 1 : flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 2 : zero-flux lower boundary condition (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 3 : water table head-based lower boundary condition w/ aquifer layer. (use with soilwater_movement_method=adaptive time stepping) -lower_boundary_condition = 4 : 11-layer solution w/ aquifer layer (only used with soilwater_movement_method=Zeng&Decker 2009) - -TODO(bja, 2015-09) these should be strings so they have meaningful names instead of ints. - - - -minimum time step length (seconds) for adaptive time stepping in richards equation - - -a very small number: used to check for sub step completion for adaptive time stepping in richards equation - - -tolerance to halve length of substep for adaptive time stepping in richards equation - - -tolerance to double length of substep for adaptive time stepping in richards equation - - - - - - - - - - - - -Minimum leaf area index for irrigation to occur - - - -Time of day to check whether we need irrigation, seconds (0 = midnight). -We start applying the irrigation in the time step FOLLOWING this time. - - - -Desired amount of time to irrigate per day (sec). -Actual time may differ if this is not a multiple of dtime. - - - -Target soil matric potential for irrigation (mm). -When we irrigate, we aim to bring the total soil moisture in the top (irrig_depth) m of soil up to this level. - - - -Soil depth to which we measure for irrigation (m) - - - -Determines soil moisture threshold at which we irrigate. -If h2osoi_liq_wilting_point is the soil moisture level at wilting point and -h2osoi_liq_target is the soil moisture level at the target irrigation level -(given by irrig_target_smp), then the threshold at which we irrigate is - h2osoi_liq_wilting_point + - irrig_threshold_fraction*(h2osoi_liq_target - h2osoi_liq_wilting_point) -A value of 1 means that we irrigate whenever soil moisture falls below the target. -A value of 0 means that we only irrigate when soil moisture falls below the wilting point. - - - -Threshold for river water volume below which irrigation is shut off (as a fraction of available river water), if limit_irrigation_if_rof_enabled is .true. -A threshold of 0 means allow all river water to be used; -a threshold of 0.1 means allow 90% of the river volume to be used; etc. - - - -If TRUE, limit irrigation when river storage drops below a threshold. -Only applies if using an active runoff (ROF) model; otherwise, river storage-based limitation -is turned off regardless of the setting of this namelist variable. - - - -If TRUE, irrigation will be active. - - - -Number of multiple elevation classes over glacier points. - - - -Behavior of each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'multiple': grid cells can potentially have multiple glacier elevation classes, - but no virtual columns -'virtual': grid cells have virtual columns: values are computed for every glacier - elevation class, even those with 0 area (in order to provide surface mass - balance for every glacier elevation class). -'single_at_atm_topo': glacier landunits in these grid cells have a single column, - whose elevation matches the atmosphere's topographic height (so that there is no - adjustment due to downscaling) -Behavior of 'virtual' is required in the region where we have an ice sheet model - - - -Treatment of ice melt for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'replaced_by_ice': any melted ice runs off and is immediately replaced by solid ice; - this results in positive liquid runoff and negative ice runoff -'remains_in_place': any melted ice remains in place as liquid until it refreezes; - thus, ice melt does not result in any runoff -IMPORTANT NOTE: Regions with the 'remains_in_place' behavior also do not -compute SMB (because negative SMB would be pretty much meaningless in -those regions). Thus, you cannot use this behavior where GLC is -operating. -Regions with the 'replaced_by_ice' behavior also compute SMB for the -vegetated column. - - - -Treatment of ice runoff for each glacier region (GLACIER_REGION in surface dataset). -First item corresponds to GLACIER_REGION with ID 0 in the surface dataset, -second to GLACIER_REGION with ID 1, etc. -Allowed values are: -'remains_ice': ice runoff is sent to the river model as ice; this is a crude parameterization - of iceberg calving, and so is appropriate in regions where there is substantial iceberg calving - in reality -'melted': ice runoff generated by the CLM physics (primarily due to snow capping) is melted - (generating a negative sensible heat flux) and runs off as liquid; this is appropriate in - regions that have little iceberg calving in reality. This can be important to avoid unrealistic - cooling of the ocean and consequent runaway sea ice growth. -Only applies when melt_non_icesheet_ice_runoff is .true. - - - -Number of days before one considers the perennially snow-covered point 'land ice' -(and thus capable of generating a positive surface mass balance for the glacier model). -This is meant to compensate for the fact that, with small values of h2osno_max, -the onset of a snow-capped state (and thus conversion to land ice) can occur in an -unrealistically short amount of time. -Thus, in general, large values of h2osno_max should have glc_snow_persistence_max_days = 0; -small values of h2osno_max should have glc_snow_persistence_max_days > 0. - - - -Visible and Near-infrared albedo's for glacier ice - - - -Scalar of leaf respiration to vcmax - - - -baseline proportion of nitrogen allocated for electron transport (J) - - - -Time step (seconds) - - - -Override the start type from the driver: it can only be -set to 3 meaning branch. - - - -Toggle to turn on the FATES model -(use_fates= '.true.' is EXPERIMENTAL NOT SUPPORTED!) - - - -Toggle to turn on the LUNA model, to effect Photosynthesis by leaf Nitrogen -LUNA operates on C3 and non-crop vegetation (see vcmax_opt for how other veg is handled) -LUNA: Leaf Utilization of Nitrogen for Assimilation - - - -Toggle to turn on the plant hydraulic stress model - - - -How LUNA and Photosynthesis (if needed) will get Leaf nitrogen content - lnc_opt = true get from leaf N from CN model - lnc_opt = false get based on LAI and fixed CN ratio from parameter file - - - -Full pathname datafile with plant function type (PFT) constants combined with -constants for biogeochem modules - - - -Full pathname datafile with fates parameters - - - -Full pathname of surface data file. - - - -Full pathname of MML surface data forcing file. - - - -Per file averaging flag. - 'A' (average over history period) - 'I' (instantaneous) - 'X' (maximum over history period) - 'M' (minimum over history period) - - - -Averaging type of output for 1D vector output (when hist_dov2xy is false). - GRID means average all land-units up to the grid-point level - LAND means average all columns up to the land-unit level - COLS means average all PFT's up to the column level - PFTS means report everything on native PFT level - - - -If TRUE, implies output data on a 2D latitude/longitude grid. False means -output in 1D vector format. One setting per history tape series. - - - -If TRUE, indicates do NOT output any default history fields (requires you to use -hist_fincl* to set the exact output fields to use).. - - - -Fields to exclude from history tape series 1. - - - -Fields to exclude from history tape series 2. - - - -Fields to exclude from history tape series 3. - - - -Fields to exclude from history tape series 4. - - - -Fields to exclude from history tape series 5. - - - -Fields to exclude from history tape series 6. - - - -Fields to add to history tape series 1. - - - -Fields to add to history tape series 2. - - - -Fields to add to history tape series 3. - - - -Fields to add to history tape series 4. - - - -Fields to add to history tape series 5. - - - -Fields to add to history tape series 6. - - - -Per tape series maximum number of time samples. - - - -Per tape series history file density (i.e. output precision) - 1=double precision - 2=single precision -Default: 2,2,2,2,2,2 - - - -Per tape series history write frequency. - positive means in time steps - 0=monthly - negative means hours -(i.e. 5 means every 24 time-steps and -24 means every day -Default: 0,-24,-24,-24,-24,-24 - - - -number of segments per clump for decomposition -Default: 20 - - - -Perturbation limit when doing error growth test - - - -If FALSE, don't write any restart files. - - - -Turn urban air conditioning/heating ON or OFF and add wasteheat: - OFF = Air conditioning/heating is OFF in buildings, internal temperature allowed to float freely - ON = Air conditioning/heating is ON in buildings, internal temperature constrained - ON_WASTEHEAT = Air conditioning/heating is ON and waste-heat sent to urban canyon - - - -If TRUE, urban traffic flux will be activated (Currently NOT implemented). - - - -0 = simpler method (clm4_5) -1 = prognostic calculation of interior building temp (clm5_0) - - - -If TRUE, write diagnostic of global radiative temperature written to CLM log file. - - - -Subgrid fluxes for snow - - - -Turn vegetation snow canopy ON, OFF, or ON with albedo influence (ON_RAD) - - - - - - -Turn on methane model. Standard part of CLM45BGC model. - - - -CLM Biogeochemistry mode : Carbon Nitrogen model (CN) -(or CLM45BGC if phys=clm4_5, vsoilc_centbgc='on', and clm4me='on') - - - -Turn the Fixation and Uptate of Nitrogen model version 2 (FUN2.0) -Requires the CN model to work (either CN or CNDV). - - - -Nitrification/denitrification splits the prognostic mineral N pool into two - mineral N pools: NO3 and NH4, and includes the transformations between them. -Requires the CN model to work (either CN or CNDV). - - - -Turn on vertical soil carbon. -Requires the CN or FATES model to work (either CN or CNDV). - - - -Use parameters for decomposition from the CENTURY Carbon model -Requires the CN or FATES model to work (either CN or CNDV). - - - -Toggle to turn on the prognostic crop model - - - -Initial seed Carbon to use at planting -(only used when CN is on as well as crop) - - - -Toggle to turn all history output completely OFF (possibly used for testing) - - - -Max number of plant functional types in naturally vegetated landunit. - - - -Toggle to turn on the dynamic root model - - - - - - -SCRIP format grid data file - - - -Flag to pass to the ESMF mapping utility, telling it what kind of large -file support is needed for an output file generated with this grid as -either the source or destination ('none', '64bit_offset' or 'netcdf4'). - - - -Flag to pass to the ESMF mapping utility, telling it what kind of grid -file this is (SCRIP or UGRID). - - - -For UGRID files, flag to pass to the ESMF mapping utility, telling it the -name of the dummy variable that has all of the topology information stored -in its attributes. (Only used if scripgriddata_src_type = UGRID.) - - - - - - -Filename for mksurfdata_map to remap raw data into the output surface dataset - - - -Plant Function Type dataset for mksurfdata - - - -Harvest dataset for mksurfdata - - - -Dataset for percent glacier land-unit for mksurfdata - - - -Dataset for glacier region ID for mksurfdata - - - -Dataset for topography used to define urban threshold - - - -Leaf Area Index dataset for mksurfdata - - - -Soil texture dataset for mksurfdata - - - -Soil color dataset for mksurfdata - - - -Soil max fraction dataset for mksurfdata - - - -High resolution land mask/fraction dataset for mksurfdata -(used for glacier_mec land-units) - - - -Type of grid to create for mksurfdata - - - -Grid file at the output resolution for mksurfdata - - - -Text file with filepaths (or list of XML elements) for vegetation fractions -and harvesting for each year to run over for mksurfdata to be able to model -transient land-use change - - - -High resolution topography dataset for mksurfdata -(used for glacier_mec land-units) - - - -Irrigation dataset for mksurfdata - - - -Organic soil dataset for mksurfdata - - - -Lake water dataset for mksurfdata - - - -Wetland dataset for mksurfdata - - - -Urban dataset for mksurfdata - - - -Biogenic Volatile Organic Compounds (VOC) emissions dataset for mksurfdata - - - -GDP dataset for mksurfdata - - - -Peat dataset for mksurfdata - - - -Soil depth dataset for mksurfdata - - - -Agricultural burning dominant month dataset for mksurfdata - - - -Topography statistics dataset for mksurfdata - - - -VIC parameters dataset for mksurfdata - - - -Inversion-derived CH4 parameters dataset for mksurfdata - - - -If TRUE, output variables in double precision for mksurfdata - - - -If TRUE, ignore other files, and set the output percentage to 100% urban and -zero for other land-use types. - - - -If TRUE, set wetland to 0% over land (renormalizing other landcover types as needed); -wetland will only be used for ocean points. - - - -Number of Plant Functional Types (excluding bare-soil) - - - -Plant Function Type index to override global file with for mksurfdata - - - -Plant Function Type fraction to override global file with for mksurfdata - - - -Soil color index to override global file with for mksurfdata - - - -Soil maximum fraction to override global file with for mksurfdata - - - -Soil percent sand to override global file with for mksurfdata - - - -Soil percent clay to override global file with for mksurfdata - - - - - - - -Orography file with surface heights and land area fraction - - - -CLM grid file - - - -CESM domain file - - - -CAM file - - - -Raw topography file - - - -CAM topography file - - - -Number of longitudes to use for a regional grid (for single-point set to 1) - - - -Number of latitudes to use for a regional grid (for single-point set to 1) - - - -Northern edge of the regional grid - - - -Southern edge of the regional grid - - - -Eastern edge of the regional grid - - - -Western edge of the regional grid - - - - - - - -Historical greenhouse gas concentrations from CAM, only used -by getco2_historical.ncl - - - - - - -Aerosol deposition file name (only used for aerdepregrid.ncl) - - - -Full pathname of CLM fraction dataset (only used for mkdatadomain). - - - -Full pathname of CLM grid dataset (only used for mkdatadomain). - - - -Full pathname of output domain dataset (only used for mkdatadomain). - - - -Type of domain file to create (ocean or atmosphere) (only used for mkdatadomain) - - - - - - - -If TRUE, repartition rain/snow from atmosphere based on temperature. - - - -If TRUE, downscale longwave radiation over glc_mec landunits. -This downscaling is conservative. -Default: .true. - - - -Surface temperature lapse rate (K m-1) -A positive value means a decrease in temperature with increasing height - - - -Longwave radiation lapse rate (W m-2 m-1) -A positive value means a decrease in LW radiation with increasing height -Only relevant if glcmec_downscale_longwave is .true. - - - -Relative limit for how much longwave downscaling can be done (unitless) -The pre-normalized, downscaled longwave is restricted to be in the range -[lwrad*(1-longwave_downscaling_limit), lwrad*(1+longwave_downscaling_limit)] -This parameter must be in the range [0,1] -Only relevant if glcmec_downscale_longwave is .true. - - - -Temperature below which all precipitation falls as snow, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature below which all precipitation falls as snow, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - -Temperature above which all precipitation falls as rain, for non-glacier columns (deg C) -Only relevant if repartition_rain_snow is .true. - - - - - - - -If TRUE, ice runoff generated from non-glacier columns and glacier columns outside icesheet regions -is converted to liquid, with an appropriate sensible heat flux. -That is, the atmosphere (rather than the ocean) melts the ice. -(Exception: ice runoff generated to ensure conservation with dynamic landunits remains as ice.) - - - - - - - - -Toggle to turn on use of LAI streams in place of the LAI on the surface dataset when using Satellite Phenology mode. -(EXPERIMENTAL and NOT tested) - - - -First year to loop over for LAI data - - - -Last year to loop over for LAI data - - - -Simulation year that aligns with stream_year_first_lai value - - - -Filename of input stream data for LAI - - - -Mapping method from LAI input file to the model resolution - bilinear = bilinear interpolation - nn = nearest neighbor - nnoni = nearest neighbor on the "i" (longitude) axis - nnonj = nearest neighbor on the "j" (latitude) axis - spval = set to special value - copy = copy using the same indices - - - -datm input directory - - -datm output directory - - -Datm logfile name - - - - - - - -Mapping file to go from one resolution/land-mask to another resolution/land-mask - - - -Land mask description for mksurfdata input files - - - -Horizontal grid resolutions for mksurfdata input files - - - - - - - - -Resolution of finundated inversion streams dataset (stream_fldfilename_ch4finundated) -to use for methane model -(only applies when CN and methane model are turned on) - - - -Resolution of Lightning dataset to use for CN fire model -(only applies when CN and the CN fire model are turned on) - - - -Check that the resolution and land-mask is valid before continuing. - - - -Add a note to the output namelist about the options given to build-namelist - - - -CLM run type. - 'default' use the default type of clm_start type for this configuration - 'cold' is a run from arbitrary initial conditions - 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is an initial run with initial conditions provided. - 'continue' is a restart run. - 'branch' is a restart run in which properties of the output history files may be changed. - - - -Horizontal resolutions -Note: 0.1x0.1, 0.25x0.25, 0.5x0.5, 5x5min, 10x10min, 3x3min and 0.33x0.33 are only used for CLM tools - - - -Representative concentration pathway for future scenarios [radiative forcing at peak or 2100 in W/m^2] --999.9 means do NOT use a future scenario, just use historical data. - - - -Land mask description - - - -General configuration of model version and atmospheric forcing to tune the model to run under. -This sets the model to run with constants and initial conditions that were set to run well under -the configuration of model version and atmospheric forcing. To run well constants would need to be changed -to run with a different type of atmospheric forcing. - - - -If 1, turn on the MEGAN model for BVOC's (Biogenic Volitile Organic Compounds) - - - -Year to simulate and to provide datasets for (such as surface datasets, initial conditions, aerosol-deposition, Nitrogen deposition rates etc.) -A sim_year of 1000 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year greater than 2005 corresponds to rcp scenario data -Most years are only used for clm_tools and there aren't CLM datasets that correspond to them. -CLM datasets exist for years: 1000 (for testing), 1850, and 2000 - - - -Range of years to simulate transitory datasets for (such as dynamic: land-use datasets, aerosol-deposition, Nitrogen deposition rates etc.) -Constant means simulation will be held at a constant year given in sim_year. -A sim_year_range of 1000-1002 or 1000-1004 corresponds to data used for testing only, NOT corresponding to any real datasets. -A sim_year_range that goes beyond 2005 corresponds to historical data until 2005 and then scenario data beyond that point. - - - -Namelist entries to demand be provided on the namelist. - - - -Description of the use case selected. - - - -Attributes to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -How close in years to use when looking for an initial condition file (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -Simulation years you can look for in initial condition files (finidat) if interpolation is turned on (use_init_interp is .true.) - - - -Command line argument for setting up your simulation in a mode for faster -throughput. By default turns off some options, and sets up for a lower level -of output. When bgc_mode is some level of prognostic BGC (so NOT Satellite Phenology) -it also sets up for accelerated decomposition. -NOTE: THIS CORRESPONDS DIRECTLY TO THE env_run.xml VARIABLE OF THE SAME NAME. - Set the env_run variable, rather than setting this directly. - - - -Command line arguement for biogeochemistry mode for CLM4.5 - sp = Satellitte Phenology - cn = Carbon Nitrogen model - bgc = CLM4.5 BGC model with: - CENTURY model pools - Nitrification/De-nitrification - Methane model - Vertically resolved Carbon - fates = FATES/ED ecosystem demography model with below ground BGC: - - - - - - - -Flag for setting the state of the Accelerated decomposition spinup state for the BGC model. - 0 = normal model behavior; - 1 = AD spinup (standard) - 2 = AD spinup (accelerated spinup from Ricciuto, doesn't work for CNDV and not implemented for CN soil decomposition) -Entering and exiting spinup mode occurs automatically by comparing the namelist and restart file values for this variable. -NOTE: THIS CAN ONLY BE SET TO NON-ZERO WHEN BGC_MODE IS NOT SATELITE PHENOLOGY! - - - - -E-folding depth over which decomposition is slowed with depth in all soils. - - - -separate q10 for frozen soil respiration rates. default to same as above zero rates - - - - - - -Flag to reseed any dead plants on startup from reading the initial conditions file - - - -Flag to use the atmospheric time series of C14 concentrations from bomb fallout and Seuss effect, rather than natural abundance C14 (nominally set as 10^-12 mol C14 / mol C) -(EXPERIMENTAL and NOT tested) - - - -Filename with time series of atmospheric Delta C14 data. variables in file are "time" and "Delta14co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0 units are permil. -(EXPERIMENTAL and NOT tested) - - - -Flag to use the atmospheric time series of C13 concentrations from natural abundance and the Seuss Effect, rather than static values. -(EXPERIMENTAL and NOT tested) - - - -Filename with time series of atmospheric Delta C13 data, which use CMIP6 format. variables in file are "time" and "delta13co2_in_air". time variable is in format: years since 1850-01-01 0:0:0.0. units are permil. -(EXPERIMENTAL and NOT tested) - - - - - - - -If TRUE use additional stress deciduous onset trigger - - - -Apply the guardrail for leaf-Nitrogen that ensures it doesn't go negative or too small - - - - - - - -Allow the CN ratio to flexibly change with the simulation, rather than being fixed - - - - Michaelis Menten nitrogen uptake kinetics - - - -How much Carbon to initialize vegetation pools (leafc/frootc and storage) to when -- Michaelis Menten nitrogen uptake kinetics is on - - - - GPP downregulation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Plant nitrogen demand for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten substrate limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten nitrogen limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Michaelis Menten temperature limitation for use_flexibleCN option -(EXPERIMENTAL and NOT tested) - - - - Flexible CN ratio used for Phenology -(EXPERIMENTAL and NOT tested) - - - - Reduce day length factor -(NOT implemented) - - - -Vcmax calculation for Photosynthesis - vcmax_opt = 4 As for vcmax_opt=0, but using leafN, and exponential if tree (EXPERIMENTAL NOT TESTED!) - vcmax_opt = 3 Based on leafN and VCAD (used with Luna for crop and C4 vegetation) - vcmax_opt = 0 Based on canopy top and foilage Nitrogen limitation factor from params file (clm4.5) -(EXPERIMENTAL and NOT tested) - - - -Residual option for flexible-CN -(EXPERIMENTAL and NOT tested) - - - -Partition option for flexible-CN - CN_partition_opt = 1 -(EXPERIMENTAL and NOT tested) - - - -Evergreen phenology option for CNPhenology -(EXPERIMENTAL and NOT tested) - - - -Carbon respiration option to burn off carbon when CN ratio is too high (do NOT use when FUN is on) -(EXPERIMENTAL and NOT tested) - - - - - - - -Use old snow cover fraction from Niu et al. 2007 -(deprecated -- will be removed) - - - -If surface water is active or not -(deprecated -- will be removed) - - - -Use original CLM4 soil hydraulic properties -(deprecated -- will be removed) - - - - - - - -If TRUE (which is the default), check consistency between year on the finidat file -and the current model year. This check is only done for a transient run. - - - -If TRUE (which is the default), check consistency between pct_pft on the finidat file -and pct_pft read from the surface dataset. This check is only done for a NON-transient run. - - - - - - - -If TRUE (which is the default), check consistency between pct_nat_pft on the flanduse_timeseries file -and pct_nat_pft read from the surface dataset. - - - - - - - -Number of snow layers. -Values less than 5 are mainly useful for testing, and should not be used for science. - - - -Maximum snow depth in mm H2O equivalent. Additional mass gains will be capped when this depth -is exceeded. -Changes in this value should possibly be accompanied by changes in: -- nlevsno: larger values of h2osno_max should be accompanied by increases in nlevsno -- glc_snow_persistence_max_days: large values of h2osno_max should generally have - glc_snow_persistence_max_days = 0; small values of h2osno_max should generally have - glc_snow_persistence_max_days > 0. - - - -Limit applied to integrated snowfall when determining changes in snow-covered fraction during melt -(mm H2O) - - - -SCA shape parameter for glc_mec (glacier multiple elevation class) columns -For most columns, n_melt is based on the standard deviation of 1km topography in the grid cell; -but glc_mec columns already account for subgrid topographic variability through their use of -multiple elevation classes; thus, to avoid double-accounting for topographic variability -in these columns, we use a fixed value of n_melt. - - - -If TRUE, the density of new snow depends on wind speed, and there is also -wind-dependent snow compaction. - - - -Method used to compute snow overburden compaction -Anderson1976 -- older method, default in CLM45 -Vionnet2012 --- newer method, default in CLM50 - - - -Snow density method to use for low temperatures (below -15C) -TruncatedAnderson1976 -- Truncate the Anderson-1976 equation at the value for -15C -Slater2017 ------------- Use equation from Slater that increases snow density for very cold temperatures (Arctic, Antarctic) - - - -Upper Limit on Destructive Metamorphism Compaction [kg/m3] - - - -Snow compaction overburden exponential factor (1/K) -Not used for snow_overburden_compaction_method=Vionnet2012 - - - -Minimum wind speed tht results in compaction (m/s) - - - -maximum warm (at freezing) fresh snow effective radius [microns] - - - -If set to .true., then reset the snow pack over non-glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - - - -If set to .true., then reset the snow pack over glacier columns to a small value. -This is useful when transitioning from a spinup under one set of atmospheric forcings -to a run under a different set of atmospheric forcings: By resetting too-large snow packs, -we make it more likely that points will remain only seasonally snow-covered under the new -atmospheric forcings. (This is particularly true in a coupled run, where starting with a -too-large snow pack can cool the atmosphere, thus maintaining the too-large snow pack.) - -See also reset_snow_glc_ela, which controls the elevation below which -glacier columns are reset. - -WARNING: Setting this to .true. will break water conservation for approximately the first -day of the new run. This is by design: The excess snow is completely removed from the system. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - -Only relevant if reset_snow_glc is .true. - -When resetting snow pack over glacier columns, one can choose to do this over all glacier -columns, or only those below a certain elevation. A typical use case is to reset only those -columns that have a seasonal snow pack in the real world, i.e. SMB less than 0, also known as -the equilibrium line altitude (ELA). This parameter sets a single global ELA value. By -setting this parameter to a large value (i.e. 10000 m), all glacier columns will be reset. - -WARNING: This variable is intended for short test runs, and generally -should not be used for scientific production runs. By resetting snow -below a given elevation, you risk forcing the system to evolve -differently in areas below and above reset_snow_glc_ela. - - - - - - - - -If FALSE (which is the default): If an output type cannot be found in the input for initInterp, -code aborts -If TRUE: If an output type cannot be found in the input, fill with closest natural veg column -(using bare soil for patch-level variables) - -NOTE: Natural vegetation and crop landunits always behave as if this were true. e.g., if -we can't find a column with the same type as a given crop column in the output, then we -always fill with the closest natural veg patch / column, regardless of the value of this -flag. So interpolation from non-crop to crop cases can be done without setting this flag. - - - diff --git a/bld/namelist_files/namelist_definition_drv.xml b/bld/namelist_files/namelist_definition_drv.xml deleted file mode 100644 index 493f2f2a..00000000 --- a/bld/namelist_files/namelist_definition_drv.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - 1.0 - - - - - - - - - diff --git a/bld/namelist_files/use_cases/1850_control.xml b/bld/namelist_files/use_cases/1850_control.xml deleted file mode 100644 index 786b9ae9..00000000 --- a/bld/namelist_files/use_cases/1850_control.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Conditions to simulate 1850 land-use - -1850 - -constant - - diff --git a/bld/namelist_files/use_cases/2000_control.xml b/bld/namelist_files/use_cases/2000_control.xml deleted file mode 100644 index c339f2d0..00000000 --- a/bld/namelist_files/use_cases/2000_control.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - -Conditions to simulate 2000 land-use - -2000 - -constant - - From 81106807f9638152733e16fc03ba1a5dc993281e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 14:37:33 -0700 Subject: [PATCH 006/164] Point to branch version of cime that recognizes SLIM --- Externals.cfg | 4 ++-- README | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 68aec40a..2ea43fb8 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -29,8 +29,8 @@ required = True [cime] local_path = cime protocol = git -repo_url = https://github.com/ESMCI/cime -tag = cime5.6.39 +repo_url = https://github.com/ekluzek/cime +branch = add_slim_comp required = True [externals_description] diff --git a/README b/README index 45f7759c..ffaafcef 100644 --- a/README +++ b/README @@ -3,9 +3,7 @@ Important files in main directories: ============================================================================================= Externals.cfg --------------- File for management of the main high level externals -Externals_CLM.cfg ----------- File for management of the CLM specific externals (i.e. FATES) - -bld/configure --------------- Script to prepare CLM to be built. +Externals_SLIM.cfg ---------- File for management of the SLIM specific externals (if any) ============================================================================================= QUICKSTART: using the CPL7 scripts: @@ -13,9 +11,9 @@ bld/configure --------------- Script to prepare CLM to be built. cd cime/scripts ./create_newcase # get help on how to run create_newcase - ./create_newcase --case testI --res f19_g16 --compset I2000Clm50BgcCrop --mach cheyenne + ./create_newcase --case testI --res f19_g17 --compset I2000SlimRsGs --mach cheyenne # create new "I" case for cheyenne_intel at 1.9x2.5_gx1v7 res - # "I2000Clm50BgcCrop" case is clm5_0 active, datm8, and inactive ice/ocn + # "I2000SlimRsGs" case is SLIM active, datm8, and inactive ice/ocn/glc/rof cd testI ./case.setup # create the $CASE.run file ./case.build # build model and create namelists From ab6fc09c14cec8cca856437e662e888dcd2f22eb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 9 Mar 2022 16:02:52 -0700 Subject: [PATCH 007/164] Initial add of namelist definition files --- cime_config/namelist_definition.xsl | 126 +++++++++++++++++++++++ cime_config/namelist_definition_slim.xml | 7 ++ 2 files changed, 133 insertions(+) create mode 100644 cime_config/namelist_definition.xsl create mode 100644 cime_config/namelist_definition_slim.xml diff --git a/cime_config/namelist_definition.xsl b/cime_config/namelist_definition.xsl new file mode 100644 index 00000000..665c2b33 --- /dev/null +++ b/cime_config/namelist_definition.xsl @@ -0,0 +1,126 @@ + + + + + + + + + + + + + SLIM Namelist Definition + + +

+

+
+

+

+

Definition of SLIM namelist variables

+

We list all of the relevant namelist variables for SLIM cases. This includes + SLIM Namelistitems.

+
+

Definition of SLIM namelist variables

+

Note, these all would go into the user_nl_slim file

+

Included in the table are the following pieces of information:

+
    +
  • Variable name.
  • +
  • Variable type (char, integer, + real, or logical). The type + char has the length appended + following an asterisk, e.g., char*256. Variables that are + arrays have their dimension specifier appended inside parentheses. For + example char*1(6) denotes a array of six + char*1 values. +
  • +
  • Variable description (includes information on defaults).
  • +
  • Valid values (if restricted).
  • +
+ + + + + + + + + + + + +
SLIM Namelist Physics Options
NameTypeDescription
Valid values
+ + + + + + + + + + + + +
SLIM Namelist Datasets
NameTypeDescription +
Valid values
+ + + + + + + + + + + + +
SLIM Namelist History output settings
NameTypeDescription
Valid values
+ + + + + + + + + + + + +
SLIM Namelist Restart settings
NameTypeDescription
Valid values
+ + + + + + + + + + + + +
SLIM Namelist Performance Tuning
NameTypeDescription
Valid values
+ +

+


+ + +
+ + + + + + + + + Valid Values: + + + + +
diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml new file mode 100644 index 00000000..d9a859f8 --- /dev/null +++ b/cime_config/namelist_definition_slim.xml @@ -0,0 +1,7 @@ + + + + + + + From 43e735de19aec5c016ded62c1ea6aba34b2b3c5e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Mar 2022 14:51:27 -0600 Subject: [PATCH 008/164] Version I can run xmllint on --- cime_config/namelist_definition_slim.xml | 322 +++++++++++++++++++++++ 1 file changed, 322 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index d9a859f8..8800cf41 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -4,4 +4,326 @@ + + + + + + char(256) + datasets + slim_inparm + + Surface dataset describing surface properties at each gridcell + + + + + char(256) + datasets + abs + slim_inparm + + + If use_init_interp is set to .true., interpinic will be called to interpolate + the file given by finidat, creating the output file specified by finidat_interp_dest. + + + + + char(256) + datasets + abs + slim_inparm + + + Full pathname of initial conditions file. If blank SLIM will startup from + arbitrary initial conditions. + + + + + logical + datasets + slim_inparm + + + If set to .true., interpinic will be called to interpolate the file given by finidat, + creating the output file specified by finidat_interp_dest. + + This requires that finidat be non-blank. + + + + + char(256) + slim_restart + abs + slim_inparm + + + Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) + (Set with RUN_REFCASE and RUN_REFDATE) + + + + + char(256) + datasets + abs + slim_inparm + + Full pathname of land fraction data file. + + + + + + + + integer + slim_performance + slim_inparm + Clumps per processor. + + + + integer + slim_performance + slim_inparm + number of segments per clump for decomposition + 20 + + + + + + + + real + slim_physics + slim_inparm + + Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) + (Set by CCSM_CO2_PPMV) + + + + + char*16 + slim_physics + slim_inparm + constant,prognostic,diagnostic + + Type of CO2 feedback. + constant = use the input co2_ppmv value + prognostic = use the prognostic value sent from the atmosphere + diagnostic = use the diagnostic value sent from the atmosphere + + + + + real + slim_physics + slim_inparm + Time step (seconds) + + + + + + + + char*1(6) + history + slim_inparm + A,I,X,M + + Per file averaging flag. + 'A' (average over history period) + 'I' (instantaneous) + 'X' (maximum over history period) + 'M' (minimum over history period) + + + + + char*4(6) + history + slim_inparm + GRID + + Averaging type of output for 1D vector output (when hist_dov2xy is false). + GRID means average all land-units up to the grid-point level + + + + + logical(6) + history + slim_inparm> + + If TRUE, implies output data on a 2D latitude/longitude grid. False means + output in 1D vector format. One setting per history tape series. + + + + + logical + history + slim_inparm + + If TRUE, indicates do NOT output any default history fields (requires you to use + hist_fincl* to set the exact output fields to use).. + + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 1. + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 2. + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 3. + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 4. + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 5. + + + + char*64(1000) + history + slim_inparm + Fields to exclude from history tape series 6. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 1. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 2. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 3. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 4. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 5. + + + + char*64(1000) + history + slim_inparm + Fields to add to history tape series 6. + + + + integer(6) + history + slim_inparm + Per tape series maximum number of time samples. + + + + integer(6) + history + slim_inparm + 1,2 + + Per tape series history file density (i.e. output precision) + 1=double precision + 2=single precision + + 2,2,2,2,2,2 + + + + integer(6) + history + slim_inparm + + Per tape series history write frequency. + positive means in time steps + 0=monthly + negative means hours + (i.e. 5 means every 24 time-steps and -24 means every day + + 0,-24,-24,-24,-24,-24 + + + + + + + + char*8 + default_settings + default_settings + default,cold,arb_ic,startup,continue,branch + + SLIM run type. + 'default' use the default type of slim_start type for this configuration + 'cold' is a run from arbitrary initial conditions + 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found + 'startup' is an initial run with initial conditions provided. + 'continue' is a restart run. + 'branch' is a restart run in which properties of the output history files may be changed. + + + + + char*30 + default_settings + default_settings + 0.9x1.25,1.9x2.5,4x5,10x15 + + 1.9x2.5 + + Horizontal resolutions + + From 3a85ee931626f3c48ec39d9acae10dbc9ca3d3b4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 18 Mar 2022 14:51:48 -0600 Subject: [PATCH 009/164] Update to python3 --- cime_config/buildlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index 3f572559..4528dfc6 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ build slim ibrary From 4f067045713b61754ae4e7bc5ae204de69e81506 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Mar 2022 01:29:47 -0600 Subject: [PATCH 010/164] Initial version of buildnml, not complete, but does compile --- cime_config/buildnml | 221 ++++++++++++++++++++----------------------- 1 file changed, 101 insertions(+), 120 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 77477cbd..74994ebc 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -1,9 +1,9 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ -CLM namelist creator +SLIM namelist creator """ -import sys, os, time, shutil, re, imp, filecmp +import sys, os, shutil _CIMEROOT = os.environ.get("CIMEROOT") if _CIMEROOT is None: @@ -14,97 +14,106 @@ sys.path.append(_LIBDIR) from standard_script_setup import * from CIME.buildnml import create_namelist_infile, parse_input +from CIME.nmlgen import NamelistGenerator from CIME.case import Case from CIME.utils import expect, run_cmd logger = logging.getLogger(__name__) -_config_cache_template = """ - - - -Specifies clm physics - -""" +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): +#################################################################################### + """Write out the namelist for this component. + + Most arguments are the same as those for `NamelistGenerator`. The + `inst_string` argument is used as a suffix to distinguish files for + different instances. The `confdir` argument is used to specify the directory + in which output files will be placed. + """ + #------------------------------------------------------ + # Create config dictionary + #------------------------------------------------------ + config = {} + config['din_loc_root'] = case.get_value("DIN_LOC_ROOT") + config['ccsm_co2_ppmv'] = case.get_value("CCSM_CO2_PPMV") + config['slim_co2_type'] = case.get_value("SLIM_CO2_TYPE") + config['slim_namelist_opts'] = case.get_value("SLIM_NAMELIST_OPTS") + config['slim_bldnml_opts'] = case.get_value("SLIM_BLDNML_OPTS") + config['slim_nml_use_case'] = case.get_value("SLIM_NML_USE_CASE") + config['slim_force_coldstart'] = case.get_value("SLIM_FORCE_COLDSTART") + config['comp_glc'] = case.get_value("COMP_GLC") + config['comp_atm'] = case.get_value("COMP_ATM") + config['lnd_grid'] = case.get_value("LND_GRID") + config['lnd_ncpl'] = case.get_value("LND_NCPL") + config['lnd_domain_path'] = case.get_value("LND_DOMAIN_PATH") + config['lnd_domain_file'] = case.get_value("LND_DOMAIN_FILE") + config['ninst_lnd'] = case.get_value("NINST_LND") + config['rundir'] = case.get_value("RUNDIR") + config['run_type'] = case.get_value("RUN_TYPE") + config['run_startdate'] = case.get_value("RUN_STARTDATE") + config['run_refcase'] = case.get_value("RUN_REFCASE") + config['run_refdate'] = case.get_value("RUN_REFDATE") + config['run_reftod'] = case.get_value("RUN_REFTOD") + config['mask'] = case.get_value("MASK_GRID") + + logger.debug( " SLIM lnd grid is %s", config['lnd_grid'] ) + + #------------------------------------------------------ + # Initialize namelist defaults + #------------------------------------------------------ + nmlgen.init_defaults(infile, config) + + #---------------------------------------------------- + # Write output namelist + #---------------------------------------------------- + namelist_file = os.path.join(confdir, "lnd_in") + nmlgen.write_output_file(namelist_file, data_list_path, groups=['slim_inparm']) + ############################################################################### def buildnml(case, caseroot, compname): ############################################################################### - """Build the clm namelist """ + """Build the slim namelist """ # Build the component namelist - if compname != "clm": + if compname != "slim": raise AttributeError lnd_root = case.get_value("COMP_ROOT_DIR_LND") - din_loc_root = case.get_value("DIN_LOC_ROOT") - ccsm_co2_ppmv = case.get_value("CCSM_CO2_PPMV") - clm_co2_type = case.get_value("CLM_CO2_TYPE") - clm_namelist_opts = case.get_value("CLM_NAMELIST_OPTS") - clm_bldnml_opts = case.get_value("CLM_BLDNML_OPTS") - clm_nml_use_case = case.get_value("CLM_NML_USE_CASE") - clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART") - clm_accelerated_spinup = case.get_value("CLM_ACCELERATED_SPINUP") - comp_glc = case.get_value("COMP_GLC") - comp_atm = case.get_value("COMP_ATM") - lnd_grid = case.get_value("LND_GRID") - lnd_ncpl = case.get_value("LND_NCPL") - lnd_domain_path = case.get_value("LND_DOMAIN_PATH") - lnd_domain_file = case.get_value("LND_DOMAIN_FILE") - ninst_lnd = case.get_value("NINST_LND") - rundir = case.get_value("RUNDIR") - run_type = case.get_value("RUN_TYPE") - run_startdate = case.get_value("RUN_STARTDATE") - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - glc_nec = case.get_value("GLC_NEC") - mask = case.get_value("MASK_GRID") - - - if ( clm_accelerated_spinup != "off" ): - expect(False, "CLM_ACCELERATED_SPINUP is not OFF -- SLIM can not use this!" ) # ----------------------------------------------------- # Clear out old data # ----------------------------------------------------- - input_data_list = os.path.join(caseroot,"Buildconf","clm.input_data_list") + input_data_list = os.path.join(caseroot,"Buildconf","slim.input_data_list") if os.path.exists(input_data_list): os.remove(input_data_list) # ----------------------------------------------------- - # Set clmconf + # Set confdir # ----------------------------------------------------- - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) + confdir = os.path.join(caseroot, "Buildconf", "slimconf") + if not os.path.isdir(confdir): + os.makedirs(confdir) - # ----------------------------------------------------- - # Create config_cache.xml file - # ----------------------------------------------------- + # namelist definition file + namelist_xml_dir = os.path.join(lnd_root, "cime_config") + definition_file = os.path.join(namelist_xml_dir, "namelist_definition_slim.xml") + expect(os.path.isfile(definition_file), "Namelist XML file %s not found!" % definition_file) - # Note that build-namelist utilizes the contents of the config_cache.xml file in - # the namelist_defaults.xml file to obtain namelist variables + # Create the namelist generator object - independent of instance + nmlgen = NamelistGenerator(case, definition_file) - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5 or clm5_0 physics") - - config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "clmconf", "config_cache.xml") - with open(config_cache_path, 'w') as config_cache_file: - config_cache_file.write(config_cache_text) - - # ----------------------------------------------------- - # Determine input arguments into build-namelist - # ----------------------------------------------------- + #---------------------------------------------------- + # Clear out old data list + #---------------------------------------------------- + data_list_path = os.path.join(case.get_case_root(), "Buildconf", "slim.input_data_list") + if os.path.exists(data_list_path): + os.remove(data_list_path) + ### Independent of instance... startfile_type = "finidat" start_type = "default" if run_type == "hybrid": @@ -114,27 +123,18 @@ def buildnml(case, caseroot, compname): if run_type == "branch": startfile_type = "nrevsn" - if clm_force_coldstart == "on": - clm_force_coldstart = "off" - logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" + if slim_force_coldstart == "on": + slim_force_coldstart = "off" + logger.warning( "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" ) - if (clm_force_coldstart == "on"): - logger.warning( "WARNING: CLM is starting up from a cold state" ) + if (slim_force_coldstart == "on"): + logger.warning( "WARNING: SLIM is starting up from a cold state" ) start_type = "cold" - if lnd_grid == 'T31': - lnd_grid = '48x96' - if lnd_grid == 'T42': - lnd_grid = '64x128' - if lnd_grid == 'T85': - lnd_grid = '128x256' - if lnd_grid == 'T341': - lnd_grid = '512x1024' - - if clm_nml_use_case != "UNSET": - usecase = "-use_case %s" %clm_nml_use_case + if slim_nml_use_case != "UNSET": + usecase = "-use_case %s" %slim_nml_use_case else: usecase = "" @@ -150,14 +150,12 @@ def buildnml(case, caseroot, compname): else: ignore = "-ignore_ic_date" - infile = os.path.join(clmconf, "namelist") + infile = os.path.join(confdir, "namelist") - inputdata_file = os.path.join(caseroot,"Buildconf","clm.input_data_list") + inputdata_file = os.path.join(caseroot,"Buildconf","slim.input_data_list") lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml") - # ----------------------------------------------------- # loop over instances # ----------------------------------------------------- @@ -178,54 +176,37 @@ def buildnml(case, caseroot, compname): shutil.copy(os.path.join(rundir, rpointer), os.path.join(rundir, rpointer + inst_string)) - # ----------------------------------------------------- - # call build-namelist - # ----------------------------------------------------- - + ### + ### instance dependent information... + ### if run_type == "hybrid" or run_type == "branch": - clm_startfile = "%s.clm2%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, clm_startfile)): - clm_startfile = "%s.clm2.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - clm_icfile = "%s = \'%s\'"%(startfile_type, clm_startfile) + slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) + if not os.path.exists(os.path.join(rundir, slim_startfile)): + slim_startfile = "%s.slim.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) + slim_icfile = "%s = \'%s\'"%(startfile_type, slim_startfile) else: - clm_icfile = "" + slim_icfile = "" + ### infile_lines = [] - infile_lines.append(clm_icfile) + infile_lines.append(slim_icfile) - user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) - namelist_infile = os.path.join(clmconf, "namelist") + user_nl_file = os.path.join(caseroot, "user_nl_slim" + inst_string) + namelist_infile = os.path.join(confdir, "namelist_infile") create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) - cmd = os.path.join(lnd_root,"bld","build-namelist") - - command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s/ \" " - "%s %s -res %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " - "-lnd_frac %s -glc_nec %s -co2_ppmv %s -co2_type %s -config %s " - "%s %s" - %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, - usecase, lnd_grid, start_type, caseroot, lnd_ncpl, - lndfrac_file, glc_nec, ccsm_co2_ppmv, clm_co2_type, config_cache_file, - clm_bldnml_opts, gridmask)) - - rc, out, err = run_cmd(command, from_dir=clmconf) - expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - if out is not None: - logger.debug(" %s"%out) - if err is not None: - logger.debug(" %s"%err) - + # create namelist + _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) # ----------------------------------------------------- # copy resolved namelist to rundir # ----------------------------------------------------- - if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") + file1 = os.path.join(confdir, "lnd_in") file2 = os.path.join(rundir, "lnd_in") if ninst > 1: file2 += inst_string - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) + logger.debug("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) shutil.copy(file1,file2) ############################################################################### @@ -233,7 +214,7 @@ def _main_func(): caseroot = parse_input(sys.argv) with Case(caseroot) as case: - buildnml(case, caseroot, "clm") + buildnml(case, caseroot, "slim") if __name__ == "__main__": _main_func() From 2db978a46264ce3d77ab3528b7dcd0ac98861e9c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Mar 2022 10:01:53 -0600 Subject: [PATCH 011/164] Fix syntax error that xmllint showed --- cime_config/namelist_definition_slim.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 8800cf41..57535770 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -160,7 +160,7 @@ logical(6) history - slim_inparm> + slim_inparm If TRUE, implies output data on a 2D latitude/longitude grid. False means output in 1D vector format. One setting per history tape series. From acfae2c19733d11de23e8b88a086d95dffca2373 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Mar 2022 11:26:26 -0600 Subject: [PATCH 012/164] Get XSL style sheet to basically work (still doesn't have sections) --- cime_config/namelist_definition.xsl | 34 ++++++++++------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/cime_config/namelist_definition.xsl b/cime_config/namelist_definition.xsl index 665c2b33..62e02bf0 100644 --- a/cime_config/namelist_definition.xsl +++ b/cime_config/namelist_definition.xsl @@ -20,7 +20,7 @@

Definition of SLIM namelist variables

We list all of the relevant namelist variables for SLIM cases. This includes - SLIM Namelistitems.

+ SLIM Namelist items.


Definition of SLIM namelist variables

Note, these all would go into the user_nl_slim file

@@ -49,7 +49,7 @@ Valid values - + @@ -63,7 +63,7 @@ - +
Valid values
@@ -76,20 +76,7 @@ - -
Valid values
- - - - - - - - - - - - +
SLIM Namelist Restart settings
NameTypeDescription
Valid values
@@ -102,24 +89,25 @@ - +
Valid values


- +

+ - - + + - Valid Values: - + Valid Values: + From a3a0768da1e1b893857fdce62ca9273ff4fcddf0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Mar 2022 17:15:55 -0600 Subject: [PATCH 013/164] Complete the namelist definition first draft --- cime_config/namelist_definition_slim.xml | 97 ++++++++++++++---------- 1 file changed, 56 insertions(+), 41 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 57535770..fcb9e206 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -11,7 +11,14 @@ char(256) datasets - slim_inparm + abs + slim_data_and_initial + + UNSET + $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc + Surface dataset describing surface properties at each gridcell @@ -21,7 +28,7 @@ char(256) datasets abs - slim_inparm + slim_data_and_initial If use_init_interp is set to .true., interpinic will be called to interpolate @@ -33,7 +40,7 @@ char(256) datasets abs - slim_inparm + slim_data_and_initial Full pathname of initial conditions file. If blank SLIM will startup from @@ -44,7 +51,7 @@ logical datasets - slim_inparm + slim_data_and_initial If set to .true., interpinic will be called to interpolate the file given by finidat, @@ -56,9 +63,9 @@ char(256) - slim_restart + datasets abs - slim_inparm + slim_data_and_initial Full pathname of master restart file for a branch run. (only used if RUN_TYPE=branch) @@ -66,12 +73,15 @@ - + char(256) datasets abs - slim_inparm + slim_data_and_initial + + $LND_DOMAIN_PATH/$LND_DOMAIN_FILE + Full pathname of land fraction data file. @@ -82,14 +92,14 @@ integer slim_performance - slim_inparm + slim_perf Clumps per processor. integer slim_performance - slim_inparm + slim_perf number of segments per clump for decomposition 20 @@ -98,21 +108,27 @@ - + real slim_physics slim_inparm + + $CCSM_CO2_PPMV + Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) (Set by CCSM_CO2_PPMV) - + char*16 slim_physics slim_inparm constant,prognostic,diagnostic + + $SLIM_CO2_TYPE + Type of CO2 feedback. constant = use the input co2_ppmv value @@ -121,7 +137,7 @@ - + real slim_physics slim_inparm @@ -135,7 +151,7 @@ char*1(6) history - slim_inparm + slim_history A,I,X,M Per file averaging flag. @@ -149,7 +165,7 @@ char*4(6) history - slim_inparm + slim_history GRID Averaging type of output for 1D vector output (when hist_dov2xy is false). @@ -160,7 +176,7 @@ logical(6) history - slim_inparm + slim_history If TRUE, implies output data on a 2D latitude/longitude grid. False means output in 1D vector format. One setting per history tape series. @@ -170,7 +186,7 @@ logical history - slim_inparm + slim_history If TRUE, indicates do NOT output any default history fields (requires you to use hist_fincl* to set the exact output fields to use).. @@ -180,98 +196,98 @@ char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 1. char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 2. char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 3. char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 4. char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 5. char*64(1000) history - slim_inparm + slim_history Fields to exclude from history tape series 6. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 1. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 2. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 3. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 4. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 5. char*64(1000) history - slim_inparm + slim_history Fields to add to history tape series 6. integer(6) history - slim_inparm + slim_history Per tape series maximum number of time samples. integer(6) history - slim_inparm + slim_history 1,2 Per tape series history file density (i.e. output precision) @@ -284,13 +300,13 @@ integer(6) history - slim_inparm + slim_history Per tape series history write frequency. positive means in time steps 0=monthly negative means hours - (i.e. 5 means every 24 time-steps and -24 means every day + (i.e. 5 means every 5 time-steps and -24 means every day 0,-24,-24,-24,-24,-24 @@ -299,29 +315,28 @@ - + char*8 default_settings default_settings - default,cold,arb_ic,startup,continue,branch + default,cold,arb_ic + + $SLIM_START_TYPE + SLIM run type. 'default' use the default type of slim_start type for this configuration 'cold' is a run from arbitrary initial conditions 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is an initial run with initial conditions provided. - 'continue' is a restart run. - 'branch' is a restart run in which properties of the output history files may be changed. - + char*30 default_settings default_settings - 0.9x1.25,1.9x2.5,4x5,10x15 - 1.9x2.5 + $LND_GRID Horizontal resolutions From f0c48556bd5f0c24938ff3f714f20c9725083274 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 25 Mar 2022 17:16:48 -0600 Subject: [PATCH 014/164] Change some of the SLIM settings --- cime_config/config_component.xml | 46 +++++++++++++------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index d7aeeadd..d82f0c10 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -26,31 +26,20 @@ Name of land component - + char UNSET + UNSET,global_uniform,1850_control,2000_control - 2000_control 1850_control run_component_slim env_run.xml - SLIM namelist use_case. - Determines the use-case that will be sent to the SLIM build-namelist utility. - This is normally set by the component set. This is an advanced flag and should only be - used by expert users. - - - - - char - - - - run_component_slim - env_run.xml - SLIM build-namelist options + SLIM namelist use_case scenario. + Determines the use-case scenario that will be used in the SLIM buildnml utility. + This is normally set by the component set. + @@ -58,7 +47,7 @@ constant,diagnostic,prognostic constant - diagnostic + diagnostic diagnostic prognostic diagnostic @@ -72,7 +61,7 @@ compset, since it HAS to be coordinated with settings for the atmospheric model. Do not modify this variable. If you want to modify for your experiment, use your own user-defined component set - This is an advanced flag and should only be used by expert users. + @@ -81,7 +70,7 @@ run_component_slim env_run.xml SLIM-specific namelist settings for -namelist option in the SLIM - build-namelist. SLIM_NAMELIST_OPTS is normally set as a compset variable + buildnml. SLIM_NAMELIST_OPTS is normally set as a compset variable and in general should not be modified for supported compsets. It is recommended that if you want to modify this value for your experiment, you should use your own user-defined component sets via using create_newcase @@ -89,17 +78,18 @@ This is an advanced flag and should only be used by expert users. - + char - on,off - off + default,cold,arb_ic + default run_component_slim env_run.xml - Flag to the SLIM build-namelist command to force SLIM to do a - cold start (finidat will be set to blanks). - A value of on forces the model to spin up from a cold-start - (arbitrary initial conditions). Setting this value in the xml file will take - precedence over any settings for finidat in the $CASEROOT/user_nl_slim file. + + SLIM run type. + 'default' use the default type of slim_start type for this configuration + 'cold' is a run from arbitrary initial conditions + 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found + From 155cd06d8cdb70694250a964606f1f6692b03b95 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 26 Mar 2022 00:08:13 -0600 Subject: [PATCH 015/164] Remove character size --- cime_config/namelist_definition_slim.xml | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index fcb9e206..29f0e988 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -9,7 +9,7 @@ - char(256) + char datasets abs slim_data_and_initial @@ -25,7 +25,7 @@ - char(256) + char datasets abs slim_data_and_initial @@ -37,7 +37,7 @@ - char(256) + char datasets abs slim_data_and_initial @@ -62,7 +62,7 @@ - char(256) + char datasets abs slim_data_and_initial @@ -74,7 +74,7 @@ - char(256) + char datasets abs slim_data_and_initial @@ -122,7 +122,7 @@ - char*16 + char slim_physics slim_inparm constant,prognostic,diagnostic @@ -149,7 +149,7 @@ - char*1(6) + char(6) history slim_history A,I,X,M @@ -163,7 +163,7 @@ - char*4(6) + char(6) history slim_history GRID @@ -194,84 +194,84 @@ - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 1. - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 2. - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 3. - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 4. - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 5. - char*64(1000) + char(1000) history slim_history Fields to exclude from history tape series 6. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 1. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 2. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 3. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 4. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 5. - char*64(1000) + char(1000) history slim_history Fields to add to history tape series 6. @@ -316,7 +316,7 @@ - char*8 + char default_settings default_settings default,cold,arb_ic @@ -332,7 +332,7 @@ - char*30 + char default_settings default_settings From 5286138703d7abd333dcf02aaebbd28f12c7954c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 26 Mar 2022 00:18:35 -0600 Subject: [PATCH 016/164] Something that roughly works --- cime_config/buildnml | 65 +++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 43 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 74994ebc..baed156b 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -35,27 +35,8 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # Create config dictionary #------------------------------------------------------ config = {} - config['din_loc_root'] = case.get_value("DIN_LOC_ROOT") - config['ccsm_co2_ppmv'] = case.get_value("CCSM_CO2_PPMV") - config['slim_co2_type'] = case.get_value("SLIM_CO2_TYPE") - config['slim_namelist_opts'] = case.get_value("SLIM_NAMELIST_OPTS") - config['slim_bldnml_opts'] = case.get_value("SLIM_BLDNML_OPTS") - config['slim_nml_use_case'] = case.get_value("SLIM_NML_USE_CASE") - config['slim_force_coldstart'] = case.get_value("SLIM_FORCE_COLDSTART") - config['comp_glc'] = case.get_value("COMP_GLC") - config['comp_atm'] = case.get_value("COMP_ATM") - config['lnd_grid'] = case.get_value("LND_GRID") - config['lnd_ncpl'] = case.get_value("LND_NCPL") - config['lnd_domain_path'] = case.get_value("LND_DOMAIN_PATH") - config['lnd_domain_file'] = case.get_value("LND_DOMAIN_FILE") - config['ninst_lnd'] = case.get_value("NINST_LND") - config['rundir'] = case.get_value("RUNDIR") - config['run_type'] = case.get_value("RUN_TYPE") - config['run_startdate'] = case.get_value("RUN_STARTDATE") - config['run_refcase'] = case.get_value("RUN_REFCASE") - config['run_refdate'] = case.get_value("RUN_REFDATE") - config['run_reftod'] = case.get_value("RUN_REFTOD") - config['mask'] = case.get_value("MASK_GRID") + config['lnd_grid'] = case.get_value("LND_GRID") + config['slim_scenario'] = case.get_value("SLIM_SCENARIO") logger.debug( " SLIM lnd grid is %s", config['lnd_grid'] ) @@ -64,11 +45,16 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path #------------------------------------------------------ nmlgen.init_defaults(infile, config) + #------------------------------------------------------ + # + #------------------------------------------------------ + #---------------------------------------------------- # Write output namelist #---------------------------------------------------- namelist_file = os.path.join(confdir, "lnd_in") - nmlgen.write_output_file(namelist_file, data_list_path, groups=['slim_inparm']) + nmlgen.write_output_file(namelist_file, data_list_path, \ + groups=['slim_inparm', 'slim_data_and_initial', 'slim_history', 'slim_perf']) ############################################################################### @@ -100,8 +86,9 @@ def buildnml(case, caseroot, compname): # namelist definition file namelist_xml_dir = os.path.join(lnd_root, "cime_config") - definition_file = os.path.join(namelist_xml_dir, "namelist_definition_slim.xml") - expect(os.path.isfile(definition_file), "Namelist XML file %s not found!" % definition_file) + definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] + for file_ in definition_file: + expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_ ) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file) @@ -116,11 +103,13 @@ def buildnml(case, caseroot, compname): ### Independent of instance... startfile_type = "finidat" start_type = "default" + run_type = case.get_value("RUN_TYPE") if run_type == "hybrid": start_type = "startup" elif run_type != "startup": start_type = run_type + slim_force_coldstart = case.get_value("SLIM_FORCE_COLDSTART") if run_type == "branch": startfile_type = "nrevsn" if slim_force_coldstart == "on": @@ -133,33 +122,19 @@ def buildnml(case, caseroot, compname): logger.warning( "WARNING: SLIM is starting up from a cold state" ) start_type = "cold" - if slim_nml_use_case != "UNSET": - usecase = "-use_case %s" %slim_nml_use_case - else: - usecase = "" - - if ( (mask != "null") and (mask != "UNSET") ): - gridmask = "-mask %s" %mask - else: - gridmask = "" + run_startdate = case.get_value("RUN_STARTDATE") start_ymd = run_startdate.replace('-','') - if ('-01-01' in run_startdate) or ('-09-01' in run_startdate): - ignore = "-ignore_ic_year" - else: - ignore = "-ignore_ic_date" - - infile = os.path.join(confdir, "namelist") - inputdata_file = os.path.join(caseroot,"Buildconf","slim.input_data_list") - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) + rundir = case.get_value("RUNDIR") # ----------------------------------------------------- # loop over instances # ----------------------------------------------------- + ninst_lnd = case.get_value("NINST_LND") ninst = int(ninst_lnd) for inst_counter in range(1, ninst+1): @@ -179,6 +154,9 @@ def buildnml(case, caseroot, compname): ### ### instance dependent information... ### + run_refcase = case.get_value("RUN_REFCASE") + run_refdate = case.get_value("RUN_REFDATE") + run_reftod = case.get_value("RUN_REFTOD") if run_type == "hybrid" or run_type == "branch": slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) if not os.path.exists(os.path.join(rundir, slim_startfile)): @@ -192,9 +170,10 @@ def buildnml(case, caseroot, compname): infile_lines.append(slim_icfile) user_nl_file = os.path.join(caseroot, "user_nl_slim" + inst_string) - namelist_infile = os.path.join(confdir, "namelist_infile") + infile = os.path.join(confdir, "namelist_infile") - create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) + create_namelist_infile(case, user_nl_file, infile, "\n".join(infile_lines)) + namelist_infile = [infile] # create namelist _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) From 30b56201970c97bcd2310882373c1d8dc382bcb6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 26 Mar 2022 00:20:51 -0600 Subject: [PATCH 017/164] Add a directory to test the buildnml in --- cime_config/buildnml_test/env_archive.xml | 9 ++ cime_config/buildnml_test/env_batch.xml | 25 ++++++ cime_config/buildnml_test/env_build.xml | 28 ++++++ cime_config/buildnml_test/env_case.xml | 63 +++++++++++++ cime_config/buildnml_test/env_mach_pes.xml | 89 +++++++++++++++++++ .../buildnml_test/env_mach_specific.xml | 24 +++++ cime_config/buildnml_test/env_run.xml | 44 +++++++++ cime_config/buildnml_test/env_workflow.xml | 14 +++ cime_config/buildnml_test/user_nl_slim | 14 +++ 9 files changed, 310 insertions(+) create mode 100644 cime_config/buildnml_test/env_archive.xml create mode 100644 cime_config/buildnml_test/env_batch.xml create mode 100644 cime_config/buildnml_test/env_build.xml create mode 100644 cime_config/buildnml_test/env_case.xml create mode 100644 cime_config/buildnml_test/env_mach_pes.xml create mode 100644 cime_config/buildnml_test/env_mach_specific.xml create mode 100644 cime_config/buildnml_test/env_run.xml create mode 100644 cime_config/buildnml_test/env_workflow.xml create mode 100644 cime_config/buildnml_test/user_nl_slim diff --git a/cime_config/buildnml_test/env_archive.xml b/cime_config/buildnml_test/env_archive.xml new file mode 100644 index 00000000..21e8595f --- /dev/null +++ b/cime_config/buildnml_test/env_archive.xml @@ -0,0 +1,9 @@ + + +
+
+ + + + +
diff --git a/cime_config/buildnml_test/env_batch.xml b/cime_config/buildnml_test/env_batch.xml new file mode 100644 index 00000000..d9bc277d --- /dev/null +++ b/cime_config/buildnml_test/env_batch.xml @@ -0,0 +1,25 @@ + + +
+
+ + + + + char + + + + + + + + + + + + + +
diff --git a/cime_config/buildnml_test/env_build.xml b/cime_config/buildnml_test/env_build.xml new file mode 100644 index 00000000..3464158b --- /dev/null +++ b/cime_config/buildnml_test/env_build.xml @@ -0,0 +1,28 @@ + + + +
+
+ + + + + char + Land (lnd) grid + + + + + + + + + + + + + + +
diff --git a/cime_config/buildnml_test/env_case.xml b/cime_config/buildnml_test/env_case.xml new file mode 100644 index 00000000..f6f4ef9d --- /dev/null +++ b/cime_config/buildnml_test/env_case.xml @@ -0,0 +1,63 @@ + + + +
+
+ + + + + + + char + file containing specification of component specific definitions and values(for documentation only - DO NOT EDIT) + $CIMEROOT/config/xml_schemas/entry_id.xsd + $CIMEROOT/config/xml_schemas/entry_id_version3.xsd + + + + char + Component set long name (for documentation only - DO NOT EDIT) + + + + char + Root directory of the case land model component + $CIMEROOT/config/xml_schemas/config_compsets.xsd + + + + char + slim + Name of land component + + + + char + full pathname of source root directory + + + + char + case name + + + + char + model system name + + + + char + full pathname of case + + + + char + Land grid + + + +
diff --git a/cime_config/buildnml_test/env_mach_pes.xml b/cime_config/buildnml_test/env_mach_pes.xml new file mode 100644 index 00000000..5697d09f --- /dev/null +++ b/cime_config/buildnml_test/env_mach_pes.xml @@ -0,0 +1,89 @@ + + + +
+
+ + + + + + + integer + + + + integer + + + + integer + + + + integer + + + + integer + Force this exact number of spare nodes to be allocated + + + + integer + + 1 + 1 + 1 + 1 + + + + + + integer + + -2 + -2 + -2 + -2 + + + + + + integer + + 0 + 0 + 0 + 0 + + + + + + integer + + 1 + 1 + 1 + + + + + + integer + + 1 + 1 + 1 + 1 + + + + + +
diff --git a/cime_config/buildnml_test/env_mach_specific.xml b/cime_config/buildnml_test/env_mach_specific.xml new file mode 100644 index 00000000..c38d868a --- /dev/null +++ b/cime_config/buildnml_test/env_mach_specific.xml @@ -0,0 +1,24 @@ + + + + + + +
+
+ + + char + executable name + + + + + + + + + +
diff --git a/cime_config/buildnml_test/env_run.xml b/cime_config/buildnml_test/env_run.xml new file mode 100644 index 00000000..fcd6dbe9 --- /dev/null +++ b/cime_config/buildnml_test/env_run.xml @@ -0,0 +1,44 @@ + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/cime_config/buildnml_test/env_workflow.xml b/cime_config/buildnml_test/env_workflow.xml new file mode 100644 index 00000000..69c9aa80 --- /dev/null +++ b/cime_config/buildnml_test/env_workflow.xml @@ -0,0 +1,14 @@ + + + +
+
+ + + + + +
+ diff --git a/cime_config/buildnml_test/user_nl_slim b/cime_config/buildnml_test/user_nl_slim new file mode 100644 index 00000000..7ac0af68 --- /dev/null +++ b/cime_config/buildnml_test/user_nl_slim @@ -0,0 +1,14 @@ +!---------------------------------------------------------------------------------- +! Users should add all user specific namelist changes below in the form of +! namelist_var = new_namelist_value +! +! EXCEPTIONS: +! Set co2_ppmv with CCSM_CO2_PPMV option +! Set dtime with L_NCPL option +! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options +! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases +! (includes $inst_string for multi-ensemble cases) +! or with SLIM_FORCE_COLDSTART to do a cold start +! or set it with an explicit filename here. +!---------------------------------------------------------------------------------- + From cc26b190dfd6db5ad4439c63083e1a65c41f0ae2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 27 Mar 2022 01:50:23 -0600 Subject: [PATCH 018/164] Basic functioning namelist, still needs dtime to be set, and error checking --- cime_config/buildnml_test/env_run.xml | 10 ++++- cime_config/namelist_definition_slim.xml | 55 ++++++++++++++++-------- 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/cime_config/buildnml_test/env_run.xml b/cime_config/buildnml_test/env_run.xml index fcd6dbe9..90ef4a24 100644 --- a/cime_config/buildnml_test/env_run.xml +++ b/cime_config/buildnml_test/env_run.xml @@ -11,7 +11,7 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc --> - + @@ -33,9 +33,15 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc + + - + + + + + diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 29f0e988..7e28e8cc 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -24,7 +24,7 @@
- + char datasets abs @@ -48,7 +48,7 @@
- + logical datasets slim_data_and_initial @@ -61,7 +61,7 @@
- + char datasets abs @@ -89,7 +89,7 @@ - + integer slim_performance slim_perf @@ -102,6 +102,9 @@ slim_perf number of segments per clump for decomposition 20 + + 20 + @@ -148,7 +151,7 @@ - + char(6) history slim_history @@ -162,7 +165,7 @@
- + char(6) history slim_history @@ -181,9 +184,12 @@ If TRUE, implies output data on a 2D latitude/longitude grid. False means output in 1D vector format. One setting per history tape series.
+ + .true. +
- + logical history slim_history @@ -198,37 +204,40 @@ history slim_history Fields to exclude from history tape series 1. + + '' + - + char(1000) history slim_history Fields to exclude from history tape series 2. - + char(1000) history slim_history Fields to exclude from history tape series 3. - + char(1000) history slim_history Fields to exclude from history tape series 4. - + char(1000) history slim_history Fields to exclude from history tape series 5. - + char(1000) history slim_history @@ -240,37 +249,40 @@ history slim_history Fields to add to history tape series 1. + + '' + - + char(1000) history slim_history Fields to add to history tape series 2. - + char(1000) history slim_history Fields to add to history tape series 3. - + char(1000) history slim_history Fields to add to history tape series 4. - + char(1000) history slim_history Fields to add to history tape series 5. - + char(1000) history slim_history @@ -282,6 +294,9 @@ history slim_history Per tape series maximum number of time samples. + + 1 + @@ -295,6 +310,9 @@ 2=single precision
2,2,2,2,2,2 + + 2 +
@@ -309,6 +327,9 @@ (i.e. 5 means every 5 time-steps and -24 means every day 0,-24,-24,-24,-24,-24 + + 0 + From 94498c82aed2d21d559c1ecd12811aaf702f3216 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 27 Mar 2022 01:57:15 -0600 Subject: [PATCH 019/164] Add some buildnml test output file and directory to git ignore file --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 5f93baa3..00cff6e4 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,7 @@ core.* *.gz *.log !run.log *.pyc + +# buildnml testing +cime_config/buildnml_test/Buildconf +cime_config/buildnml_test/buildnml.log From f265bd32f1f779457760eeb627bab90ce45388ae Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 28 Mar 2022 10:17:24 -0600 Subject: [PATCH 020/164] Remove CO2 settings as SLIM doesn't use it --- cime_config/buildnml_test/env_run.xml | 4 --- cime_config/buildnml_test/user_nl_slim | 1 - cime_config/config_component.xml | 22 ----------------- cime_config/namelist_definition_slim.xml | 31 +----------------------- cime_config/user_nl_slim | 1 - 5 files changed, 1 insertion(+), 58 deletions(-) diff --git a/cime_config/buildnml_test/env_run.xml b/cime_config/buildnml_test/env_run.xml index 90ef4a24..acfd61be 100644 --- a/cime_config/buildnml_test/env_run.xml +++ b/cime_config/buildnml_test/env_run.xml @@ -33,12 +33,8 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc - - - - diff --git a/cime_config/buildnml_test/user_nl_slim b/cime_config/buildnml_test/user_nl_slim index 7ac0af68..64824d6a 100644 --- a/cime_config/buildnml_test/user_nl_slim +++ b/cime_config/buildnml_test/user_nl_slim @@ -3,7 +3,6 @@ ! namelist_var = new_namelist_value ! ! EXCEPTIONS: -! Set co2_ppmv with CCSM_CO2_PPMV option ! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index d82f0c10..b1554900 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -42,28 +42,6 @@ - - char - constant,diagnostic,prognostic - constant - - diagnostic - diagnostic - prognostic - diagnostic - - run_component_slim - env_run.xml - Determines how SLIM will determine where CO2 is set. - If value is constant, it will be set to CCSM_CO2_PPMV, - if value is either diagnostic or prognostic, the atmosphere model - MUST send it to SLIM. SLIM_CO2_TYPE is normally set by the specific - compset, since it HAS to be coordinated with settings for the - atmospheric model. Do not modify this variable. If you want to modify for - your experiment, use your own user-defined component set - - - char diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 7e28e8cc..85e3f0ac 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -108,38 +108,9 @@ - + - - real - slim_physics - slim_inparm - - $CCSM_CO2_PPMV - - - Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) - (Set by CCSM_CO2_PPMV) - - - - - char - slim_physics - slim_inparm - constant,prognostic,diagnostic - - $SLIM_CO2_TYPE - - - Type of CO2 feedback. - constant = use the input co2_ppmv value - prognostic = use the prognostic value sent from the atmosphere - diagnostic = use the diagnostic value sent from the atmosphere - - - real slim_physics diff --git a/cime_config/user_nl_slim b/cime_config/user_nl_slim index 7ac0af68..64824d6a 100644 --- a/cime_config/user_nl_slim +++ b/cime_config/user_nl_slim @@ -3,7 +3,6 @@ ! namelist_var = new_namelist_value ! ! EXCEPTIONS: -! Set co2_ppmv with CCSM_CO2_PPMV option ! Set dtime with L_NCPL option ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases From d04e144eb3e76a1ea65640cd8b6910514e4b9b5b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 Apr 2022 14:07:05 -0600 Subject: [PATCH 021/164] Use new cime_config python library naming convention so that we can have a seperate python module for the buildnml --- cime_config/buildnml | 179 +------------------------------------------ 1 file changed, 4 insertions(+), 175 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index baed156b..03043e81 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -1,9 +1,9 @@ #!/usr/bin/env python3 """ -SLIM namelist creator +SLIM namelist creator executable """ -import sys, os, shutil +import sys, os _CIMEROOT = os.environ.get("CIMEROOT") if _CIMEROOT is None: @@ -13,180 +13,9 @@ _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") sys.path.append(_LIBDIR) from standard_script_setup import * -from CIME.buildnml import create_namelist_infile, parse_input -from CIME.nmlgen import NamelistGenerator +from CIME.buildnml import parse_input from CIME.case import Case -from CIME.utils import expect, run_cmd - -logger = logging.getLogger(__name__) - -# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements -#################################################################################### -def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): -#################################################################################### - """Write out the namelist for this component. - - Most arguments are the same as those for `NamelistGenerator`. The - `inst_string` argument is used as a suffix to distinguish files for - different instances. The `confdir` argument is used to specify the directory - in which output files will be placed. - """ - #------------------------------------------------------ - # Create config dictionary - #------------------------------------------------------ - config = {} - config['lnd_grid'] = case.get_value("LND_GRID") - config['slim_scenario'] = case.get_value("SLIM_SCENARIO") - - logger.debug( " SLIM lnd grid is %s", config['lnd_grid'] ) - - #------------------------------------------------------ - # Initialize namelist defaults - #------------------------------------------------------ - nmlgen.init_defaults(infile, config) - - #------------------------------------------------------ - # - #------------------------------------------------------ - - #---------------------------------------------------- - # Write output namelist - #---------------------------------------------------- - namelist_file = os.path.join(confdir, "lnd_in") - nmlgen.write_output_file(namelist_file, data_list_path, \ - groups=['slim_inparm', 'slim_data_and_initial', 'slim_history', 'slim_perf']) - - -############################################################################### -def buildnml(case, caseroot, compname): -############################################################################### - """Build the slim namelist """ - - # Build the component namelist - if compname != "slim": - raise AttributeError - - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - - # ----------------------------------------------------- - # Clear out old data - # ----------------------------------------------------- - - input_data_list = os.path.join(caseroot,"Buildconf","slim.input_data_list") - if os.path.exists(input_data_list): - os.remove(input_data_list) - - # ----------------------------------------------------- - # Set confdir - # ----------------------------------------------------- - - confdir = os.path.join(caseroot, "Buildconf", "slimconf") - if not os.path.isdir(confdir): - os.makedirs(confdir) - - # namelist definition file - namelist_xml_dir = os.path.join(lnd_root, "cime_config") - definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] - for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_ ) - - # Create the namelist generator object - independent of instance - nmlgen = NamelistGenerator(case, definition_file) - - #---------------------------------------------------- - # Clear out old data list - #---------------------------------------------------- - data_list_path = os.path.join(case.get_case_root(), "Buildconf", "slim.input_data_list") - if os.path.exists(data_list_path): - os.remove(data_list_path) - - ### Independent of instance... - startfile_type = "finidat" - start_type = "default" - run_type = case.get_value("RUN_TYPE") - if run_type == "hybrid": - start_type = "startup" - elif run_type != "startup": - start_type = run_type - - slim_force_coldstart = case.get_value("SLIM_FORCE_COLDSTART") - if run_type == "branch": - startfile_type = "nrevsn" - if slim_force_coldstart == "on": - slim_force_coldstart = "off" - logger.warning( "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" - ) - - if (slim_force_coldstart == "on"): - logger.warning( "WARNING: SLIM is starting up from a cold state" ) - start_type = "cold" - - - run_startdate = case.get_value("RUN_STARTDATE") - start_ymd = run_startdate.replace('-','') - - inputdata_file = os.path.join(caseroot,"Buildconf","slim.input_data_list") - - rundir = case.get_value("RUNDIR") - - # ----------------------------------------------------- - # loop over instances - # ----------------------------------------------------- - - ninst_lnd = case.get_value("NINST_LND") - ninst = int(ninst_lnd) - for inst_counter in range(1, ninst+1): - - # determine instance string - inst_string = "" - if ninst > 1: - inst_string = '_' + '%04d' % inst_counter - - # If multi-instance case does not have restart file, use - # single-case restart for each instance - rpointer = "rpointer.lnd" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) - - ### - ### instance dependent information... - ### - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - if run_type == "hybrid" or run_type == "branch": - slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, slim_startfile)): - slim_startfile = "%s.slim.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - slim_icfile = "%s = \'%s\'"%(startfile_type, slim_startfile) - else: - slim_icfile = "" - ### - - infile_lines = [] - infile_lines.append(slim_icfile) - - user_nl_file = os.path.join(caseroot, "user_nl_slim" + inst_string) - infile = os.path.join(confdir, "namelist_infile") - - create_namelist_infile(case, user_nl_file, infile, "\n".join(infile_lines)) - namelist_infile = [infile] - - # create namelist - _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) - # ----------------------------------------------------- - # copy resolved namelist to rundir - # ----------------------------------------------------- - if os.path.isdir(rundir): - file1 = os.path.join(confdir, "lnd_in") - file2 = os.path.join(rundir, "lnd_in") - if ninst > 1: - file2 += inst_string - logger.debug("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) +from slim_cime import buildnml ############################################################################### def _main_func(): From 9796f5362ac5334911c8b6a8a38e15b2bf4de082 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 Apr 2022 14:07:17 -0600 Subject: [PATCH 022/164] Use new cime_config python library naming convention so that we can have a seperate python module for the buildnml --- cime_config/buildnml_test/run_buildnml | 3 + cime_config/slim_cime.py | 187 +++++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100755 cime_config/buildnml_test/run_buildnml create mode 100644 cime_config/slim_cime.py diff --git a/cime_config/buildnml_test/run_buildnml b/cime_config/buildnml_test/run_buildnml new file mode 100755 index 00000000..ee1b8a52 --- /dev/null +++ b/cime_config/buildnml_test/run_buildnml @@ -0,0 +1,3 @@ +#!/bin/bash +env CIMEROOT=`pwd`/../../cime ../buildnml `pwd` --verbose +cat Buildconf/slimconf/lnd_in diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py new file mode 100644 index 00000000..49b32f51 --- /dev/null +++ b/cime_config/slim_cime.py @@ -0,0 +1,187 @@ +""" +SLIM namelist creator +""" +import sys, os, shutil + +_CIMEROOT = os.environ.get("CIMEROOT") +if _CIMEROOT is None: + raise SystemExit("ERROR: must set CIMEROOT environment variable") + +_LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") +sys.path.append(_LIBDIR) + +from standard_script_setup import * +from CIME.buildnml import create_namelist_infile, parse_input +from CIME.nmlgen import NamelistGenerator +from CIME.case import Case +from CIME.utils import expect, run_cmd + +logger = logging.getLogger(__name__) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): +#################################################################################### + """Write out the namelist for this component. + + Most arguments are the same as those for `NamelistGenerator`. The + `inst_string` argument is used as a suffix to distinguish files for + different instances. The `confdir` argument is used to specify the directory + in which output files will be placed. + """ + #------------------------------------------------------ + # Create config dictionary + #------------------------------------------------------ + config = {} + config['lnd_grid'] = case.get_value("LND_GRID") + config['slim_scenario'] = case.get_value("SLIM_SCENARIO") + + logger.debug( " SLIM lnd grid is %s", config['lnd_grid'] ) + + #------------------------------------------------------ + # Initialize namelist defaults + #------------------------------------------------------ + nmlgen.init_defaults(infile, config) + + #------------------------------------------------------ + # + #------------------------------------------------------ + + #---------------------------------------------------- + # Write output namelist + #---------------------------------------------------- + namelist_file = os.path.join(confdir, "lnd_in") + nmlgen.write_output_file(namelist_file, data_list_path, \ + groups=['slim_inparm', 'slim_data_and_initial', 'slim_history', 'slim_perf']) + + +############################################################################### +def buildnml(case, caseroot, compname): +############################################################################### + """Build the slim namelist """ + + # Build the component namelist + if compname != "slim": + raise AttributeError + + lnd_root = case.get_value("COMP_ROOT_DIR_LND") + + # ----------------------------------------------------- + # Clear out old data + # ----------------------------------------------------- + + input_data_list = os.path.join(caseroot,"Buildconf","slim.input_data_list") + if os.path.exists(input_data_list): + os.remove(input_data_list) + + # ----------------------------------------------------- + # Set confdir + # ----------------------------------------------------- + + confdir = os.path.join(caseroot, "Buildconf", "slimconf") + if not os.path.isdir(confdir): + os.makedirs(confdir) + + # namelist definition file + namelist_xml_dir = os.path.join(lnd_root, "cime_config") + definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] + for file_ in definition_file: + expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_ ) + + # Create the namelist generator object - independent of instance + nmlgen = NamelistGenerator(case, definition_file) + + #---------------------------------------------------- + # Clear out old data list + #---------------------------------------------------- + data_list_path = os.path.join(case.get_case_root(), "Buildconf", "slim.input_data_list") + if os.path.exists(data_list_path): + os.remove(data_list_path) + + ### Independent of instance... + startfile_type = "finidat" + start_type = "default" + run_type = case.get_value("RUN_TYPE") + if run_type == "hybrid": + start_type = "startup" + elif run_type != "startup": + start_type = run_type + + slim_force_coldstart = case.get_value("SLIM_FORCE_COLDSTART") + if run_type == "branch": + startfile_type = "nrevsn" + if slim_force_coldstart == "on": + slim_force_coldstart = "off" + logger.warning( "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" + ) + + if (slim_force_coldstart == "on"): + logger.warning( "WARNING: SLIM is starting up from a cold state" ) + start_type = "cold" + + + run_startdate = case.get_value("RUN_STARTDATE") + start_ymd = run_startdate.replace('-','') + + inputdata_file = os.path.join(caseroot,"Buildconf","slim.input_data_list") + + rundir = case.get_value("RUNDIR") + + # ----------------------------------------------------- + # loop over instances + # ----------------------------------------------------- + + ninst_lnd = case.get_value("NINST_LND") + ninst = int(ninst_lnd) + for inst_counter in range(1, ninst+1): + + # determine instance string + inst_string = "" + if ninst > 1: + inst_string = '_' + '%04d' % inst_counter + + # If multi-instance case does not have restart file, use + # single-case restart for each instance + rpointer = "rpointer.lnd" + if (os.path.isfile(os.path.join(rundir,rpointer)) and + (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): + shutil.copy(os.path.join(rundir, rpointer), + os.path.join(rundir, rpointer + inst_string)) + + ### + ### instance dependent information... + ### + run_refcase = case.get_value("RUN_REFCASE") + run_refdate = case.get_value("RUN_REFDATE") + run_reftod = case.get_value("RUN_REFTOD") + if run_type == "hybrid" or run_type == "branch": + slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) + if not os.path.exists(os.path.join(rundir, slim_startfile)): + slim_startfile = "%s.slim.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) + slim_icfile = "%s = \'%s\'"%(startfile_type, slim_startfile) + else: + slim_icfile = "" + ### + + infile_lines = [] + infile_lines.append(slim_icfile) + + user_nl_file = os.path.join(caseroot, "user_nl_slim" + inst_string) + infile = os.path.join(confdir, "namelist_infile") + + create_namelist_infile(case, user_nl_file, infile, "\n".join(infile_lines)) + namelist_infile = [infile] + + # create namelist + _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) + # ----------------------------------------------------- + # copy resolved namelist to rundir + # ----------------------------------------------------- + if os.path.isdir(rundir): + file1 = os.path.join(confdir, "lnd_in") + file2 = os.path.join(rundir, "lnd_in") + if ninst > 1: + file2 += inst_string + logger.debug("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) + shutil.copy(file1,file2) From aaa70103b92b9195271f91bc8f270619b0c6d204 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 1 Apr 2022 14:27:58 -0600 Subject: [PATCH 023/164] Add rundir setting and remove checks from slim_cime.py since it's already in the buildnml --- cime_config/slim_cime.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 49b32f51..106b0c36 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -4,13 +4,9 @@ import sys, os, shutil _CIMEROOT = os.environ.get("CIMEROOT") -if _CIMEROOT is None: - raise SystemExit("ERROR: must set CIMEROOT environment variable") - _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") sys.path.append(_LIBDIR) -from standard_script_setup import * from CIME.buildnml import create_namelist_infile, parse_input from CIME.nmlgen import NamelistGenerator from CIME.case import Case @@ -155,6 +151,7 @@ def buildnml(case, caseroot, compname): run_refcase = case.get_value("RUN_REFCASE") run_refdate = case.get_value("RUN_REFDATE") run_reftod = case.get_value("RUN_REFTOD") + rundir = case.get_value("RUNDIR") if run_type == "hybrid" or run_type == "branch": slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) if not os.path.exists(os.path.join(rundir, slim_startfile)): From 154080ad14d68ce2e783029053f24a65db8f9987 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 09:14:44 -0600 Subject: [PATCH 024/164] Get the logger working --- cime_config/slim_cime.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 106b0c36..64d0310d 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -7,6 +7,7 @@ _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") sys.path.append(_LIBDIR) +from standard_script_setup import * from CIME.buildnml import create_namelist_infile, parse_input from CIME.nmlgen import NamelistGenerator from CIME.case import Case @@ -25,6 +26,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path different instances. The `confdir` argument is used to specify the directory in which output files will be placed. """ + global logger #------------------------------------------------------ # Create config dictionary #------------------------------------------------------ @@ -55,6 +57,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path def buildnml(case, caseroot, compname): ############################################################################### """Build the slim namelist """ + global logger # Build the component namelist if compname != "slim": From 0233837049504f7fd037d2cea15d50057ab0d5c0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 09:15:42 -0600 Subject: [PATCH 025/164] Ignore the run directory in the namelist test directory --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 00cff6e4..85538e29 100644 --- a/.gitignore +++ b/.gitignore @@ -35,5 +35,6 @@ core.* *.pyc # buildnml testing +cime_config/buildnml_test/run cime_config/buildnml_test/Buildconf cime_config/buildnml_test/buildnml.log From 3729a11bdfdd98bbb9f9ce88687275433d7729d9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 09:48:22 -0600 Subject: [PATCH 026/164] Add new check subroutines for categories --- cime_config/buildnml_test/run_buildnml | 2 +- cime_config/slim_cime.py | 72 ++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 4 deletions(-) diff --git a/cime_config/buildnml_test/run_buildnml b/cime_config/buildnml_test/run_buildnml index ee1b8a52..ef82d91c 100755 --- a/cime_config/buildnml_test/run_buildnml +++ b/cime_config/buildnml_test/run_buildnml @@ -1,3 +1,3 @@ #!/bin/bash -env CIMEROOT=`pwd`/../../cime ../buildnml `pwd` --verbose +env CIMEROOT=`pwd`/../../cime ../buildnml `pwd` --verbose --debug cat Buildconf/slimconf/lnd_in diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 64d0310d..870182ec 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -15,6 +15,66 @@ logger = logging.getLogger(__name__) +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_dtime( nmlgen ): +#################################################################################### + """ Set the namelist settings for time-step + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_dtime" ) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_general( nmlgen ): +#################################################################################### + """ Set the namelist settings for general settings + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_general" ) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_performance( nmlgen ): +#################################################################################### + """ Set the namelist settings for performance + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_performance" ) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_history( nmlgen ): +#################################################################################### + """ Set the namelist settings for history + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_history" ) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_initial_conditions( nmlgen ): +#################################################################################### + """ Set the namelist settings for initial conditions + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_initial_conditions" ) + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements +#################################################################################### +def check_nml_data( nmlgen ): +#################################################################################### + """ Set the namelist settings for data + """ + global logger + #------------------------------------------------------ + logger.info( " check_nml_data" ) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): @@ -34,7 +94,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config['lnd_grid'] = case.get_value("LND_GRID") config['slim_scenario'] = case.get_value("SLIM_SCENARIO") - logger.debug( " SLIM lnd grid is %s", config['lnd_grid'] ) + logger.info( " SLIM lnd grid is %s", config['lnd_grid'] ) #------------------------------------------------------ # Initialize namelist defaults @@ -42,8 +102,14 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path nmlgen.init_defaults(infile, config) #------------------------------------------------------ - # + # Process different namelists and parts of the namelist #------------------------------------------------------ + check_nml_dtime( nmlgen ) + check_nml_general( nmlgen ) + check_nml_performance( nmlgen ) + check_nml_history( nmlgen ) + check_nml_initial_conditions( nmlgen ) + check_nml_data( nmlgen ) #---------------------------------------------------- # Write output namelist @@ -183,5 +249,5 @@ def buildnml(case, caseroot, compname): file2 = os.path.join(rundir, "lnd_in") if ninst > 1: file2 += inst_string - logger.debug("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) + logger.info("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) shutil.copy(file1,file2) From 4e6391fcbc190dc10ca0b2071953e973da4dcd14 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 09:57:53 -0600 Subject: [PATCH 027/164] Add setup for dtime --- cime_config/buildnml_test/env_run.xml | 4 +++ cime_config/slim_cime.py | 35 +++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/cime_config/buildnml_test/env_run.xml b/cime_config/buildnml_test/env_run.xml index acfd61be..2188ec23 100644 --- a/cime_config/buildnml_test/env_run.xml +++ b/cime_config/buildnml_test/env_run.xml @@ -33,6 +33,10 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc + + + + diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 870182ec..d2270204 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -17,13 +17,44 @@ # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_dtime( nmlgen ): +def check_nml_dtime( nmlgen, case ): #################################################################################### """ Set the namelist settings for time-step """ global logger #------------------------------------------------------ logger.info( " check_nml_dtime" ) + ncpl_base_period = case.get_value('NCPL_BASE_PERIOD') + if ncpl_base_period == 'hour': + basedt = 3600 + elif ncpl_base_period == 'day': + basedt = 3600 * 24 + elif ncpl_base_period == 'year': + if case.get_value('CALENDAR') == 'NO_LEAP': + basedt = 3600 * 24 * 365 + else: + expect(False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " %ncpl_base_period) + elif ncpl_base_period == 'decade': + if case.get_value('CALENDAR') == 'NO_LEAP': + basedt = 3600 * 24 * 365 * 10 + else: + expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) + else: + expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) + + logger.info( " basedt = "+str(basedt) ) + + + if basedt < 0: + expect(False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " %ncpl_base_period) + + lnd_ncpl = int(case.get_value("LND_NCPL")) + if basedt % lnd_ncpl != 0: + expect(False, "lnd_ncpl %s doesn't divide evenly into basedt %s\n" + %(lnd_ncpl, basedt)) + else: + dtime = basedt // lnd_ncpl + nmlgen.set_value("dtime", value=dtime) # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### @@ -104,7 +135,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path #------------------------------------------------------ # Process different namelists and parts of the namelist #------------------------------------------------------ - check_nml_dtime( nmlgen ) + check_nml_dtime( nmlgen, case ) check_nml_general( nmlgen ) check_nml_performance( nmlgen ) check_nml_history( nmlgen ) From 542ccdbd74a0137549f79f627e46273126792032 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 10:23:21 -0600 Subject: [PATCH 028/164] Add check that mll_surdat is set as it is required --- cime_config/buildnml_test/run_buildnml | 1 + cime_config/slim_cime.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/cime_config/buildnml_test/run_buildnml b/cime_config/buildnml_test/run_buildnml index ef82d91c..2ad7a4a0 100755 --- a/cime_config/buildnml_test/run_buildnml +++ b/cime_config/buildnml_test/run_buildnml @@ -1,3 +1,4 @@ #!/bin/bash +rm Buildconf/slimconf/lnd_in env CIMEROOT=`pwd`/../../cime ../buildnml `pwd` --verbose --debug cat Buildconf/slimconf/lnd_in diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index d2270204..b4a57475 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -106,6 +106,10 @@ def check_nml_data( nmlgen ): #------------------------------------------------------ logger.info( " check_nml_data" ) + mml_surdat = nmlgen.get_value( "mml_surdat" ) + if ( mml_surdat == "UNSET" ): + raise SystemExit( "mml_surdat file is NOT set and is required" ) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): @@ -145,6 +149,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path #---------------------------------------------------- # Write output namelist #---------------------------------------------------- + logger.info( "Write namelists" ) namelist_file = os.path.join(confdir, "lnd_in") nmlgen.write_output_file(namelist_file, data_list_path, \ groups=['slim_inparm', 'slim_data_and_initial', 'slim_history', 'slim_perf']) From f69c75f415b81dfe9652b31fd26d35ccd29e4c98 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 10:54:37 -0600 Subject: [PATCH 029/164] Check that hist_mfilt is at least 1 --- cime_config/slim_cime.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index b4a57475..66cb8539 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -96,6 +96,12 @@ def check_nml_initial_conditions( nmlgen ): #------------------------------------------------------ logger.info( " check_nml_initial_conditions" ) + hist_mfilt = nmlgen.get_value( "hist_mfilt" ) + for mfilt in hist_mfilt: + logger.info( " hist_mfilt = "+mfilt ) + if ( int(mfilt) <= 0 ): + raise SystemExit( "hist_mfilt must be 1 or larger" ) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def check_nml_data( nmlgen ): From d51ff2b884209a80fb4b47da25d922dd338c63c4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 10:56:10 -0600 Subject: [PATCH 030/164] Put it in the wrong subroutine --- cime_config/slim_cime.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 66cb8539..b7f7307d 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -86,6 +86,12 @@ def check_nml_history( nmlgen ): #------------------------------------------------------ logger.info( " check_nml_history" ) + hist_mfilt = nmlgen.get_value( "hist_mfilt" ) + for mfilt in hist_mfilt: + logger.info( " hist_mfilt = "+mfilt ) + if ( int(mfilt) <= 0 ): + raise SystemExit( "hist_mfilt must be 1 or larger" ) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def check_nml_initial_conditions( nmlgen ): @@ -96,12 +102,6 @@ def check_nml_initial_conditions( nmlgen ): #------------------------------------------------------ logger.info( " check_nml_initial_conditions" ) - hist_mfilt = nmlgen.get_value( "hist_mfilt" ) - for mfilt in hist_mfilt: - logger.info( " hist_mfilt = "+mfilt ) - if ( int(mfilt) <= 0 ): - raise SystemExit( "hist_mfilt must be 1 or larger" ) - # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def check_nml_data( nmlgen ): From 4588e655a6941a51cc505f1484adb400b251bdfc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 15 Apr 2022 12:01:51 -0600 Subject: [PATCH 031/164] If finidat is not UNSET and cold start_type abort with error, this gives a basic functioning namelist --- cime_config/buildnml_test/env_run.xml | 2 +- cime_config/namelist_definition_slim.xml | 6 ++++++ cime_config/slim_cime.py | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/cime_config/buildnml_test/env_run.xml b/cime_config/buildnml_test/env_run.xml index 2188ec23..858cfc74 100644 --- a/cime_config/buildnml_test/env_run.xml +++ b/cime_config/buildnml_test/env_run.xml @@ -39,7 +39,7 @@ Sample env_run.xml file that allows buildnml to be run for testing in this direc - + diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 85e3f0ac..6ac042e6 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -30,6 +30,9 @@ abs slim_data_and_initial + + UNSET + If use_init_interp is set to .true., interpinic will be called to interpolate the file given by finidat, creating the output file specified by finidat_interp_dest. @@ -42,6 +45,9 @@ abs slim_data_and_initial + + UNSET + Full pathname of initial conditions file. If blank SLIM will startup from arbitrary initial conditions. diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index b7f7307d..060ab0a5 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -94,13 +94,20 @@ def check_nml_history( nmlgen ): # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_initial_conditions( nmlgen ): +def check_nml_initial_conditions( nmlgen, case ): #################################################################################### """ Set the namelist settings for initial conditions """ global logger #------------------------------------------------------ logger.info( " check_nml_initial_conditions" ) + start_type = case.get_value( "SLIM_START_TYPE" ) + if ( start_type == "cold" ): + finidat = nmlgen.get_value("finidat") + logger.info( " finidat = "+finidat ) + if ( finidat != "UNSET" ): + raise SystemExit( "finidat is set but SLIM_START_TYPE is cold which is a contradiction") + nmlgen.set_value("finidat", value=" ") # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### @@ -149,7 +156,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path check_nml_general( nmlgen ) check_nml_performance( nmlgen ) check_nml_history( nmlgen ) - check_nml_initial_conditions( nmlgen ) + check_nml_initial_conditions( nmlgen, case ) check_nml_data( nmlgen ) #---------------------------------------------------- From 712a527f6b59e3ffbd1e94a33a33d5897610ca70 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 16 Apr 2022 16:21:19 -0600 Subject: [PATCH 032/164] Run through black --- cime_config/buildnml | 9 +- cime_config/slim_cime.py | 283 ++++++++++++++++++++++----------------- 2 files changed, 162 insertions(+), 130 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 03043e81..59dbd4c3 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -12,10 +12,10 @@ if _CIMEROOT is None: _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") sys.path.append(_LIBDIR) -from standard_script_setup import * -from CIME.buildnml import parse_input -from CIME.case import Case -from slim_cime import buildnml +from standard_script_setup import * +from CIME.buildnml import parse_input +from CIME.case import Case +from slim_cime import buildnml ############################################################################### def _main_func(): @@ -24,5 +24,6 @@ def _main_func(): with Case(caseroot) as case: buildnml(case, caseroot, "slim") + if __name__ == "__main__": _main_func() diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime.py index 060ab0a5..c5b2b2c4 100644 --- a/cime_config/slim_cime.py +++ b/cime_config/slim_cime.py @@ -7,126 +7,138 @@ _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") sys.path.append(_LIBDIR) -from standard_script_setup import * -from CIME.buildnml import create_namelist_infile, parse_input -from CIME.nmlgen import NamelistGenerator -from CIME.case import Case -from CIME.utils import expect, run_cmd +from standard_script_setup import * +from CIME.buildnml import create_namelist_infile, parse_input +from CIME.nmlgen import NamelistGenerator +from CIME.case import Case +from CIME.utils import expect, run_cmd logger = logging.getLogger(__name__) # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_dtime( nmlgen, case ): -#################################################################################### - """ Set the namelist settings for time-step - """ +def check_nml_dtime(nmlgen, case): + #################################################################################### + """Set the namelist settings for time-step""" global logger - #------------------------------------------------------ - logger.info( " check_nml_dtime" ) - ncpl_base_period = case.get_value('NCPL_BASE_PERIOD') - if ncpl_base_period == 'hour': + # ------------------------------------------------------ + logger.info(" check_nml_dtime") + ncpl_base_period = case.get_value("NCPL_BASE_PERIOD") + if ncpl_base_period == "hour": basedt = 3600 - elif ncpl_base_period == 'day': + elif ncpl_base_period == "day": basedt = 3600 * 24 - elif ncpl_base_period == 'year': - if case.get_value('CALENDAR') == 'NO_LEAP': + elif ncpl_base_period == "year": + if case.get_value("CALENDAR") == "NO_LEAP": basedt = 3600 * 24 * 365 else: - expect(False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " %ncpl_base_period) - elif ncpl_base_period == 'decade': - if case.get_value('CALENDAR') == 'NO_LEAP': + expect( + False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period + ) + elif ncpl_base_period == "decade": + if case.get_value("CALENDAR") == "NO_LEAP": basedt = 3600 * 24 * 365 * 10 else: - expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) + expect( + False, + "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period, + ) else: - expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " %ncpl_base_period) - - logger.info( " basedt = "+str(basedt) ) + expect( + False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period + ) + logger.info(" basedt = " + str(basedt)) if basedt < 0: - expect(False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " %ncpl_base_period) + expect( + False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " % ncpl_base_period + ) lnd_ncpl = int(case.get_value("LND_NCPL")) if basedt % lnd_ncpl != 0: - expect(False, "lnd_ncpl %s doesn't divide evenly into basedt %s\n" - %(lnd_ncpl, basedt)) + expect( + False, + "lnd_ncpl %s doesn't divide evenly into basedt %s\n" % (lnd_ncpl, basedt), + ) else: dtime = basedt // lnd_ncpl nmlgen.set_value("dtime", value=dtime) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_general( nmlgen ): -#################################################################################### - """ Set the namelist settings for general settings - """ +def check_nml_general(nmlgen): + #################################################################################### + """Set the namelist settings for general settings""" global logger - #------------------------------------------------------ - logger.info( " check_nml_general" ) + # ------------------------------------------------------ + logger.info(" check_nml_general") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_performance( nmlgen ): -#################################################################################### - """ Set the namelist settings for performance - """ +def check_nml_performance(nmlgen): + #################################################################################### + """Set the namelist settings for performance""" global logger - #------------------------------------------------------ - logger.info( " check_nml_performance" ) + # ------------------------------------------------------ + logger.info(" check_nml_performance") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_history( nmlgen ): -#################################################################################### - """ Set the namelist settings for history - """ +def check_nml_history(nmlgen): + #################################################################################### + """Set the namelist settings for history""" global logger - #------------------------------------------------------ - logger.info( " check_nml_history" ) + # ------------------------------------------------------ + logger.info(" check_nml_history") - hist_mfilt = nmlgen.get_value( "hist_mfilt" ) + hist_mfilt = nmlgen.get_value("hist_mfilt") for mfilt in hist_mfilt: - logger.info( " hist_mfilt = "+mfilt ) - if ( int(mfilt) <= 0 ): - raise SystemExit( "hist_mfilt must be 1 or larger" ) + logger.info(" hist_mfilt = " + mfilt) + if int(mfilt) <= 0: + raise SystemExit("hist_mfilt must be 1 or larger") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_initial_conditions( nmlgen, case ): -#################################################################################### - """ Set the namelist settings for initial conditions - """ +def check_nml_initial_conditions(nmlgen, case): + #################################################################################### + """Set the namelist settings for initial conditions""" global logger - #------------------------------------------------------ - logger.info( " check_nml_initial_conditions" ) - start_type = case.get_value( "SLIM_START_TYPE" ) - if ( start_type == "cold" ): - finidat = nmlgen.get_value("finidat") - logger.info( " finidat = "+finidat ) - if ( finidat != "UNSET" ): - raise SystemExit( "finidat is set but SLIM_START_TYPE is cold which is a contradiction") - nmlgen.set_value("finidat", value=" ") + # ------------------------------------------------------ + logger.info(" check_nml_initial_conditions") + start_type = case.get_value("SLIM_START_TYPE") + if start_type == "cold": + finidat = nmlgen.get_value("finidat") + logger.info(" finidat = " + finidat) + if finidat != "UNSET": + raise SystemExit( + "finidat is set but SLIM_START_TYPE is cold which is a contradiction" + ) + nmlgen.set_value("finidat", value=" ") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_data( nmlgen ): -#################################################################################### - """ Set the namelist settings for data - """ +def check_nml_data(nmlgen): + #################################################################################### + """Set the namelist settings for data""" global logger - #------------------------------------------------------ - logger.info( " check_nml_data" ) + # ------------------------------------------------------ + logger.info(" check_nml_data") + + mml_surdat = nmlgen.get_value("mml_surdat") + if mml_surdat == "UNSET": + raise SystemExit("mml_surdat file is NOT set and is required") - mml_surdat = nmlgen.get_value( "mml_surdat" ) - if ( mml_surdat == "UNSET" ): - raise SystemExit( "mml_surdat file is NOT set and is required" ) # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path): -#################################################################################### + #################################################################################### """Write out the namelist for this component. Most arguments are the same as those for `NamelistGenerator`. The @@ -135,46 +147,49 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path in which output files will be placed. """ global logger - #------------------------------------------------------ + # ------------------------------------------------------ # Create config dictionary - #------------------------------------------------------ + # ------------------------------------------------------ config = {} - config['lnd_grid'] = case.get_value("LND_GRID") - config['slim_scenario'] = case.get_value("SLIM_SCENARIO") + config["lnd_grid"] = case.get_value("LND_GRID") + config["slim_scenario"] = case.get_value("SLIM_SCENARIO") - logger.info( " SLIM lnd grid is %s", config['lnd_grid'] ) + logger.info(" SLIM lnd grid is %s", config["lnd_grid"]) - #------------------------------------------------------ + # ------------------------------------------------------ # Initialize namelist defaults - #------------------------------------------------------ + # ------------------------------------------------------ nmlgen.init_defaults(infile, config) - #------------------------------------------------------ + # ------------------------------------------------------ # Process different namelists and parts of the namelist - #------------------------------------------------------ - check_nml_dtime( nmlgen, case ) - check_nml_general( nmlgen ) - check_nml_performance( nmlgen ) - check_nml_history( nmlgen ) - check_nml_initial_conditions( nmlgen, case ) - check_nml_data( nmlgen ) - - #---------------------------------------------------- + # ------------------------------------------------------ + check_nml_dtime(nmlgen, case) + check_nml_general(nmlgen) + check_nml_performance(nmlgen) + check_nml_history(nmlgen) + check_nml_initial_conditions(nmlgen, case) + check_nml_data(nmlgen) + + # ---------------------------------------------------- # Write output namelist - #---------------------------------------------------- - logger.info( "Write namelists" ) + # ---------------------------------------------------- + logger.info("Write namelists") namelist_file = os.path.join(confdir, "lnd_in") - nmlgen.write_output_file(namelist_file, data_list_path, \ - groups=['slim_inparm', 'slim_data_and_initial', 'slim_history', 'slim_perf']) + nmlgen.write_output_file( + namelist_file, + data_list_path, + groups=["slim_inparm", "slim_data_and_initial", "slim_history", "slim_perf"], + ) ############################################################################### def buildnml(case, caseroot, compname): -############################################################################### - """Build the slim namelist """ + ############################################################################### + """Build the slim namelist""" global logger - # Build the component namelist + # Build the component namelist if compname != "slim": raise AttributeError @@ -184,7 +199,7 @@ def buildnml(case, caseroot, compname): # Clear out old data # ----------------------------------------------------- - input_data_list = os.path.join(caseroot,"Buildconf","slim.input_data_list") + input_data_list = os.path.join(caseroot, "Buildconf", "slim.input_data_list") if os.path.exists(input_data_list): os.remove(input_data_list) @@ -200,15 +215,17 @@ def buildnml(case, caseroot, compname): namelist_xml_dir = os.path.join(lnd_root, "cime_config") definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] for file_ in definition_file: - expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_ ) + expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) # Create the namelist generator object - independent of instance nmlgen = NamelistGenerator(case, definition_file) - #---------------------------------------------------- + # ---------------------------------------------------- # Clear out old data list - #---------------------------------------------------- - data_list_path = os.path.join(case.get_case_root(), "Buildconf", "slim.input_data_list") + # ---------------------------------------------------- + data_list_path = os.path.join( + case.get_case_root(), "Buildconf", "slim.input_data_list" + ) if os.path.exists(data_list_path): os.remove(data_list_path) @@ -225,43 +242,46 @@ def buildnml(case, caseroot, compname): if run_type == "branch": startfile_type = "nrevsn" if slim_force_coldstart == "on": - slim_force_coldstart = "off" - logger.warning( "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" - ) - - if (slim_force_coldstart == "on"): - logger.warning( "WARNING: SLIM is starting up from a cold state" ) + slim_force_coldstart = "off" + logger.warning( + "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" + ) + + if slim_force_coldstart == "on": + logger.warning("WARNING: SLIM is starting up from a cold state") start_type = "cold" - run_startdate = case.get_value("RUN_STARTDATE") - start_ymd = run_startdate.replace('-','') + start_ymd = run_startdate.replace("-", "") + + inputdata_file = os.path.join(caseroot, "Buildconf", "slim.input_data_list") - inputdata_file = os.path.join(caseroot,"Buildconf","slim.input_data_list") - rundir = case.get_value("RUNDIR") - + # ----------------------------------------------------- # loop over instances # ----------------------------------------------------- ninst_lnd = case.get_value("NINST_LND") ninst = int(ninst_lnd) - for inst_counter in range(1, ninst+1): + for inst_counter in range(1, ninst + 1): # determine instance string inst_string = "" if ninst > 1: - inst_string = '_' + '%04d' % inst_counter + inst_string = "_" + "%04d" % inst_counter # If multi-instance case does not have restart file, use # single-case restart for each instance - rpointer = "rpointer.lnd" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) + rpointer = "rpointer.lnd" + if os.path.isfile(os.path.join(rundir, rpointer)) and ( + not os.path.isfile(os.path.join(rundir, rpointer + inst_string)) + ): + shutil.copy( + os.path.join(rundir, rpointer), + os.path.join(rundir, rpointer + inst_string), + ) ### ### instance dependent information... @@ -269,12 +289,21 @@ def buildnml(case, caseroot, compname): run_refcase = case.get_value("RUN_REFCASE") run_refdate = case.get_value("RUN_REFDATE") run_reftod = case.get_value("RUN_REFTOD") - rundir = case.get_value("RUNDIR") + rundir = case.get_value("RUNDIR") if run_type == "hybrid" or run_type == "branch": - slim_startfile = "%s.slim%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) + slim_startfile = "%s.slim%s.r.%s-%s.nc" % ( + run_refcase, + inst_string, + run_refdate, + run_reftod, + ) if not os.path.exists(os.path.join(rundir, slim_startfile)): - slim_startfile = "%s.slim.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - slim_icfile = "%s = \'%s\'"%(startfile_type, slim_startfile) + slim_startfile = "%s.slim.r.%s-%s.nc" % ( + run_refcase, + run_refdate, + run_reftod, + ) + slim_icfile = "%s = '%s'" % (startfile_type, slim_startfile) else: slim_icfile = "" ### @@ -289,7 +318,9 @@ def buildnml(case, caseroot, compname): namelist_infile = [infile] # create namelist - _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) + _create_namelists( + case, confdir, inst_string, namelist_infile, nmlgen, data_list_path + ) # ----------------------------------------------------- # copy resolved namelist to rundir # ----------------------------------------------------- @@ -298,5 +329,5 @@ def buildnml(case, caseroot, compname): file2 = os.path.join(rundir, "lnd_in") if ninst > 1: file2 += inst_string - logger.info("SLIM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) + logger.info("SLIM namelist copy: file1 %s file2 %s " % (file1, file2)) + shutil.copy(file1, file2) From 4df24c87599d84e2c443cd67a098cf9ef4cb3d59 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 9 May 2022 05:21:02 -0600 Subject: [PATCH 033/164] Renaming to new cesm convention --- cime_config/slim_cime_py/__init__.py | 1 + .../buildnml.py} | 0 python/Makefile | 53 ++ python/README.md | 37 ++ python/pyproject.toml | 13 + python/run_slim_py_tests | 12 + python/slim/.pylintrc | 572 ++++++++++++++++++ python/slim/__init__.py | 0 python/slim/add_cime_to_path.py | 25 + python/slim/path_utils.py | 104 ++++ python/slim/run_slim_py_tests.py | 84 +++ python/slim/slim_logging.py | 98 +++ python/slim/test/README | 23 + python/slim/test/__init__.py | 0 python/slim/unit_testing.py | 14 + python/slim/utils.py | 22 + 16 files changed, 1058 insertions(+) create mode 100644 cime_config/slim_cime_py/__init__.py rename cime_config/{slim_cime.py => slim_cime_py/buildnml.py} (100%) create mode 100644 python/Makefile create mode 100644 python/README.md create mode 100644 python/pyproject.toml create mode 100755 python/run_slim_py_tests create mode 100644 python/slim/.pylintrc create mode 100644 python/slim/__init__.py create mode 100644 python/slim/add_cime_to_path.py create mode 100644 python/slim/path_utils.py create mode 100644 python/slim/run_slim_py_tests.py create mode 100644 python/slim/slim_logging.py create mode 100644 python/slim/test/README create mode 100644 python/slim/test/__init__.py create mode 100644 python/slim/unit_testing.py create mode 100644 python/slim/utils.py diff --git a/cime_config/slim_cime_py/__init__.py b/cime_config/slim_cime_py/__init__.py new file mode 100644 index 00000000..8391f667 --- /dev/null +++ b/cime_config/slim_cime_py/__init__.py @@ -0,0 +1 @@ +from .buildnml import buildnml diff --git a/cime_config/slim_cime.py b/cime_config/slim_cime_py/buildnml.py similarity index 100% rename from cime_config/slim_cime.py rename to cime_config/slim_cime_py/buildnml.py diff --git a/python/Makefile b/python/Makefile new file mode 100644 index 00000000..5123f7cc --- /dev/null +++ b/python/Makefile @@ -0,0 +1,53 @@ +# Makefile for running tests on the python code here + +# These variables can be overridden from the command-line +python = not-set +verbose = not-set +debug = not-set + +ifneq ($(python), not-set) + PYTHON=$(python) +else + PYTHON=python3 +endif + +ifneq ($(debug), not-set) + TEST_ARGS+=--debug +endif +ifneq ($(verbose), not-set) + TEST_ARGS+=--verbose +endif + +PYLINT=pylint +PYLINT_ARGS=-j 4 --rcfile=slim/.pylintrc +PYLINT_SRC = \ + slim \ + ../cime_config + +all: lint black test +test: utest stest + +.PHONY: utest +utest: FORCE + $(PYTHON) ./run_slim_py_tests $(TEST_ARGS) --unit + +.PHONY: stest +stest: FORCE + $(PYTHON) ./run_slim_py_tests $(TEST_ARGS) --sys + +.PHONY: lint +lint: FORCE + $(PYLINT) $(PYLINT_ARGS) $(PYLINT_SRC) + +.PHONY: black +# Run black on all of the python files here and undeneath. +# Use the black configure file to explicitly set a few things and specifiy the exact files. +black: FORCE + black --check --config pyproject.toml . + +.PHONY: clean +clean: FORCE + find . -name '*.pyc' -exec rm {} \; + +FORCE: + diff --git a/python/README.md b/python/README.md new file mode 100644 index 00000000..2593da1b --- /dev/null +++ b/python/README.md @@ -0,0 +1,37 @@ +# Testing the code here + +## Running everything + +To run all tests (unit tests, system tests and pylint), simply run `make +all` from this directory. + +## Unit and system tests + +Unit and system tests can be run in one of two ways; these do the same +thing, but support different options: + +1. via `make test` + + You can specify a few arguments to this: + + - python version: `make python=python3.9 test` (defaults to `python3`; you should expect errors if trying to run with python2) + - verbose: `make verbose=true test` + - debug: `make debug=true test` + + Note that unit tests and system tests can be run separately with + `make utest` or `make stest`, or they can all be run with `make + test`. + +2. via `./run_slim_py_tests` + + You can specify various arguments to this; run `./run_slim_py_tests + -h` for details + +## pylint + +You can run pylint on everything in the slim package with `make lint`. + +## black + +You can run black on everything in the slim package with `make black`. + diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 00000000..085dfc1e --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,13 @@ +# +# This is a configuration file for python projects. +# Sepcifically covering build system requirements. +# +# Here we are just using a couple options to specify the operation +# of the python formatter "black". +# +[tool.black] + + line-length = 88 # This is the black default + target-version = ['py37'] + include = '(run_slim_py_tests|\.py$)' # Files to include + exclude = '(\.pylintrc|\.pyc)' # Files to explicitly exclude pylint file and compiled python diff --git a/python/run_slim_py_tests b/python/run_slim_py_tests new file mode 100755 index 00000000..e609b318 --- /dev/null +++ b/python/run_slim_py_tests @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +"""Driver for running the unit tests of the python code + +We use this rather than simply relying on 'python -m unittest discover' so we can do some +initial setup, like configuring logging, before running the unit tests. +""" + +from slim import add_cime_to_path +from slim.run_slim_py_tests import main + +if __name__ == "__main__": + main(__doc__) diff --git a/python/slim/.pylintrc b/python/slim/.pylintrc new file mode 100644 index 00000000..bc7ae54d --- /dev/null +++ b/python/slim/.pylintrc @@ -0,0 +1,572 @@ +[MASTER] + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-whitelist= + +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS + +# Add files or directories matching the regex patterns to the blacklist. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use. +jobs=1 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins= + +# Pickle collected data for later comparisons. +persistent=yes + +# Specify a configuration file. +#rcfile= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=print-statement, + parameter-unpacking, + unpacking-in-except, + old-raise-syntax, + backtick, + long-suffix, + old-ne-operator, + old-octal-literal, + import-star-module-level, + non-ascii-bytes-literal, + raw-checker-failed, + bad-inline-option, + locally-disabled, + locally-enabled, + file-ignored, + suppressed-message, + useless-suppression, + deprecated-pragma, + use-symbolic-message-instead, + apply-builtin, + basestring-builtin, + buffer-builtin, + cmp-builtin, + coerce-builtin, + execfile-builtin, + file-builtin, + long-builtin, + raw_input-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + no-absolute-import, + old-division, + dict-iter-method, + dict-view-method, + next-method-called, + metaclass-assignment, + indexing-exception, + raising-string, + reload-builtin, + oct-method, + hex-method, + nonzero-method, + cmp-method, + input-builtin, + round-builtin, + intern-builtin, + unichr-builtin, + map-builtin-not-iterating, + zip-builtin-not-iterating, + range-builtin-not-iterating, + filter-builtin-not-iterating, + using-cmp-argument, + eq-without-hash, + div-method, + idiv-method, + rdiv-method, + exception-message-attribute, + invalid-str-codec, + sys-max-int, + bad-python3-import, + deprecated-string-function, + deprecated-str-translate-call, + deprecated-itertools-function, + deprecated-types-field, + next-method-defined, + dict-items-not-iterating, + dict-keys-not-iterating, + dict-values-not-iterating, + deprecated-operator-function, + deprecated-urllib-function, + xreadlines-attribute, + deprecated-sys-function, + exception-escape, + comprehension-escape, + C0330, # This is an option that the formatter "black" requires us to disable +# --- default list is above here, our own list is below here --- +# While pylint's recommendations to keep the number of arguments, local +# variables and branches low is generally a good one, I don't want it to +# be enforced, because there are times when it's okay to break these: + too-many-arguments, + too-many-branches, + too-many-locals, +# Allow inheriting from object for the sake of python 2/3 compatibility (we need explicit inheritance from object in python2 to give new-style classes): + useless-object-inheritance + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +enable=c-extension-no-member + + +[REPORTS] + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +output-format=text + +# Tells whether to display a full report or only the messages. +reports=no + +# Activate the evaluation score. +score=yes + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit + + +[LOGGING] + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package.. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX +# Removing TODO so we can use that to note long-term to do items + # TODO + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members= + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +ignore-mixin-members=yes + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid to define new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore. +ignored-argument-names=_.*|^ignored_|^unused_ + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format= + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=100 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# List of optional constructs for which whitespace checking is disabled. `dict- +# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. +# `trailing-comma` allows a space between comma and closing bracket: (a, ). +# `empty-line` allows space-only lines. +no-space-check=trailing-comma, + dict-separator + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. +#class-attribute-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=UPPER_CASE + +# Regular expression matching correct constant names. Overrides const-naming- +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=i, + j, + k, + ex, + Run, + _, +# --- default list is above here, our own list is below here --- +# Allow logger as a global name in each module, because this seems to follow general recommended convention: + logger + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=no + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. +#variable-rgx= + + +[IMPORTS] + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=no + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules=optparse,tkinter.tix + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled). +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled). +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library= + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls + + +[DESIGN] + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement. +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. Defaults to +# "Exception". +overgeneral-exceptions=Exception diff --git a/python/slim/__init__.py b/python/slim/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/python/slim/add_cime_to_path.py b/python/slim/add_cime_to_path.py new file mode 100644 index 00000000..c1cc8a7f --- /dev/null +++ b/python/slim/add_cime_to_path.py @@ -0,0 +1,25 @@ +"""Adds cime lib to path + +Any file that can potentially be run as a top-level script (with an if __name__ == +'__main__' block) that needs cime should import this. This includes unit test +modules. However: see the NOTE at the bottom of this documentation. + +This should be the very first slim module imported. That way, cime will be added to your +path before other imports. That is, your script should have: + +# Standard library imports go here +# Then something like this: +_SLIM_PYTHON = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'python') +sys.path.insert(1, _SLIM_PYTHON) +# Then: +from slim import add_cime_to_path + +NOTE: For top-level scripts that either (a) want to pass some argument(s) to +add_cime_lib_to_path, or (b) want to store the returned value from add_cime_lib_to_path: +they should include copies of what's in this module (adding the appropriate argument(s)), +rather than actually importing this module. So this module should be viewed as a +convenience that can be used by scripts with simple needs, but does not need to be used. +""" + +from slim.path_utils import add_cime_lib_to_path +_ = add_cime_lib_to_path() diff --git a/python/slim/path_utils.py b/python/slim/path_utils.py new file mode 100644 index 00000000..d1e5c7a3 --- /dev/null +++ b/python/slim/path_utils.py @@ -0,0 +1,104 @@ +"""Utility functions related to getting paths to various important places +""" + +from __future__ import print_function + +import os +import sys + +# ======================================================================== +# Constants that may need to be changed if directory structures change +# ======================================================================== + +# Path to the root directory of SLIM, based on the path of this file +# +# Note: It's important that this NOT end with a trailing slash; +# os.path.normpath guarantees this. +_SLIM_ROOT = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), + os.pardir, + os.pardir)) + +# Candidates for the last path components to the SLIM directory within a +# CESM checkout +_CESM_SLIM_PATHS = [os.path.join('components', 'slim') ] + +# ======================================================================== +# Public functions +# ======================================================================== + +def path_to_slim_root(): + """Returns the path to the root directory of SLIM""" + return _SLIM_ROOT + +def path_to_cime(standalone_only=False): + """Returns the path to cime, if it can be found + + Raises a RuntimeError if it cannot be found + + We first check in the location where cime should be in a standalone + checkout. If standalone_only is True, then we ONLY look for cime in + that location. If standalone_only is False, then we fall back to + checking where cime should be in a full CESM checkout. + """ + cime_standalone_path = os.path.join(path_to_slim_root(), 'cime') + if os.path.isdir(cime_standalone_path): + return cime_standalone_path + + if standalone_only: + raise RuntimeError("Cannot find cime within standalone SLIM checkout") + + cesm_path = _path_to_cesm_root() + if cesm_path is None: + raise RuntimeError("Cannot find cime within standalone SLIM checkout, " + "and we don't seem to be within a CESM checkout.") + + cime_in_cesm_path = os.path.join(cesm_path, 'cime') + if os.path.isdir(cime_in_cesm_path): + return cime_in_cesm_path + + raise RuntimeError("Cannot find cime within standalone SLIM checkout, " + "or within CESM checkout rooted at {}".format(cesm_path)) + +def prepend_to_python_path(path): + """Adds the given path to python's sys.path if it isn't already in the path + + The path is added near the beginning, so that it takes precedence over existing + entries in the path + """ + if not path in sys.path: + # Insert at location 1 rather than 0, because 0 is special + sys.path.insert(1, path) + +def add_cime_lib_to_path(standalone_only=False): + """Adds the CIME python library to the python path, to allow importing + modules from that library + + Returns the path to the top-level cime directory + + For documentation on standalone_only: See documentation in + path_to_cime + """ + cime_path = path_to_cime(standalone_only=standalone_only) + cime_lib_path = os.path.join(cime_path, + 'scripts', 'lib') + prepend_to_python_path(cime_lib_path) + cime_lib_path = os.path.join(cime_path, + 'scripts', 'Tools') + prepend_to_python_path(cime_lib_path) + return cime_path + +# ======================================================================== +# Private functions +# ======================================================================== + +def _path_to_cesm_root(): + """Returns the path to the root directory of CESM, if we appear to + be inside a CESM checkout. If we don't appear to be inside a CESM + checkout, then returns None. + """ + slim_root = path_to_slim_root() + for candidate_path in _CESM_SLIM_PATHS: + if slim_root.endswith(candidate_path): + return os.path.normpath(slim_root[:-len(candidate_path)]) + + return None diff --git a/python/slim/run_slim_py_tests.py b/python/slim/run_slim_py_tests.py new file mode 100644 index 00000000..1ebc560a --- /dev/null +++ b/python/slim/run_slim_py_tests.py @@ -0,0 +1,84 @@ +"""Runner for the python unit tests defined here + +This is the main implementation of the run_slim_py_tests script contained in the +parent directory +""" + +import unittest +import os +import argparse +import logging +from slim import unit_testing + +logger = logging.getLogger(__name__) + +def main(description): + """Main function called when run_tests is run from the command-line + + Args: + description (str): description printed to usage message + """ + args = _commandline_args(description) + verbosity = _get_verbosity_level(args) + + if args.pattern is not None: + pattern = args.pattern + elif args.unit: + pattern = 'test_unit*.py' + elif args.sys: + pattern = 'test_sys*.py' + else: + pattern = 'test*.py' + + # This setup_for_tests call is the main motivation for having this wrapper script to + # run the tests rather than just using 'python -m unittest discover' + unit_testing.setup_for_tests(enable_critical_logs=args.debug) + + mydir = os.path.dirname(os.path.abspath(__file__)) + testsuite = unittest.defaultTestLoader.discover( + start_dir=mydir, + pattern=pattern) + # NOTE(wjs, 2018-08-29) We may want to change the meaning of '--debug' + # vs. '--verbose': I could imagine having --verbose set buffer=False, and --debug + # additionally sets the logging level to much higher - e.g., debug level. + testrunner = unittest.TextTestRunner(buffer=(not args.debug), + verbosity=verbosity) + testrunner.run(testsuite) + +def _commandline_args(description): + """Parse and return command-line arguments + """ + parser = argparse.ArgumentParser( + description=description, + formatter_class=argparse.RawTextHelpFormatter) + + output_level = parser.add_mutually_exclusive_group() + + output_level.add_argument('-v', '--verbose', action='store_true', + help='Run tests with more verbosity') + + output_level.add_argument('-d', '--debug', action='store_true', + help='Run tests with even more verbosity') + + test_subset = parser.add_mutually_exclusive_group() + + test_subset.add_argument('-u', '--unit', action='store_true', + help='Only run unit tests') + + test_subset.add_argument('-s', '--sys', action='store_true', + help='Only run system tests') + + test_subset.add_argument('-p', '--pattern', + help='File name pattern to match\n' + 'Default is test*.py') + + args = parser.parse_args() + + return args + +def _get_verbosity_level(args): + if args.debug or args.verbose: + verbosity = 2 + else: + verbosity = 1 + return verbosity diff --git a/python/slim/slim_logging.py b/python/slim/slim_logging.py new file mode 100644 index 00000000..dcbc2531 --- /dev/null +++ b/python/slim/slim_logging.py @@ -0,0 +1,98 @@ +"""Utilities to facilitate logging + +A guide to logging in slim python scripts: + +- At the top of each module, you should have: + logger = logging.getLogger(__name__) + +- Logging should be done via that logger, NOT via logging.[whatever] + +- If you want to allow the user to control logging via command-line arguments, you should: + + (1) At the very start of a script / application, call setup_logging_pre_config(). (We + need to initialize logging to avoid errors from logging calls made very early in the + script.) + + (2) When setting up the argument parser, call add_logging_args(parser) + + (3) After parsing arguments, call process_logging_args(args) + +- If you don't want to allow the user to control logging via command-line arguments, then + simply: + + (1) At the very start of a script / application, call setup_logging() with the desired + arguments + +- In unit tests, to avoid messages about loggers not being set up, you should call + setup_logging_for_tests (this is typically done via unit_testing.setup_for_tests) +""" + +import logging + +logger = logging.getLogger(__name__) + + +def setup_logging_pre_config(): + """Setup logging for a script / application + + This function should be called at the very start of a script / application where you + intend to allow the user to control logging preferences via command-line arguments. + + This sets initial options that may be changed later by process_logging_args. + """ + setup_logging(level=logging.WARNING) + + +def setup_logging_for_tests(enable_critical=False): + """Setup logging as appropriate for unit tests""" + setup_logging(level=logging.CRITICAL) + if not enable_critical: + logging.disable(logging.CRITICAL) + + +def setup_logging(level=logging.WARNING): + """Setup logging for a script / application + + This function should be called at the very start of a script / application where you + do NOT intend to allow the user to control logging preferences via command-line + arguments, so that all of the final logging options are set here. + """ + logging.basicConfig(format="%(levelname)s: %(message)s", level=level) + + +def add_logging_args(parser): + """Add common logging-related options to the argument parser""" + + logging_level = parser.add_mutually_exclusive_group() + + logging_level.add_argument( + "-v", "--verbose", action="store_true", help="Output extra logging info" + ) + + logging_level.add_argument( + "--debug", + action="store_true", + help="Output even more logging info for debugging", + ) + + +def process_logging_args(args): + """Configure logging based on the logging-related args added by add_logging_args""" + root_logger = logging.getLogger() + + if args.debug: + root_logger.setLevel(logging.DEBUG) + elif args.verbose: + root_logger.setLevel(logging.INFO) + else: + root_logger.setLevel(logging.WARNING) + + +def output_to_file(file_path, message, log_to_logger=False): + """ + helper function to write to log file. + """ + with open(file_path, "a") as log_file: + log_file.write(message) + if log_to_logger: + logger.info(message) diff --git a/python/slim/test/README b/python/slim/test/README new file mode 100644 index 00000000..2dc5ef53 --- /dev/null +++ b/python/slim/test/README @@ -0,0 +1,23 @@ +SLIM-specific boiler-plate needed for most unit test modules: + +(1) If cime stuff is invoked by these unit tests (directly or + indirectly, then: the first slim import statement near the top of + the module should be: + +from slim import add_cime_to_path # pylint: disable=unused-import + +(2) Import the slim-specific unit_testing module: + +from slim import unit_testing + +(3) Allow names that pylint doesn't like: + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + +(4) Have a 'main' block at the bottom: + +if __name__ == '__main__': + unit_testing.setup_for_tests() + unittest.main() diff --git a/python/slim/test/__init__.py b/python/slim/test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/python/slim/unit_testing.py b/python/slim/unit_testing.py new file mode 100644 index 00000000..7d8f4017 --- /dev/null +++ b/python/slim/unit_testing.py @@ -0,0 +1,14 @@ +"""Functions to aid unit tests""" + +from ctsm.ctsm_logging import setup_logging_for_tests + +def setup_for_tests(enable_critical_logs=False): + """Call this at the beginning of unit testing + + Does various setup that would normally be done by the top-level application/script + + Args: + enable_critical_logs (bool): If True, then critical logging messages will be output; + if False, then even critical messages will be suppressed + """ + setup_logging_for_tests(enable_critical_logs) diff --git a/python/slim/utils.py b/python/slim/utils.py new file mode 100644 index 00000000..f29ccd13 --- /dev/null +++ b/python/slim/utils.py @@ -0,0 +1,22 @@ +"""General-purpose utility functions""" + +import logging +import os +import sys +import string +import pdb + +from datetime import date +from getpass import getuser + +logger = logging.getLogger(__name__) + +def abort(errmsg): + """Abort the program with the given error message + + No traceback is given, but if the logging level is DEBUG, then we'll enter pdb + """ + if logger.isEnabledFor(logging.DEBUG): + pdb.set_trace() + + sys.exit("ERROR: {}".format(errmsg)) From ef6f1f917e61a08d898156cf014ab3213134811a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 Jul 2022 10:43:24 -0600 Subject: [PATCH 034/164] Correct name of python directory for buildnml source --- cime_config/buildnml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 59dbd4c3..059f4811 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -15,7 +15,7 @@ sys.path.append(_LIBDIR) from standard_script_setup import * from CIME.buildnml import parse_input from CIME.case import Case -from slim_cime import buildnml +from slim_cime_py import buildnml ############################################################################### def _main_func(): From 7cd3140b1fd7fea3024830abcc7cbf170442b695 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 Jul 2022 15:26:08 -0600 Subject: [PATCH 035/164] Black reformat --- cime_config/slim_cime_py/buildnml.py | 34 +++++++++++----------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index c5b2b2c4..db4914c7 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -1,7 +1,9 @@ """ SLIM namelist creator """ -import sys, os, shutil +import sys +import os +import shutil _CIMEROOT = os.environ.get("CIMEROOT") _LIBDIR = os.path.join(_CIMEROOT, "scripts", "Tools") @@ -32,9 +34,7 @@ def check_nml_dtime(nmlgen, case): if case.get_value("CALENDAR") == "NO_LEAP": basedt = 3600 * 24 * 365 else: - expect( - False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period - ) + expect(False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period) elif ncpl_base_period == "decade": if case.get_value("CALENDAR") == "NO_LEAP": basedt = 3600 * 24 * 365 * 10 @@ -44,16 +44,12 @@ def check_nml_dtime(nmlgen, case): "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period, ) else: - expect( - False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period - ) + expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period) logger.info(" basedt = " + str(basedt)) if basedt < 0: - expect( - False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " % ncpl_base_period - ) + expect(False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " % ncpl_base_period) lnd_ncpl = int(case.get_value("LND_NCPL")) if basedt % lnd_ncpl != 0: @@ -115,9 +111,7 @@ def check_nml_initial_conditions(nmlgen, case): finidat = nmlgen.get_value("finidat") logger.info(" finidat = " + finidat) if finidat != "UNSET": - raise SystemExit( - "finidat is set but SLIM_START_TYPE is cold which is a contradiction" - ) + raise SystemExit("finidat is set but SLIM_START_TYPE is cold which is a contradiction") nmlgen.set_value("finidat", value=" ") @@ -223,9 +217,7 @@ def buildnml(case, caseroot, compname): # ---------------------------------------------------- # Clear out old data list # ---------------------------------------------------- - data_list_path = os.path.join( - case.get_case_root(), "Buildconf", "slim.input_data_list" - ) + data_list_path = os.path.join(case.get_case_root(), "Buildconf", "slim.input_data_list") if os.path.exists(data_list_path): os.remove(data_list_path) @@ -244,8 +236,10 @@ def buildnml(case, caseroot, compname): if slim_force_coldstart == "on": slim_force_coldstart = "off" logger.warning( - "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" - + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" + "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type," + + " which is a contradiction, the coldstart will be ignored\n" + + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid" + + " to get rid of this warning" ) if slim_force_coldstart == "on": @@ -318,9 +312,7 @@ def buildnml(case, caseroot, compname): namelist_infile = [infile] # create namelist - _create_namelists( - case, confdir, inst_string, namelist_infile, nmlgen, data_list_path - ) + _create_namelists(case, confdir, inst_string, namelist_infile, nmlgen, data_list_path) # ----------------------------------------------------- # copy resolved namelist to rundir # ----------------------------------------------------- From ada0f9a5bce35ee3238b9a26168d6395fd4bea50 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 29 Jul 2022 17:05:04 -0600 Subject: [PATCH 036/164] Add python conda environment files to setup conda environments in order to run pylint and black on the python code in SLIM --- py_env_create | 136 +++++++++++++++++++++++++++++++ python/conda_env_slim_py.txt | 11 +++ python/conda_env_slim_py_cgd.txt | 12 +++ 3 files changed, 159 insertions(+) create mode 100755 py_env_create create mode 100644 python/conda_env_slim_py.txt create mode 100644 python/conda_env_slim_py_cgd.txt diff --git a/py_env_create b/py_env_create new file mode 100755 index 00000000..648f1e70 --- /dev/null +++ b/py_env_create @@ -0,0 +1,136 @@ +#!/bin/bash +# +# py_env_create -- setup the python environment in order to use SLIM python tools +# +# Simple bash script to setup the python environment for the user so they can run the SLIM +# python tools using "conda". +# +dir=${0%/*} +if [ "$dir" = "$0" ];then + dir="." +fi + +# Check if conda is in your path +conda --help >& condahelp.txt +error=$? +if [ $error != 0 ]; then + echo "conda is NOT in your path for the bash shell add it with modules or whatever is required on your system to get it in your path" + echo "on cheyenne/capser/etc use -- module load conda" + echo "on izumi/CGD systems use -- module load lang/python" + echo "For notes on installing on a user system see: https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html" + echo "Error code was $error" + cat condahelp.txt + exit -1 +fi +rm condahelp.txt +python_env=slim_pylib + + +condadir="$dir/python" + +domain=`domainname` +if [[ $domain =~ cgd.* ]]; then + condafile="conda_env_slim_py_cgd.txt" +else + condafile="conda_env_slim_py.txt" +fi +#---------------------------------------------------------------------- +# Usage subroutine +usage() { + echo "" + echo "***********************************************************************" + echo "usage:" + echo "./py_env_create" + echo "" + echo "valid arguments: " + echo "[-h|--help] " + echo " Displays this help message" + echo "[-v|--verbose] " + echo " Run with verbose mode for the install so you see the progress bar" + echo "[-f|--file ] " + echo " Conda environment file to use (can be a text format or YAML format)" + echo " Assumed to be under the directory: $condadir" + echo " Default is: $condafile" + echo "[--option diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 025befcb..151d7bb4 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -23,6 +23,7 @@ check_nml_general, check_nml_history, check_nml_data, + check_nml_initial_conditions, ) logger = logging.getLogger(__name__) @@ -60,14 +61,14 @@ def setUp(self): # ------------------------------------------------------ # Create config dictionary # ------------------------------------------------------ - config = {} - config["lnd_grid"] = self.case.get_value("LND_GRID") - config["slim_scenario"] = "1850_control" + self.config = {} + self.config["lnd_grid"] = self.case.get_value("LND_GRID") + self.config["slim_scenario"] = "1850_control" # ------------------------------------------------------ # Initialize namelist defaults # ------------------------------------------------------ - self.nmlgen.init_defaults(infiles=[], config=config) + self.nmlgen.init_defaults(infiles=[], config=self.config) def tearDown(self): """Finalize""" @@ -97,12 +98,11 @@ def test_check_nml_general(self): def test_check_nml_data(self): """Test the check nml data subroutine""" self.nmlgen.set_value("res", self.case.get_value("LND_GRID")) - config = {} # Loop through the scenarios that we have datasets for - config["lnd_grid"] = "1.9x2.5" + self.config["lnd_grid"] = "1.9x2.5" for scen in ("global_uniform", "realistic_from_1850", "realistic_from_2000"): - config["slim_scenario"] = scen - self.nmlgen.init_defaults(infiles=[], config=config) + self.config["slim_scenario"] = scen + self.nmlgen.init_defaults(infiles=[], config=self.config) check_nml_data(self.nmlgen) # make the dataset unset and make sure it fails @@ -111,6 +111,30 @@ def test_check_nml_data(self): with self.assertRaisesRegex(SystemExit, var + " file is NOT set and is required"): check_nml_data(self.nmlgen) + def test_check_init_data(self): + """Test the check nml initial data subroutine""" + check_nml_initial_conditions(self.nmlgen, self.case) + # A cold start should have a blank finidat file + self.case.set_value("SLIM_START_TYPE", "cold") + self.nmlgen.init_defaults(infiles=[], config=self.config) + check_nml_initial_conditions(self.nmlgen, self.case) + val = self.nmlgen.get_value("finidat") + expect("' '", val) + # If you have a cold-start and explicitly set the finidat file that should error out + self.nmlgen.set_value("finidat", "file_is_set.nc") + with self.assertRaisesRegex( + SystemExit, "finidat is set but SLIM_START_TYPE is cold which is a contradiction" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + # Set to startup so that finidat is required + self.case.set_value("SLIM_START_TYPE", "startup") + self.nmlgen.init_defaults(infiles=[], config=self.config) + self.nmlgen.set_value("finidat", "file_is_set.nc") + check_nml_initial_conditions(self.nmlgen, self.case) + # Don't set the IC file, so make sure it aborts + self.nmlgen.set_value("finidat", "UNSET") + check_nml_initial_conditions(self.nmlgen, self.case) + if __name__ == "__main__": unit_testing.setup_for_tests() From b3a81e96d16cdc06dda717951503b83f8dac562b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Aug 2022 11:05:41 -0600 Subject: [PATCH 053/164] Add some more checks for initial_conditions for branch and hybrid cases --- python/slim/test/test_unit_buildnml.py | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 151d7bb4..61360c55 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -51,6 +51,7 @@ def setUp(self): expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) self.case = FakeCase(compiler=None, mpilib=None, debug=None) + self.case.set_value("RUN_TYPE", "startup") self.case.set_value("DIN_LOC_ROOT", ".") self.case.set_value("LND_DOMAIN_PATH", ".") self.case.set_value("LND_DOMAIN_FILE", "domain.nc") @@ -114,6 +115,10 @@ def test_check_nml_data(self): def test_check_init_data(self): """Test the check nml initial data subroutine""" check_nml_initial_conditions(self.nmlgen, self.case) + + # + # Check that normal startup acts as expected + # # A cold start should have a blank finidat file self.case.set_value("SLIM_START_TYPE", "cold") self.nmlgen.init_defaults(infiles=[], config=self.config) @@ -134,6 +139,34 @@ def test_check_init_data(self): # Don't set the IC file, so make sure it aborts self.nmlgen.set_value("finidat", "UNSET") check_nml_initial_conditions(self.nmlgen, self.case) + # Make sure nrevsn can't be set + self.nmlgen.set_value("nrevsn", "file_is_set.nc") + with self.assertRaisesRegex( + SystemExit, "nrevsn is set but RUN_TYPE is NOT branch which is a contradiction" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + # + # Check that a branch works correctly + # + self.case.set_value("RUN_TYPE", "branch") + self.nmlgen.set_value("nrevsn", "file_is_set.nc") + check_nml_initial_conditions(self.nmlgen, self.case) + # Make sure finidat can't be set + self.nmlgen.set_value("finidat", "file_is_set.nc") + with self.assertRaisesRegex( + SystemExit, "finidat is set but RUN_TYPE is branch which is a contradiction" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + # + # Check that a hybrid works correctly + # + self.case.set_value("RUN_TYPE", "hybrid") + self.nmlgen.set_value("finidat", "file_is_set.nc") + check_nml_initial_conditions(self.nmlgen, self.case) + # Make sure will die if finidat is NOT set + self.nmlgen.set_value("finidat", "UNSET") + with self.assertRaisesRegex(SystemExit, "finidat is required for a hybrid RUN_TYPE"): + check_nml_initial_conditions(self.nmlgen, self.case) if __name__ == "__main__": From 912f6281cce86c42b9edc74b5736b2a578ce0a6f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 31 Aug 2022 17:08:35 -0600 Subject: [PATCH 054/164] Initial add of sys test for buildnml --- python/slim/test/test_sys_buildnml.py | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 python/slim/test/test_sys_buildnml.py diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py new file mode 100755 index 00000000..7469ffac --- /dev/null +++ b/python/slim/test/test_sys_buildnml.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 + +"""System tests for buildnml +""" + +import unittest +import tempfile +import shutil +import os +import logging + +from CIME.BuildTools.configure import FakeCase +from CIME.utils import expect + +# pylint: disable=wrong-import-order,unused-import +from slim import add_slim_cime_py_to_path +from slim import unit_testing + +from slim_cime_py.buildnml import buildnml + +logger = logging.getLogger(__name__) + +# Allow names that pylint doesn't like, because otherwise I find it hard +# to make readable unit test names +# pylint: disable=invalid-name + + +class TestBuildNML(unittest.TestCase): + """System Tests of buildnml""" + + def setUp(self): + """Initialize""" + self._testdir = tempfile.mkdtemp() + # namelist definition file + lnd_root = os.path.normpath( + os.path.join( + os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, os.pardir + ) + ) + self.case = FakeCase(compiler=None, mpilib=None, debug=None) + self.case.set_value("CASEROOT", self._testdir) + self.case.set_value("RUN_TYPE", "startup") + self.case.set_value("RUN_STARTDATE", "2000-01-01") + self.case.set_value("RUN_REFCASE", "case.std") + self.case.set_value("RUN_REFDATE", "0001-01-01") + self.case.set_value("RUN_REFTOD", "00000") + self.case.set_value("RUN_REFDIR", "cesm2_init") + self.case.set_value("RUNDIR", ".") + self.case.set_value("NINST_LND", 1) + self.case.set_value("NCPL_BASE_PERIOD", "day") + self.case.set_value("LND_NCPL", 48) + self.case.set_value("SLIM_FORCE_COLDSTART", "off") + self.case.set_value("SLIM_SCENARIO", "global_uniform") + self.case.set_value("COMP_ROOT_DIR_LND", lnd_root) + self.case.set_value("DIN_LOC_ROOT", ".") + self.case.set_value("LND_DOMAIN_PATH", ".") + self.case.set_value("LND_DOMAIN_FILE", "domain.nc") + self.case.set_value("SLIM_START_TYPE", "cold") + self.case.set_value("LND_GRID", "0.9x1.25") + + def tearDown(self): + """Finalize""" + shutil.rmtree(self._testdir, ignore_errors=True) + + def test_simple(self): + """Test a simple call of buildnml""" + buildnml(self.case, self._testdir, "slim") + + +if __name__ == "__main__": + unit_testing.setup_for_tests() + unittest.main() From 0ce350e8f17d3827d8b55e0ce2e406fd12a716bb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 1 Sep 2022 16:06:55 -0600 Subject: [PATCH 055/164] Set resolution for system test to f19 so that the test will run --- python/slim/test/test_sys_buildnml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 7469ffac..b5d68874 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -56,7 +56,7 @@ def setUp(self): self.case.set_value("LND_DOMAIN_PATH", ".") self.case.set_value("LND_DOMAIN_FILE", "domain.nc") self.case.set_value("SLIM_START_TYPE", "cold") - self.case.set_value("LND_GRID", "0.9x1.25") + self.case.set_value("LND_GRID", "1.9x2.5") def tearDown(self): """Finalize""" From 364996fc1c58812fa9035bb141951fd0e937b4df Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 1 Sep 2022 16:32:39 -0600 Subject: [PATCH 056/164] Change directory to testdir and out after done, and add checks that the files are created as expected --- python/slim/test/test_sys_buildnml.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index b5d68874..e0810263 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -31,6 +31,8 @@ class TestBuildNML(unittest.TestCase): def setUp(self): """Initialize""" self._testdir = tempfile.mkdtemp() + self.curdir = os.getcwd() + os.chdir(self._testdir) # namelist definition file lnd_root = os.path.normpath( os.path.join( @@ -60,11 +62,22 @@ def setUp(self): def tearDown(self): """Finalize""" + os.chdir(self.curdir) shutil.rmtree(self._testdir, ignore_errors=True) def test_simple(self): """Test a simple call of buildnml""" buildnml(self.case, self._testdir, "slim") + print(os.listdir("Buildconf")) + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) if __name__ == "__main__": From 0258be36fd1a34209645f53392982a97945ad040 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Sep 2022 02:01:17 -0600 Subject: [PATCH 057/164] Add checks for hybrid and branch startup and also make sure that finidat or nrevsn is set correctly in the namelist file for these cases --- python/slim/test/test_sys_buildnml.py | 57 ++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index e0810263..04966f3a 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -7,6 +7,7 @@ import tempfile import shutil import os +import re import logging from CIME.BuildTools.configure import FakeCase @@ -65,10 +66,24 @@ def tearDown(self): os.chdir(self.curdir) shutil.rmtree(self._testdir, ignore_errors=True) + def getVariableFromNML(self, nmlfile, variable): + """Get a variable from the namelist file""" + with open(nmlfile,"r") as nfile: + for line in nfile: + if ( variable in line ): + print( line ) + match = re.search( '= ["]*([a-zA-Z0-9._//-]+)["]*', line ) + if ( match != None ): + return( match.group(1) ) + else: + match = re.search( "= [']*([a-zA-Z0-9._//-]+)[']*", line ) + if ( match != None ): + return( match.group(1) ) + return( None ) + def test_simple(self): """Test a simple call of buildnml""" buildnml(self.case, self._testdir, "slim") - print(os.listdir("Buildconf")) expect( os.path.isfile("Buildconf/slimconf/lnd_in"), "Namelist file lnd_in should exist in Buildconf after running buildnml", @@ -79,6 +94,46 @@ def test_simple(self): "Input data list file should exist after running buildnml", ) + def test_hybrid_start(self): + """Test a hybrid startup call of buildnml""" + self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("RUN_TYPE", "hybrid") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + self.case.set_value("RUN_REFTOD", "00000") + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + value = self.getVariableFromNML("lnd_in", "finidat") + self.assertEqual( value, "./TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" ) + + def test_branch_start(self): + """Test a branch startup call of buildnml""" + self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("RUN_TYPE", "branch") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + self.case.set_value("RUN_REFTOD", "00000") + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + value = self.getVariableFromNML("lnd_in", "nrevsn") + self.assertEqual( value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="nrevsn not set as expected" ) + if __name__ == "__main__": unit_testing.setup_for_tests() From f9f3ed14aab477bc7d5fad38dec4fb03d63fc26c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Sep 2022 11:16:08 -0600 Subject: [PATCH 058/164] Some black and lint changes, also add a run_black target to the Makefile that will change the python source, and remove mention of github actions leftover from copying from CTSM --- python/Makefile | 11 ++++++++- python/conda_env_slim_py_cgd.txt | 2 +- python/slim/test/test_sys_buildnml.py | 32 +++++++++++++++------------ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/python/Makefile b/python/Makefile index e38cf7e4..c747736f 100644 --- a/python/Makefile +++ b/python/Makefile @@ -40,11 +40,20 @@ lint: FORCE $(PYLINT) $(PYLINT_ARGS) $(DIR_SRC) .PHONY: black -# Run black on all of the python files here and undeneath. +# Run black check on all of the python files here and undeneath. +# Should be identical to run_black option below, other than the --check option added in # Use the black configure file to explicitly set a few things and specifiy the exact files. black: FORCE black --check --config pyproject.toml $(DIR_SRC) +.PHONY: run_black +# Run black on all of the python files here and undeneath -- CHANGING THE FILES! +# Should be identical to above, other than the "--check" option is removed. +# Use the black configure file to explicitly set a few things and specifiy the exact files. +run_black: FORCE + black --config pyproject.toml $(DIR_SRC) + + .PHONY: clean clean: FORCE find . -name '*.pyc' -exec rm {} \; diff --git a/python/conda_env_slim_py_cgd.txt b/python/conda_env_slim_py_cgd.txt index 9af73a20..0a2ff073 100644 --- a/python/conda_env_slim_py_cgd.txt +++ b/python/conda_env_slim_py_cgd.txt @@ -9,4 +9,4 @@ # python=3.7.0 # The python version MUST match the python version available on CGD systems through modules exactly pylint=2.8.3 -black=22.6.0 # NOTE: The version here needs to be coordinated with the black github action under ../.github/workflows +black=22.6.0 diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 04966f3a..b63b70d7 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -68,18 +68,18 @@ def tearDown(self): def getVariableFromNML(self, nmlfile, variable): """Get a variable from the namelist file""" - with open(nmlfile,"r") as nfile: - for line in nfile: - if ( variable in line ): - print( line ) - match = re.search( '= ["]*([a-zA-Z0-9._//-]+)["]*', line ) - if ( match != None ): - return( match.group(1) ) - else: - match = re.search( "= [']*([a-zA-Z0-9._//-]+)[']*", line ) - if ( match != None ): - return( match.group(1) ) - return( None ) + with open(nmlfile, "r") as nfile: + for line in nfile: + if variable in line: + print(line) + match = re.search('= ["]*([a-zA-Z0-9._//-]+)["]*', line) + if match is not None: + return match.group(1) + else: + match = re.search("= [']*([a-zA-Z0-9._//-]+)[']*", line) + if match is not None: + return match.group(1) + return None def test_simple(self): """Test a simple call of buildnml""" @@ -112,7 +112,9 @@ def test_hybrid_start(self): "Input data list file should exist after running buildnml", ) value = self.getVariableFromNML("lnd_in", "finidat") - self.assertEqual( value, "./TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" ) + self.assertEqual( + value, "./TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" + ) def test_branch_start(self): """Test a branch startup call of buildnml""" @@ -132,7 +134,9 @@ def test_branch_start(self): "Input data list file should exist after running buildnml", ) value = self.getVariableFromNML("lnd_in", "nrevsn") - self.assertEqual( value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="nrevsn not set as expected" ) + self.assertEqual( + value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="nrevsn not set as expected" + ) if __name__ == "__main__": From 23be63cb735cba1a146aac840268ab57732d95a5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 2 Sep 2022 13:17:12 -0600 Subject: [PATCH 059/164] Loop over each scenario types --- python/slim/test/test_sys_buildnml.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index b63b70d7..55a08b5d 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -83,16 +83,18 @@ def getVariableFromNML(self, nmlfile, variable): def test_simple(self): """Test a simple call of buildnml""" - buildnml(self.case, self._testdir, "slim") - expect( - os.path.isfile("Buildconf/slimconf/lnd_in"), - "Namelist file lnd_in should exist in Buildconf after running buildnml", - ) - expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") - expect( - os.path.isfile("Buildconf/slim.input_data_list"), - "Input data list file should exist after running buildnml", - ) + for scenario in ("global_uniform", "realistic_from_1850", "realistic_from_2000" ): + self.case.set_value("SLIM_SCENARIO", scenario ) + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) def test_hybrid_start(self): """Test a hybrid startup call of buildnml""" From 4f905802df095a5b403c7ede0d89bed9fdbba0e1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 3 Sep 2022 18:00:27 -0600 Subject: [PATCH 060/164] black and lint formatting changes, as well as adding a start_type system test --- python/slim/test/test_sys_buildnml.py | 117 +++++++++++++++++++------- 1 file changed, 88 insertions(+), 29 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 55a08b5d..5f1a5df7 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -26,6 +26,34 @@ # pylint: disable=invalid-name +def getVariableFromNML(nmlfile, variable): + """Get a variable from the namelist file""" + with open(nmlfile, "r") as nfile: + for line in nfile: + if variable in line: + print("lnd_in:" + line) + match = re.search('= ["]*([ a-zA-Z0-9._//-]+)["]*', line) + if match is not None: + return match.group(1) + match = re.search("= [']*([ a-zA-Z0-9._//-]+)[']*", line) + if match is not None: + return match.group(1) + return None + + +def addLinesToUserNL(user_nl_file, lines): + """Add some lines to the user_nl_file for SLIM""" + if os.path.exists(user_nl_file): + os.remove(user_nl_file) + print("Add lines to " + user_nl_file) + with open(user_nl_file, "x") as userfile: + for line in lines: + userfile.write(line) + print(line) + userfile.close() + print("Close file") + + class TestBuildNML(unittest.TestCase): """System Tests of buildnml""" @@ -66,35 +94,22 @@ def tearDown(self): os.chdir(self.curdir) shutil.rmtree(self._testdir, ignore_errors=True) - def getVariableFromNML(self, nmlfile, variable): - """Get a variable from the namelist file""" - with open(nmlfile, "r") as nfile: - for line in nfile: - if variable in line: - print(line) - match = re.search('= ["]*([a-zA-Z0-9._//-]+)["]*', line) - if match is not None: - return match.group(1) - else: - match = re.search("= [']*([a-zA-Z0-9._//-]+)[']*", line) - if match is not None: - return match.group(1) - return None - def test_simple(self): """Test a simple call of buildnml""" - for scenario in ("global_uniform", "realistic_from_1850", "realistic_from_2000" ): - self.case.set_value("SLIM_SCENARIO", scenario ) - buildnml(self.case, self._testdir, "slim") - expect( - os.path.isfile("Buildconf/slimconf/lnd_in"), - "Namelist file lnd_in should exist in Buildconf after running buildnml", - ) - expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") - expect( - os.path.isfile("Buildconf/slim.input_data_list"), - "Input data list file should exist after running buildnml", - ) + for scenario in ("global_uniform", "realistic_from_1850", "realistic_from_2000"): + self.case.set_value("SLIM_SCENARIO", scenario) + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect( + os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml" + ) + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) def test_hybrid_start(self): """Test a hybrid startup call of buildnml""" @@ -113,7 +128,7 @@ def test_hybrid_start(self): os.path.isfile("Buildconf/slim.input_data_list"), "Input data list file should exist after running buildnml", ) - value = self.getVariableFromNML("lnd_in", "finidat") + value = getVariableFromNML("lnd_in", "finidat") self.assertEqual( value, "./TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" ) @@ -135,11 +150,55 @@ def test_branch_start(self): os.path.isfile("Buildconf/slim.input_data_list"), "Input data list file should exist after running buildnml", ) - value = self.getVariableFromNML("lnd_in", "nrevsn") + value = getVariableFromNML("lnd_in", "nrevsn") self.assertEqual( value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="nrevsn not set as expected" ) + def test_start_types(self): + """Test start types of buildnml""" + # Cold start types + finidat = " " + lines = [] + for stype in ("default", "cold", "arb_ic"): + print("Type: " + stype) + addLinesToUserNL("user_nl_slim", lines) + + self.case.set_value("SLIM_START_TYPE", stype) + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect( + os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml" + ) + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + value = getVariableFromNML("lnd_in", "finidat") + self.assertEqual(value, finidat, msg="finidat not set as expected") + stype = "startup" + finidat = "./TESTFINIDATFILENAME.nc" + lines = ["finidat = '" + finidat + "'\n"] + print("Type: " + stype) + addLinesToUserNL("user_nl_slim", lines) + + self.case.set_value("SLIM_START_TYPE", stype) + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + value = getVariableFromNML("lnd_in", "finidat") + self.assertEqual(value, "./" + finidat, msg="finidat not set as expected") + if __name__ == "__main__": unit_testing.setup_for_tests() From 70ac05ac00c6e5f440b9757822728a2440e5c150 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 3 Sep 2022 18:01:40 -0600 Subject: [PATCH 061/164] If finidat is UNSET it should be changed to blank, check for default finidat in all cases --- cime_config/slim_cime_py/buildnml.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 885fe05b..1f63daa7 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -109,13 +109,18 @@ def check_nml_initial_conditions(nmlgen, case): # ------------------------------------------------------ logger.info(" check_nml_initial_conditions") start_type = case.get_value("SLIM_START_TYPE") + # Handle a cold start + finidat = nmlgen.get_value("finidat") if start_type == "cold": - finidat = nmlgen.get_value("finidat") logger.info(" finidat = %s", finidat) if finidat != "UNSET": raise SystemExit("finidat is set but SLIM_START_TYPE is cold which is a contradiction") nmlgen.set_value("finidat", value=" ") + # Set to blank meaning a cold start if still UNSET + if finidat == "UNSET": + nmlgen.set_value("finidat", value=" ") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### From 582fb07d240092e2d94fa1786c430b09ce8c55a1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 3 Sep 2022 18:37:35 -0600 Subject: [PATCH 062/164] Get more run_type testing working and run_type options themselves --- cime_config/slim_cime_py/buildnml.py | 42 ++++++++++++++++++++------ python/slim/test/test_unit_buildnml.py | 15 ++++----- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 1f63daa7..1e49e090 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -109,17 +109,39 @@ def check_nml_initial_conditions(nmlgen, case): # ------------------------------------------------------ logger.info(" check_nml_initial_conditions") start_type = case.get_value("SLIM_START_TYPE") - # Handle a cold start + run_type = case.get_value("RUN_TYPE") + + nrevsn = nmlgen.get_value("nrevsn") finidat = nmlgen.get_value("finidat") - if start_type == "cold": - logger.info(" finidat = %s", finidat) - if finidat != "UNSET": - raise SystemExit("finidat is set but SLIM_START_TYPE is cold which is a contradiction") - nmlgen.set_value("finidat", value=" ") - - # Set to blank meaning a cold start if still UNSET - if finidat == "UNSET": - nmlgen.set_value("finidat", value=" ") + # + # Non branch types + # + if run_type != "branch": + # Handle a cold start + if start_type == "cold": + logger.info(" finidat = %s", finidat) + if finidat != "UNSET": + raise SystemExit( + "finidat is set but SLIM_START_TYPE is cold which is a contradiction" + ) + nmlgen.set_value("finidat", value=" ") + + # Set to blank meaning a cold start if still UNSET + if finidat == "UNSET" or finidat is None: + if run_type == "hybrid": + raise SystemExit("finidat is required for a hybrid RUN_TYPE") + nmlgen.set_value("finidat", value=" ") + + if nrevsn is not None: + raise SystemExit("nrevsn can NOT be set except when RUN_TYPE is a branch") + # + # branch types + # + else: + if nrevsn is None: + raise SystemExit("nrevsn is required to be set when RUN_TYPE is a branch") + # if finidat is not None: + # raise SystemExit("finidat can NOT be set when RUN_TYPE is a branch") # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 61360c55..3eef8461 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -142,7 +142,7 @@ def test_check_init_data(self): # Make sure nrevsn can't be set self.nmlgen.set_value("nrevsn", "file_is_set.nc") with self.assertRaisesRegex( - SystemExit, "nrevsn is set but RUN_TYPE is NOT branch which is a contradiction" + SystemExit, "nrevsn can NOT be set except when RUN_TYPE is a branch" ): check_nml_initial_conditions(self.nmlgen, self.case) # @@ -152,19 +152,20 @@ def test_check_init_data(self): self.nmlgen.set_value("nrevsn", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) # Make sure finidat can't be set - self.nmlgen.set_value("finidat", "file_is_set.nc") - with self.assertRaisesRegex( - SystemExit, "finidat is set but RUN_TYPE is branch which is a contradiction" - ): - check_nml_initial_conditions(self.nmlgen, self.case) + # self.nmlgen.set_value("finidat", "file_is_set.nc") + # with self.assertRaisesRegex( + # SystemExit, "finidat is set but RUN_TYPE is branch which is a contradiction" + # ): + # check_nml_initial_conditions(self.nmlgen, self.case) # # Check that a hybrid works correctly # self.case.set_value("RUN_TYPE", "hybrid") + self.nmlgen.set_value("nrevsn", None) self.nmlgen.set_value("finidat", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) # Make sure will die if finidat is NOT set - self.nmlgen.set_value("finidat", "UNSET") + self.nmlgen.set_value("finidat", None) with self.assertRaisesRegex(SystemExit, "finidat is required for a hybrid RUN_TYPE"): check_nml_initial_conditions(self.nmlgen, self.case) From 9c2dc1a9b4fb5b7bb00dc020964e9ffe47711a59 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 9 Sep 2022 18:03:38 -0600 Subject: [PATCH 063/164] Work on nrevsn and finidat for different run types, also change tests so that IC files have to be created and are checked for --- python/slim/test/test_sys_buildnml.py | 12 +++-- python/slim/test/test_unit_buildnml.py | 64 ++++++++++++++++++-------- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 5f1a5df7..136f1d24 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -10,6 +10,8 @@ import re import logging +from pathlib import Path + from CIME.BuildTools.configure import FakeCase from CIME.utils import expect @@ -118,6 +120,7 @@ def test_hybrid_start(self): self.case.set_value("RUN_REFCASE", "TESTCASE") self.case.set_value("RUN_REFDATE", "0001-01-01") self.case.set_value("RUN_REFTOD", "00000") + Path("TESTCASE.slim.r.0001-01-01-00000.nc").touch() buildnml(self.case, self._testdir, "slim") expect( os.path.isfile("Buildconf/slimconf/lnd_in"), @@ -130,7 +133,7 @@ def test_hybrid_start(self): ) value = getVariableFromNML("lnd_in", "finidat") self.assertEqual( - value, "./TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" + value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" ) def test_branch_start(self): @@ -140,6 +143,7 @@ def test_branch_start(self): self.case.set_value("RUN_REFCASE", "TESTCASE") self.case.set_value("RUN_REFDATE", "0001-01-01") self.case.set_value("RUN_REFTOD", "00000") + Path("TESTCASE.slim.r.0001-01-01-00000.nc").touch() buildnml(self.case, self._testdir, "slim") expect( os.path.isfile("Buildconf/slimconf/lnd_in"), @@ -180,7 +184,8 @@ def test_start_types(self): value = getVariableFromNML("lnd_in", "finidat") self.assertEqual(value, finidat, msg="finidat not set as expected") stype = "startup" - finidat = "./TESTFINIDATFILENAME.nc" + finidat = "TESTFINIDATFILENAME.nc" + Path(finidat).touch() lines = ["finidat = '" + finidat + "'\n"] print("Type: " + stype) addLinesToUserNL("user_nl_slim", lines) @@ -197,7 +202,8 @@ def test_start_types(self): "Input data list file should exist after running buildnml", ) value = getVariableFromNML("lnd_in", "finidat") - self.assertEqual(value, "./" + finidat, msg="finidat not set as expected") + self.assertEqual(value, finidat, msg="finidat not set as expected") + os.remove("user_nl_slim") if __name__ == "__main__": diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 3eef8461..256a03bf 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -9,6 +9,8 @@ import os import logging +from pathlib import Path + from CIME.nmlgen import NamelistGenerator from CIME.BuildTools.configure import FakeCase from CIME.utils import expect @@ -16,6 +18,7 @@ # pylint: disable=wrong-import-order,unused-import from slim import add_slim_cime_py_to_path from slim import unit_testing +from slim.slim_logging import setup_logging from slim_cime_py.buildnml import ( check_nml_dtime, @@ -39,6 +42,7 @@ class TestPathUtils(unittest.TestCase): def setUp(self): """Initialize""" self._testdir = tempfile.mkdtemp() + self._pwd = os.getcwd() # namelist definition file lnd_root = os.path.normpath( os.path.join( @@ -46,25 +50,36 @@ def setUp(self): ) ) namelist_xml_dir = os.path.join(lnd_root, "cime_config") - definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] - for file_ in definition_file: + self._definition_file = [os.path.join(namelist_xml_dir, "namelist_definition_slim.xml")] + for file_ in self._definition_file: expect(os.path.isfile(file_), "Namelist XML file %s not found!" % file_) + setup_logging(logging.DEBUG) + os.chdir(self._testdir) self.case = FakeCase(compiler=None, mpilib=None, debug=None) + self.case.set_value("RUNDIR", self._testdir) self.case.set_value("RUN_TYPE", "startup") self.case.set_value("DIN_LOC_ROOT", ".") self.case.set_value("LND_DOMAIN_PATH", ".") self.case.set_value("LND_DOMAIN_FILE", "domain.nc") - self.case.set_value("SLIM_START_TYPE", "cold") - self.case.set_value("LND_GRID", "0.9x1.25") - # Create the namelist generator object - independent of instance - self.nmlgen = NamelistGenerator(self.case, definition_file) + self.case.set_value("SLIM_SCENARIO", "global_uniform") + self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("LND_GRID", "1.9x2.5") + + self.InitNML() + + def InitNML(self): + """Re initialize the Namelist""" + + # Recreate the object so that it will start empty + self.nmlgen = NamelistGenerator(self.case, self._definition_file) # ------------------------------------------------------ # Create config dictionary # ------------------------------------------------------ self.config = {} self.config["lnd_grid"] = self.case.get_value("LND_GRID") - self.config["slim_scenario"] = "1850_control" + self.config["slim_scenario"] = self.case.get_value("SLIM_SCENARIO") + self.config["slim_start_type"] = self.case.get_value("SLIM_START_TYPE") # ------------------------------------------------------ # Initialize namelist defaults @@ -74,6 +89,7 @@ def setUp(self): def tearDown(self): """Finalize""" shutil.rmtree(self._testdir, ignore_errors=True) + os.chdir(self._pwd) def test_check_nml_performance(self): """Test the check nml performance subroutine""" @@ -85,8 +101,9 @@ def test_check_nml_performance(self): def test_check_nml_general(self): """Test the check nml general subroutine""" + self.case.set_value("SLIM_START_TYPE", "cold") + self.InitNML() self.nmlgen.set_value("res", self.case.get_value("LND_GRID")) - self.nmlgen.set_value("slim_start_type", "cold") check_nml_general(self.nmlgen) for var in ("slim_start_type", "res"): val = self.nmlgen.get_value(var) @@ -98,12 +115,13 @@ def test_check_nml_general(self): def test_check_nml_data(self): """Test the check nml data subroutine""" + self.case.set_value("LND_GRID", "1.9x2.5") self.nmlgen.set_value("res", self.case.get_value("LND_GRID")) # Loop through the scenarios that we have datasets for - self.config["lnd_grid"] = "1.9x2.5" for scen in ("global_uniform", "realistic_from_1850", "realistic_from_2000"): - self.config["slim_scenario"] = scen - self.nmlgen.init_defaults(infiles=[], config=self.config) + self.case.set_value("SLIM_SCENARIO", scen) + print("SLIM_SCENARIO = " + scen) + self.InitNML() check_nml_data(self.nmlgen) # make the dataset unset and make sure it fails @@ -121,7 +139,7 @@ def test_check_init_data(self): # # A cold start should have a blank finidat file self.case.set_value("SLIM_START_TYPE", "cold") - self.nmlgen.init_defaults(infiles=[], config=self.config) + self.InitNML() check_nml_initial_conditions(self.nmlgen, self.case) val = self.nmlgen.get_value("finidat") expect("' '", val) @@ -133,8 +151,9 @@ def test_check_init_data(self): check_nml_initial_conditions(self.nmlgen, self.case) # Set to startup so that finidat is required self.case.set_value("SLIM_START_TYPE", "startup") - self.nmlgen.init_defaults(infiles=[], config=self.config) + self.InitNML() self.nmlgen.set_value("finidat", "file_is_set.nc") + Path("file_is_set.nc").touch() check_nml_initial_conditions(self.nmlgen, self.case) # Don't set the IC file, so make sure it aborts self.nmlgen.set_value("finidat", "UNSET") @@ -145,23 +164,30 @@ def test_check_init_data(self): SystemExit, "nrevsn can NOT be set except when RUN_TYPE is a branch" ): check_nml_initial_conditions(self.nmlgen, self.case) + + def test_check_init_data_branch(self): + """Test the check nml initial data subroutine for branch""" # # Check that a branch works correctly # self.case.set_value("RUN_TYPE", "branch") + Path("file_is_set.nc").touch() + self.InitNML() self.nmlgen.set_value("nrevsn", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) # Make sure finidat can't be set - # self.nmlgen.set_value("finidat", "file_is_set.nc") - # with self.assertRaisesRegex( - # SystemExit, "finidat is set but RUN_TYPE is branch which is a contradiction" - # ): - # check_nml_initial_conditions(self.nmlgen, self.case) + self.nmlgen.set_value("finidat", "file_is_set.nc") + with self.assertRaisesRegex(SystemExit, "finidat can NOT be set when RUN_TYPE is a branch"): + check_nml_initial_conditions(self.nmlgen, self.case) + + def test_check_init_data_hybrid(self): + """Test the check nml initial data subroutine for hybrid""" # # Check that a hybrid works correctly # self.case.set_value("RUN_TYPE", "hybrid") - self.nmlgen.set_value("nrevsn", None) + Path("file_is_set.nc").touch() + self.InitNML() self.nmlgen.set_value("finidat", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) # Make sure will die if finidat is NOT set From d8174121b2342ea960f8e2f9302d81ad6d9789c3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 9 Sep 2022 18:16:07 -0600 Subject: [PATCH 064/164] Work on nrevsn and finidat for different run types, also change tests so that IC files have to be created and are checked for --- cime_config/namelist_definition_slim.xml | 7 +++--- cime_config/slim_cime_py/buildnml.py | 27 ++++++++++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index d28f86d5..5a8a2ea1 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -39,14 +39,15 @@ - + char datasets - abs slim_data_and_initial - UNSET + UNSET + UNSET + UNSET Full pathname of initial conditions file. If blank SLIM will startup from diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 1e49e090..17934a6b 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -70,6 +70,18 @@ def check_nml_general(nmlgen): expect(nmlgen.get_value(var) is not None, var + " must be set") +#################################################################################### +def check_file(filename, case): + #################################################################################### + """Check that the file exists""" + if os.path.isabs(filename): + expect(os.path.isfile(filename), "filename must exist:" + filename) + else: + rundir = case.get_value("RUNDIR") + fname = os.path.normpath(os.path.join(rundir, filename)) + expect(os.path.isfile(fname), "filename must exist:" + fname) + + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### def check_nml_performance(nmlgen): @@ -120,17 +132,20 @@ def check_nml_initial_conditions(nmlgen, case): # Handle a cold start if start_type == "cold": logger.info(" finidat = %s", finidat) - if finidat != "UNSET": + if finidat != " " and finidat != "UNSET" and finidat is not None: + print(" finidat = '" + finidat + "'") raise SystemExit( "finidat is set but SLIM_START_TYPE is cold which is a contradiction" ) nmlgen.set_value("finidat", value=" ") # Set to blank meaning a cold start if still UNSET - if finidat == "UNSET" or finidat is None: + if finidat == " " or finidat == "UNSET" or finidat is None: if run_type == "hybrid": raise SystemExit("finidat is required for a hybrid RUN_TYPE") nmlgen.set_value("finidat", value=" ") + else: + check_file(finidat, case) if nrevsn is not None: raise SystemExit("nrevsn can NOT be set except when RUN_TYPE is a branch") @@ -140,8 +155,11 @@ def check_nml_initial_conditions(nmlgen, case): else: if nrevsn is None: raise SystemExit("nrevsn is required to be set when RUN_TYPE is a branch") - # if finidat is not None: - # raise SystemExit("finidat can NOT be set when RUN_TYPE is a branch") + + check_file(nrevsn, case) + if finidat is not None: + print(finidat) + raise SystemExit("finidat can NOT be set when RUN_TYPE is a branch") # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements @@ -180,6 +198,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path config = {} config["lnd_grid"] = case.get_value("LND_GRID") config["slim_scenario"] = case.get_value("SLIM_SCENARIO") + config["slim_start_type"] = case.get_value("SLIM_START_TYPE") logger.info(" SLIM lnd grid is %s", config["lnd_grid"]) From 3b13b585ce2c403f440d4c1f6df3300016640669 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 10 Sep 2022 15:35:10 -0600 Subject: [PATCH 065/164] Finally get pylint to pass, so now all tests under python directory pass --- cime_config/slim_cime_py/buildnml.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 17934a6b..34f34fdb 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -276,12 +276,7 @@ def buildnml(case, caseroot, compname): ### Independent of instance... startfile_type = "finidat" - start_type = "default" run_type = case.get_value("RUN_TYPE") - if run_type == "hybrid": - start_type = "startup" - elif run_type != "startup": - start_type = run_type slim_force_coldstart = case.get_value("SLIM_FORCE_COLDSTART") if run_type == "branch": @@ -298,11 +293,6 @@ def buildnml(case, caseroot, compname): if slim_force_coldstart == "on": logger.warning("WARNING: SLIM is starting up from a cold state") - start_type = "cold" - - run_startdate = case.get_value("RUN_STARTDATE") - - inputdata_file = os.path.join(caseroot, "Buildconf", "slim.input_data_list") rundir = case.get_value("RUNDIR") From 8a964ad3437f46405979bbc13c8960075e7ae383 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 11 Sep 2022 00:35:59 -0600 Subject: [PATCH 066/164] Make SLIM_START_TYPE to be cold, any, or required and correct SLIM_SCENARIO --- python/slim/test/test_sys_buildnml.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 136f1d24..e38e2cf8 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -72,7 +72,7 @@ def setUp(self): ) self.case = FakeCase(compiler=None, mpilib=None, debug=None) self.case.set_value("CASEROOT", self._testdir) - self.case.set_value("RUN_TYPE", "startup") + self.case.set_value("RUN_TYPE", "any") self.case.set_value("RUN_STARTDATE", "2000-01-01") self.case.set_value("RUN_REFCASE", "case.std") self.case.set_value("RUN_REFDATE", "0001-01-01") @@ -115,7 +115,7 @@ def test_simple(self): def test_hybrid_start(self): """Test a hybrid startup call of buildnml""" - self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("SLIM_START_TYPE", "required") self.case.set_value("RUN_TYPE", "hybrid") self.case.set_value("RUN_REFCASE", "TESTCASE") self.case.set_value("RUN_REFDATE", "0001-01-01") @@ -138,7 +138,7 @@ def test_hybrid_start(self): def test_branch_start(self): """Test a branch startup call of buildnml""" - self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("SLIM_START_TYPE", "required") self.case.set_value("RUN_TYPE", "branch") self.case.set_value("RUN_REFCASE", "TESTCASE") self.case.set_value("RUN_REFDATE", "0001-01-01") @@ -164,7 +164,7 @@ def test_start_types(self): # Cold start types finidat = " " lines = [] - for stype in ("default", "cold", "arb_ic"): + for stype in ("cold", "any", "required"): print("Type: " + stype) addLinesToUserNL("user_nl_slim", lines) @@ -183,7 +183,7 @@ def test_start_types(self): ) value = getVariableFromNML("lnd_in", "finidat") self.assertEqual(value, finidat, msg="finidat not set as expected") - stype = "startup" + stype = "required" finidat = "TESTFINIDATFILENAME.nc" Path(finidat).touch() lines = ["finidat = '" + finidat + "'\n"] From 116d7ff688605a244581ed50d6db94f381928a93 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 11 Sep 2022 00:36:09 -0600 Subject: [PATCH 067/164] Make SLIM_START_TYPE to be cold, any, or required and correct SLIM_SCENARIO --- cime_config/config_component.xml | 21 +++++++++++++-------- cime_config/namelist_definition_slim.xml | 10 ++++------ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index b1554900..8e0b52cc 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -29,10 +29,10 @@ char UNSET - UNSET,global_uniform,1850_control,2000_control + UNSET,global_uniform,realistic_from_1850,realistic_from_2000 - 2000_control - 1850_control + realistic_from_2000 + realistic_from_1850 run_component_slim env_run.xml @@ -58,15 +58,20 @@ char - default,cold,arb_ic - default + cold,any,required + any + + required + required + any + run_component_slim env_run.xml SLIM run type. - 'default' use the default type of slim_start type for this configuration - 'cold' is a run from arbitrary initial conditions - 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found + 'cold' is a cold start from arbitrary initial conditions, it will fail if you do provide initial conditions + 'any' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found + 'required' is a run where starting from provided initial conditions is required, it will fail if they aren't diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 5a8a2ea1..e2cbfdbe 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -46,8 +46,7 @@ UNSET - UNSET - UNSET + UNSET Full pathname of initial conditions file. If blank SLIM will startup from @@ -311,16 +310,15 @@ char default_settings default_settings - default,cold,arb_ic,startup + cold,any,required $SLIM_START_TYPE SLIM run type. - 'default' use the default type of slim_start type for this configuration 'cold' is a run from arbitrary initial conditions - 'arb_ic' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found - 'startup' is a startup run which requires setting initial conditions + 'any' is a run using initial conditions if provided, OR arbitrary initial conditions if no files can be found + 'required' is a startup run which requires setting initial conditions From 5eba6b4c1d58a133b4ccc3e131696ff134b24772 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 11 Sep 2022 17:27:38 -0600 Subject: [PATCH 068/164] Add a test that fails that does a hybrid ref-case but overrides it for a cold start --- python/slim/test/test_sys_buildnml.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index e38e2cf8..9c0bfd05 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -136,6 +136,28 @@ def test_hybrid_start(self): value, "TESTCASE.slim.r.0001-01-01-00000.nc", msg="finidat not set as expected" ) + def test_hybrid_start_override_cold(self): + """Test a hybrid startup call of buildnml where you override with a cold start""" + self.case.set_value("SLIM_START_TYPE", "required") + self.case.set_value("RUN_TYPE", "hybrid") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + self.case.set_value("RUN_REFTOD", "00000") + Path("TESTCASE.slim.r.0001-01-01-00000.nc").touch() + self.case.set_value("SLIM_START_TYPE", "cold") # Set start type to cold + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + value = getVariableFromNML("lnd_in", "finidat") + self.assertEqual(value, " ", msg="finidat not set as expected") + def test_branch_start(self): """Test a branch startup call of buildnml""" self.case.set_value("SLIM_START_TYPE", "required") From 0a398537f6e2504a1f17195837730386ec7f4988 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 11 Sep 2022 22:18:31 -0600 Subject: [PATCH 069/164] Remove SLIM_FORCE_COLDSTART --- cime_config/buildnml_test/user_nl_slim | 2 +- cime_config/slim_cime_py/buildnml.py | 15 ++------------- .../testmods_dirs/slim/default/shell_commands | 2 +- cime_config/user_nl_slim | 2 +- python/slim/test/test_sys_buildnml.py | 1 - 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/cime_config/buildnml_test/user_nl_slim b/cime_config/buildnml_test/user_nl_slim index 64824d6a..43893a6e 100644 --- a/cime_config/buildnml_test/user_nl_slim +++ b/cime_config/buildnml_test/user_nl_slim @@ -7,7 +7,7 @@ ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) -! or with SLIM_FORCE_COLDSTART to do a cold start +! or with SLIM_START_TYPE=cold to do a cold start ! or set it with an explicit filename here. !---------------------------------------------------------------------------------- diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 34f34fdb..d37f545c 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -144,6 +144,8 @@ def check_nml_initial_conditions(nmlgen, case): if run_type == "hybrid": raise SystemExit("finidat is required for a hybrid RUN_TYPE") nmlgen.set_value("finidat", value=" ") + logger.warning("WARNING: SLIM is starting up from a cold state") + else: check_file(finidat, case) @@ -278,21 +280,8 @@ def buildnml(case, caseroot, compname): startfile_type = "finidat" run_type = case.get_value("RUN_TYPE") - slim_force_coldstart = case.get_value("SLIM_FORCE_COLDSTART") if run_type == "branch": startfile_type = "nrevsn" - if slim_force_coldstart == "on": - slim_force_coldstart = "off" - logger.warning( - "%s", - "WARNING: You've turned on SLIM_FORCE_COLDSTART for a branch run_type," - + " which is a contradiction, the coldstart will be ignored\n" - + " turn off SLIM_FORCE_COLDSTART, or set RUN_TYPE=hybrid" - + " to get rid of this warning", - ) - - if slim_force_coldstart == "on": - logger.warning("WARNING: SLIM is starting up from a cold state") rundir = case.get_value("RUNDIR") diff --git a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands index b212e325..d795e17a 100755 --- a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands +++ b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands @@ -1,4 +1,4 @@ #!/bin/bash -./xmlchange CLM_FORCE_COLDSTART="on" +./xmlchange CLM_START_TYPE="cold" ./xmlchange CLM_CO2_TYPE="constant" ./xmlchange CCSM_CO2_PPMV="999.99" diff --git a/cime_config/user_nl_slim b/cime_config/user_nl_slim index 64824d6a..43893a6e 100644 --- a/cime_config/user_nl_slim +++ b/cime_config/user_nl_slim @@ -7,7 +7,7 @@ ! Set fatmlndfrc with LND_DOMAIN_PATH/LND_DOMAIN_FILE options ! Set finidat with RUN_REFCASE/RUN_REFDATE/RUN_REFTOD options for hybrid or branch cases ! (includes $inst_string for multi-ensemble cases) -! or with SLIM_FORCE_COLDSTART to do a cold start +! or with SLIM_START_TYPE=cold to do a cold start ! or set it with an explicit filename here. !---------------------------------------------------------------------------------- diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 9c0bfd05..1abf2bd8 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -82,7 +82,6 @@ def setUp(self): self.case.set_value("NINST_LND", 1) self.case.set_value("NCPL_BASE_PERIOD", "day") self.case.set_value("LND_NCPL", 48) - self.case.set_value("SLIM_FORCE_COLDSTART", "off") self.case.set_value("SLIM_SCENARIO", "global_uniform") self.case.set_value("COMP_ROOT_DIR_LND", lnd_root) self.case.set_value("DIN_LOC_ROOT", ".") From a77db136e43f495c10154f56e02b385412ec2545 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 12 Sep 2022 17:00:33 -0600 Subject: [PATCH 070/164] Move setting of IC file for hybrid/branch starts to inside the initial_conditions check, and get the tests to work with the change --- cime_config/slim_cime_py/buildnml.py | 67 +++++++++++--------------- python/slim/test/test_unit_buildnml.py | 35 ++++++++++---- 2 files changed, 55 insertions(+), 47 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index d37f545c..22bb0f31 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -113,7 +113,7 @@ def check_nml_history(nmlgen): # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_initial_conditions(nmlgen, case): +def check_nml_initial_conditions(nmlgen, case, inst_string=""): #################################################################################### """Set the namelist settings for initial conditions""" # pylint: disable=global-statement @@ -122,6 +122,23 @@ def check_nml_initial_conditions(nmlgen, case): logger.info(" check_nml_initial_conditions") start_type = case.get_value("SLIM_START_TYPE") run_type = case.get_value("RUN_TYPE") + run_refcase = case.get_value("RUN_REFCASE") + run_refdate = case.get_value("RUN_REFDATE") + run_reftod = case.get_value("RUN_REFTOD") + rundir = case.get_value("RUNDIR") + if run_type in ("hybrid", "branch"): + slim_startfile = "%s.slim%s.r.%s-%s.nc" % ( + run_refcase, + inst_string, + run_refdate, + run_reftod, + ) + if not os.path.exists(os.path.join(rundir, slim_startfile)): + slim_startfile = "%s.slim.r.%s-%s.nc" % ( + run_refcase, + run_refdate, + run_reftod, + ) nrevsn = nmlgen.get_value("nrevsn") finidat = nmlgen.get_value("finidat") @@ -141,10 +158,13 @@ def check_nml_initial_conditions(nmlgen, case): # Set to blank meaning a cold start if still UNSET if finidat == " " or finidat == "UNSET" or finidat is None: - if run_type == "hybrid": - raise SystemExit("finidat is required for a hybrid RUN_TYPE") - nmlgen.set_value("finidat", value=" ") - logger.warning("WARNING: SLIM is starting up from a cold state") + if run_type == "hybrid" and start_type != "cold": + finidat = slim_startfile + check_file(finidat, case) + nmlgen.set_value("finidat", value=finidat) + else: + nmlgen.set_value("finidat", value=" ") + logger.warning("WARNING: SLIM is starting up from a cold state") else: check_file(finidat, case) @@ -156,7 +176,8 @@ def check_nml_initial_conditions(nmlgen, case): # else: if nrevsn is None: - raise SystemExit("nrevsn is required to be set when RUN_TYPE is a branch") + nrevsn = slim_startfile + nmlgen.set_value("nrevsn", value=nrevsn) check_file(nrevsn, case) if finidat is not None: @@ -216,7 +237,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path check_nml_general(nmlgen) check_nml_performance(nmlgen) check_nml_history(nmlgen) - check_nml_initial_conditions(nmlgen, case) + check_nml_initial_conditions(nmlgen, case, inst_string) check_nml_data(nmlgen) # ---------------------------------------------------- @@ -277,12 +298,6 @@ def buildnml(case, caseroot, compname): os.remove(data_list_path) ### Independent of instance... - startfile_type = "finidat" - run_type = case.get_value("RUN_TYPE") - - if run_type == "branch": - startfile_type = "nrevsn" - rundir = case.get_value("RUNDIR") # ----------------------------------------------------- @@ -308,34 +323,10 @@ def buildnml(case, caseroot, compname): os.path.join(rundir, rpointer), os.path.join(rundir, rpointer + inst_string), ) - - ### - ### instance dependent information... ### - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - rundir = case.get_value("RUNDIR") - if run_type in ("hybrid", "branch"): - slim_startfile = "%s.slim%s.r.%s-%s.nc" % ( - run_refcase, - inst_string, - run_refdate, - run_reftod, - ) - if not os.path.exists(os.path.join(rundir, slim_startfile)): - slim_startfile = "%s.slim.r.%s-%s.nc" % ( - run_refcase, - run_refdate, - run_reftod, - ) - slim_icfile = "%s = '%s'" % (startfile_type, slim_startfile) - else: - slim_icfile = "" + ### Namelist infile ### - infile_lines = [] - infile_lines.append(slim_icfile) user_nl_file = os.path.join(caseroot, "user_nl_slim" + inst_string) infile = os.path.join(confdir, "namelist_infile") diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 256a03bf..ccf5fe0d 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -59,11 +59,16 @@ def setUp(self): self.case = FakeCase(compiler=None, mpilib=None, debug=None) self.case.set_value("RUNDIR", self._testdir) self.case.set_value("RUN_TYPE", "startup") + self.case.set_value("RUN_STARTDATE", "2000-01-01") + self.case.set_value("RUN_REFCASE", "case.std") + self.case.set_value("RUN_REFDATE", "0001-01-01") + self.case.set_value("RUN_REFTOD", "00000") + self.case.set_value("RUN_REFDIR", "cesm2_init") self.case.set_value("DIN_LOC_ROOT", ".") self.case.set_value("LND_DOMAIN_PATH", ".") self.case.set_value("LND_DOMAIN_FILE", "domain.nc") self.case.set_value("SLIM_SCENARIO", "global_uniform") - self.case.set_value("SLIM_START_TYPE", "startup") + self.case.set_value("SLIM_START_TYPE", "any") self.case.set_value("LND_GRID", "1.9x2.5") self.InitNML() @@ -171,10 +176,18 @@ def test_check_init_data_branch(self): # Check that a branch works correctly # self.case.set_value("RUN_TYPE", "branch") - Path("file_is_set.nc").touch() + self.case.set_value("SLIM_START_TYPE", "required") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + nrevsn = "TESTCASE.slim.r.0001-01-01-00000.nc" + Path(nrevsn).touch() self.InitNML() - self.nmlgen.set_value("nrevsn", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("nrevsn"), + nrevsn, + "finidat should be set correctly for hybrid case", + ) # Make sure finidat can't be set self.nmlgen.set_value("finidat", "file_is_set.nc") with self.assertRaisesRegex(SystemExit, "finidat can NOT be set when RUN_TYPE is a branch"): @@ -186,14 +199,18 @@ def test_check_init_data_hybrid(self): # Check that a hybrid works correctly # self.case.set_value("RUN_TYPE", "hybrid") - Path("file_is_set.nc").touch() + self.case.set_value("SLIM_START_TYPE", "required") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + finidat = "TESTCASE.slim.r.0001-01-01-00000.nc" + Path(finidat).touch() self.InitNML() - self.nmlgen.set_value("finidat", "file_is_set.nc") check_nml_initial_conditions(self.nmlgen, self.case) - # Make sure will die if finidat is NOT set - self.nmlgen.set_value("finidat", None) - with self.assertRaisesRegex(SystemExit, "finidat is required for a hybrid RUN_TYPE"): - check_nml_initial_conditions(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("finidat"), + finidat, + "finidat should be set correctly for hybrid case", + ) if __name__ == "__main__": From d61a2fe8f87d70de0a26b5f5367c41655cb433d8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 13 Sep 2022 16:51:44 -0600 Subject: [PATCH 071/164] Remove SLIM_NAMELIST_OPTS as it shouldn't be used --- cime_config/config_component.xml | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 8e0b52cc..5721da97 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -42,20 +42,6 @@ - - char - - run_component_slim - env_run.xml - SLIM-specific namelist settings for -namelist option in the SLIM - buildnml. SLIM_NAMELIST_OPTS is normally set as a compset variable - and in general should not be modified for supported compsets. - It is recommended that if you want to modify this value for your experiment, - you should use your own user-defined component sets via using create_newcase - with a compset_file argument. - This is an advanced flag and should only be used by expert users. - - char cold,any,required From 18e44615de399e447a5e3e93b52bc051b08fe2bf Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Sep 2022 16:38:55 -0600 Subject: [PATCH 072/164] Add a 1-deg 2000 dataset and check for it and make sure if asking for another it fails --- cime_config/namelist_definition_slim.xml | 1 + python/slim/test/test_unit_buildnml.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index e2cbfdbe..b23402af 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -18,6 +18,7 @@ $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc Surface dataset describing surface properties at each gridcell diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index ccf5fe0d..1d53ead0 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -128,6 +128,16 @@ def test_check_nml_data(self): print("SLIM_SCENARIO = " + scen) self.InitNML() check_nml_data(self.nmlgen) + # 1-degree has one dataset + self.case.set_value("LND_GRID", "0.9x1.25") + self.case.set_value("SLIM_SCENARIO", "realistic_from_2000") + self.InitNML() + check_nml_data(self.nmlgen) + # Check that 1-degree for another scenario fails + self.case.set_value("SLIM_SCENARIO", "global_uniform") + self.InitNML() + with self.assertRaisesRegex(SystemExit, " file is NOT set and is required"): + check_nml_data(self.nmlgen) # make the dataset unset and make sure it fails var = "mml_surdat" From cd67b18cf4559f473fb84ea9cea680e127d9f2c7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Sep 2022 01:33:25 -0600 Subject: [PATCH 073/164] Add some namelist history setting checks --- python/slim/test/test_unit_buildnml.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 1d53ead0..dcbd671b 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -104,6 +104,29 @@ def test_check_nml_performance(self): with self.assertRaisesRegex(SystemExit, "nsegspc must be positive"): check_nml_performance(self.nmlgen) + + def test_check_nml_history(self): + """Test the check nml history subroutine""" + self.nmlgen.set_value("hist_mfilt", [20]) + check_nml_history(self.nmlgen) + self.nmlgen.set_value("hist_mfilt", [0]) + with self.assertRaisesRegex(SystemExit, "hist_mfilt must be 1 or larger"): + check_nml_history(self.nmlgen) + # Make a list of settings to a list of history tape streams + self.nmlgen.set_value("hist_empty_htapes", '.true.') + self.nmlgen.set_value("hist_mfilt", [1,1,2,3,4,5]) + self.nmlgen.set_value("hist_ndens", [1,1,2,1,1,1]) + self.nmlgen.set_value("hist_nhtfrq", [1,1,-24,2,2,2]) + self.nmlgen.set_value("hist_avgflag_pertape", ['A','I','X','M','A','A']) + self.nmlgen.set_value("hist_dov2xy", ['.true.','TRUE','FALSE','.T.','.F.','.true.']) + self.nmlgen.set_value("hist_fincl1", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_fincl2", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_fincl3", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_fincl4", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_fincl5", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_fincl6", ['A','B','C','D','E','F']) + check_nml_history(self.nmlgen) + def test_check_nml_general(self): """Test the check nml general subroutine""" self.case.set_value("SLIM_START_TYPE", "cold") From ccbf02af05eafe6c0e724ee930ef5951a21d520d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Sep 2022 12:52:39 -0600 Subject: [PATCH 074/164] Add some failing tests for history options --- python/slim/test/test_unit_buildnml.py | 99 ++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 13 deletions(-) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index dcbd671b..5401dd10 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -104,7 +104,6 @@ def test_check_nml_performance(self): with self.assertRaisesRegex(SystemExit, "nsegspc must be positive"): check_nml_performance(self.nmlgen) - def test_check_nml_history(self): """Test the check nml history subroutine""" self.nmlgen.set_value("hist_mfilt", [20]) @@ -112,20 +111,94 @@ def test_check_nml_history(self): self.nmlgen.set_value("hist_mfilt", [0]) with self.assertRaisesRegex(SystemExit, "hist_mfilt must be 1 or larger"): check_nml_history(self.nmlgen) + + self.InitNML() # Make a list of settings to a list of history tape streams - self.nmlgen.set_value("hist_empty_htapes", '.true.') - self.nmlgen.set_value("hist_mfilt", [1,1,2,3,4,5]) - self.nmlgen.set_value("hist_ndens", [1,1,2,1,1,1]) - self.nmlgen.set_value("hist_nhtfrq", [1,1,-24,2,2,2]) - self.nmlgen.set_value("hist_avgflag_pertape", ['A','I','X','M','A','A']) - self.nmlgen.set_value("hist_dov2xy", ['.true.','TRUE','FALSE','.T.','.F.','.true.']) - self.nmlgen.set_value("hist_fincl1", ['A','B','C','D','E','F']) - self.nmlgen.set_value("hist_fincl2", ['A','B','C','D','E','F']) - self.nmlgen.set_value("hist_fincl3", ['A','B','C','D','E','F']) - self.nmlgen.set_value("hist_fincl4", ['A','B','C','D','E','F']) - self.nmlgen.set_value("hist_fincl5", ['A','B','C','D','E','F']) - self.nmlgen.set_value("hist_fincl6", ['A','B','C','D','E','F']) + self.nmlgen.set_value("hist_empty_htapes", ".true.") + self.nmlgen.set_value("hist_mfilt", [1, 1, 2, 3, 4, 5]) + self.nmlgen.set_value("hist_ndens", [1, 1, 2, 1, 1, 1]) + self.nmlgen.set_value("hist_nhtfrq", [1, 1, -24, 2, 2, 2]) + self.nmlgen.set_value("hist_avgflag_pertape", ["A", "I", "X", "M", "A", "A"]) + self.nmlgen.set_value("hist_dov2xy", [".true.", "TRUE", "FALSE", ".T.", ".F.", ".true."]) + self.nmlgen.set_value("hist_fincl1", ["A:I", "B:A", "C:X", "D:M", "E:A", "F:A"]) + self.nmlgen.set_value("hist_fincl2", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fincl3", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fincl4", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fincl5", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fincl6", ["A", "B", "C", "D", "E", "F"]) check_nml_history(self.nmlgen) + # and another complex case + self.InitNML() + self.nmlgen.set_value("hist_empty_htapes", ".false.") + self.nmlgen.set_value("hist_fexcl1", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fexcl2", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fexcl3", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fexcl4", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fexcl5", ["A", "B", "C", "D", "E", "F"]) + self.nmlgen.set_value("hist_fexcl6", ["A", "B", "C", "D", "E", "F"]) + check_nml_history(self.nmlgen) + + def test_check_nml_history_simple_fails_bad_timeavg(self): + """Test the check nml history subroutine for simple fails bad time avg""" + self.nmlgen.set_value("hist_fincl1", ["A:Z"]) + with self.assertRaisesRegex(SystemExit, "Bad averaging option"): + check_nml_history(self.nmlgen) + + def test_check_nml_history_simple_fails_bad_timeavg_per_tape(self): + """Test the check nml history subroutine for simple fails bad time avg per tape""" + self.nmlgen.set_value("hist_fincl1", ["A"]) + self.nmlgen.set_value("hist_avgflag_pertape", ["Z"]) + with self.assertRaisesRegex(SystemExit, "Bad averaging option per tape"): + check_nml_history(self.nmlgen) + + def test_check_nml_history_simple_fails_bad_characters(self): + """Test the check nml history subroutine for simple fails bad characters in field""" + self.nmlgen.set_value("hist_fincl1", ["A%$#@!~"]) + with self.assertRaisesRegex(SystemExit, "Invalid characters in fieldname"): + check_nml_history(self.nmlgen) + + def test_check_nml_history_simple_fails_white_space_in_field(self): + """Test the check nml history subroutine for simple fails bad characters in field""" + self.nmlgen.set_value("hist_fincl1", [" "]) + with self.assertRaisesRegex(SystemExit, "White space in fieldname"): + check_nml_history(self.nmlgen) + + def test_check_nml_history_complex_fails_array_size_not_consistent(self): + """Test the check nml history subroutine for complex fails array size not consistent""" + self.nmlgen.set_value("hist_mfilt", [1]) + self.nmlgen.set_value("hist_ndens", [1, 1]) + self.nmlgen.set_value("hist_fincl2", ["A"]) + with self.assertRaisesRegex( + SystemExit, "Sizes of history array options must be consistent" + ): + check_nml_history(self.nmlgen) + + def test_check_nml_history_complex_fails_array_size(self): + """Test the check nml history subroutine for complex fails array size""" + self.nmlgen.set_value("hist_fincl1", ["A", "B", "C", "D", "E", "F", "G"]) + with self.assertRaisesRegex(SystemExit, "History array options can not exceed array size"): + check_nml_history(self.nmlgen) + + def test_check_nml_history_complex_fails_excl_with_empty(self): + """Test the check nml history subroutine for complex fails exclude used with + empty history + """ + self.nmlgen.set_value("hist_empty_htapes", ".true.") + self.nmlgen.set_value("hist_fexcl1", ["A"]) + with self.assertRaisesRegex( + SystemExit, "Exclude history options can not be used when hist_empty_htapes is on" + ): + check_nml_history(self.nmlgen) + + def test_check_nml_history_complex_fails_excl_beyond_first(self): + """Test the check nml history subroutine for complex fails exclude used beyond first""" + self.nmlgen.set_value("hist_fexcl2", ["A"]) + with self.assertRaisesRegex( + SystemExit, + "Exclude history options should not be used for tape other than" + + " the first one which has defaults", + ): + check_nml_history(self.nmlgen) def test_check_nml_general(self): """Test the check nml general subroutine""" From 4afe424f61f663081b52f75daf81c0e1f44108dc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Sep 2022 15:12:57 -0600 Subject: [PATCH 075/164] Check for validity of fincl/fexcl fieldnames, make fincl1 and fexcl1 not set by default --- cime_config/namelist_definition_slim.xml | 4 ++-- cime_config/slim_cime_py/buildnml.py | 20 ++++++++++++++++++++ python/slim/test/test_unit_buildnml.py | 10 ++++++++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index b23402af..5ca57df8 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -170,7 +170,7 @@ - + char(1000) history slim_history @@ -215,7 +215,7 @@ Fields to exclude from history tape series 6. - + char(1000) history slim_history diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 22bb0f31..0ef3d26e 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -4,6 +4,7 @@ import os import shutil import logging +import re from CIME.buildnml import create_namelist_infile from CIME.nmlgen import NamelistGenerator @@ -110,6 +111,25 @@ def check_nml_history(nmlgen): if int(mfilt) <= 0: raise SystemExit("hist_mfilt must be 1 or larger") + # + # Check the list of fincl/fexcl for validity and get number of tapes + # + for tape in (1, 2, 3, 4, 5, 6): + for ftype in ("fincl", "fexcl"): + var = "hist_" + ftype + str(tape) + val = nmlgen.get_value(var) + for field in val: + if field is None: + break + match = re.search(r"^[A-Za-z0-9_.:]+\s*$", field) + if match is None: + raise SystemExit( + "History field name " + + var + + " has invalid characters or whitespace in it=" + + field + ) + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 5401dd10..c8c7d667 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -154,13 +154,19 @@ def test_check_nml_history_simple_fails_bad_timeavg_per_tape(self): def test_check_nml_history_simple_fails_bad_characters(self): """Test the check nml history subroutine for simple fails bad characters in field""" self.nmlgen.set_value("hist_fincl1", ["A%$#@!~"]) - with self.assertRaisesRegex(SystemExit, "Invalid characters in fieldname"): + with self.assertRaisesRegex( + SystemExit, + "History field name hist_fincl1 has " + "invalid characters or whitespace in it= ", + ): check_nml_history(self.nmlgen) def test_check_nml_history_simple_fails_white_space_in_field(self): """Test the check nml history subroutine for simple fails bad characters in field""" self.nmlgen.set_value("hist_fincl1", [" "]) - with self.assertRaisesRegex(SystemExit, "White space in fieldname"): + with self.assertRaisesRegex( + SystemExit, + "History field name hist_fincl1 has " + "invalid characters or whitespace in it= ", + ): check_nml_history(self.nmlgen) def test_check_nml_history_complex_fails_array_size_not_consistent(self): From f396f19d72c80653421c09df594d7369b4e256e2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 23 Sep 2022 12:42:13 -0600 Subject: [PATCH 076/164] Fix regular expression --- python/slim/test/test_unit_buildnml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index c8c7d667..0d68767f 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -156,7 +156,7 @@ def test_check_nml_history_simple_fails_bad_characters(self): self.nmlgen.set_value("hist_fincl1", ["A%$#@!~"]) with self.assertRaisesRegex( SystemExit, - "History field name hist_fincl1 has " + "invalid characters or whitespace in it= ", + r"History field name hist_fincl1 has invalid characters or whitespace in it=" ): check_nml_history(self.nmlgen) @@ -165,7 +165,7 @@ def test_check_nml_history_simple_fails_white_space_in_field(self): self.nmlgen.set_value("hist_fincl1", [" "]) with self.assertRaisesRegex( SystemExit, - "History field name hist_fincl1 has " + "invalid characters or whitespace in it= ", + r"History field name hist_fincl1 has invalid characters or whitespace in it=" ): check_nml_history(self.nmlgen) From d98ed440b8ef0c0869347e425c35d5a527c5eba2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 24 Sep 2022 18:58:44 -0600 Subject: [PATCH 077/164] Get history namelist checks working all buildnml unit and sys test now pass --- cime_config/namelist_definition_slim.xml | 43 ++--------- cime_config/slim_cime_py/buildnml.py | 91 +++++++++++++++++++++--- python/slim/test/test_unit_buildnml.py | 45 +++++------- 3 files changed, 100 insertions(+), 79 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 5ca57df8..d679409d 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -147,7 +147,7 @@ - + logical(6) history slim_history @@ -174,47 +174,12 @@ char(1000) history slim_history - Fields to exclude from history tape series 1. + Fields to exclude from default history tape series 1. '' - - char(1000) - history - slim_history - Fields to exclude from history tape series 2. - - - - char(1000) - history - slim_history - Fields to exclude from history tape series 3. - - - - char(1000) - history - slim_history - Fields to exclude from history tape series 4. - - - - char(1000) - history - slim_history - Fields to exclude from history tape series 5. - - - - char(1000) - history - slim_history - Fields to exclude from history tape series 6. - - char(1000) history @@ -260,7 +225,7 @@ Fields to add to history tape series 6. - + integer(6) history slim_history @@ -270,7 +235,7 @@ - + integer(6) history slim_history diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 0ef3d26e..37638a79 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -8,6 +8,7 @@ from CIME.buildnml import create_namelist_infile from CIME.nmlgen import NamelistGenerator +from CIME.namelist import literal_to_python_value from CIME.utils import expect logger = logging.getLogger(__name__) @@ -105,30 +106,98 @@ def check_nml_history(nmlgen): # ------------------------------------------------------ logger.info(" check_nml_history") + avg_opts = ("A", "I", "X", "M") hist_mfilt = nmlgen.get_value("hist_mfilt") for mfilt in hist_mfilt: + if mfilt is None: + break logger.info(" hist_mfilt = %d", int(mfilt)) if int(mfilt) <= 0: raise SystemExit("hist_mfilt must be 1 or larger") # - # Check the list of fincl/fexcl for validity and get number of tapes + # Check the list of fincl for validity and get number of tapes # + hist_empty_htapes = nmlgen.get_value("hist_empty_htapes") + if hist_empty_htapes is not None: + hist_empty = literal_to_python_value(hist_empty_htapes, type_="logical") + else: + hist_empty = False + + if hist_empty: + num_tapes = 0 + else: + num_tapes = 1 + + ftype = "fincl" for tape in (1, 2, 3, 4, 5, 6): - for ftype in ("fincl", "fexcl"): - var = "hist_" + ftype + str(tape) - val = nmlgen.get_value(var) - for field in val: - if field is None: - break - match = re.search(r"^[A-Za-z0-9_.:]+\s*$", field) - if match is None: + var = "hist_" + ftype + str(tape) + val = nmlgen.get_value(var) + for field in val: + if field is None: + break + match = re.fullmatch(r"([A-Za-z0-9_.]+):*([A-Z0-9]*)\s*", field) + if match is None: + raise SystemExit( + "History field name " + + var + + " has invalid characters or whitespace in it=" + + field + ) + if match.group(2): + if match.group(2) not in avg_opts: raise SystemExit( - "History field name " + "History averaging option " + + match.group(2) + + " is not valid in " + var - + " has invalid characters or whitespace in it=" + + " = " + field ) + if val != [None]: + num_tapes = tape + # + # hist_fexcl1 can only be set if hist_empty is NOT true + # + var = "hist_fexcl1" + val = nmlgen.get_value(var) + if hist_empty: + if val != [None]: + raise SystemExit("hist_fexcl1 can not be set if hist_empty_htapes is set to true") + else: + for field in val: + if field is None: + break + match = re.search(r"^[A-Za-z0-9_.]+\s*$", field) + if match is None: + raise SystemExit( + "History field name " + + var + + " has invalid characters or whitespace in it=" + + field + ) + # + # Loop through history array types and make sure array sizes + # are consistent and match the expected number + # + for var in ( + "hist_mfilt", + "hist_ndens", + "hist_type1d_pertape", + "hist_nhtfrq", + "hist_dov2xy", + "hist_avgflag_pertape", + ): + val = nmlgen.get_value(var) + if val != [None]: + if len(val) != num_tapes: + raise SystemExit( + var + + " array size does not agree with the expected size of " + + str(num_tapes) + + " " + + str(val) + ) # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 0d68767f..368ff4ef 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -131,24 +131,14 @@ def test_check_nml_history(self): self.InitNML() self.nmlgen.set_value("hist_empty_htapes", ".false.") self.nmlgen.set_value("hist_fexcl1", ["A", "B", "C", "D", "E", "F"]) - self.nmlgen.set_value("hist_fexcl2", ["A", "B", "C", "D", "E", "F"]) - self.nmlgen.set_value("hist_fexcl3", ["A", "B", "C", "D", "E", "F"]) - self.nmlgen.set_value("hist_fexcl4", ["A", "B", "C", "D", "E", "F"]) - self.nmlgen.set_value("hist_fexcl5", ["A", "B", "C", "D", "E", "F"]) - self.nmlgen.set_value("hist_fexcl6", ["A", "B", "C", "D", "E", "F"]) check_nml_history(self.nmlgen) def test_check_nml_history_simple_fails_bad_timeavg(self): """Test the check nml history subroutine for simple fails bad time avg""" self.nmlgen.set_value("hist_fincl1", ["A:Z"]) - with self.assertRaisesRegex(SystemExit, "Bad averaging option"): - check_nml_history(self.nmlgen) - - def test_check_nml_history_simple_fails_bad_timeavg_per_tape(self): - """Test the check nml history subroutine for simple fails bad time avg per tape""" - self.nmlgen.set_value("hist_fincl1", ["A"]) - self.nmlgen.set_value("hist_avgflag_pertape", ["Z"]) - with self.assertRaisesRegex(SystemExit, "Bad averaging option per tape"): + with self.assertRaisesRegex( + SystemExit, "History averaging option Z is not valid in hist_fincl1" + ): check_nml_history(self.nmlgen) def test_check_nml_history_simple_fails_bad_characters(self): @@ -156,7 +146,7 @@ def test_check_nml_history_simple_fails_bad_characters(self): self.nmlgen.set_value("hist_fincl1", ["A%$#@!~"]) with self.assertRaisesRegex( SystemExit, - r"History field name hist_fincl1 has invalid characters or whitespace in it=" + r"History field name hist_fincl1 has invalid characters or whitespace in it=", ): check_nml_history(self.nmlgen) @@ -165,7 +155,7 @@ def test_check_nml_history_simple_fails_white_space_in_field(self): self.nmlgen.set_value("hist_fincl1", [" "]) with self.assertRaisesRegex( SystemExit, - r"History field name hist_fincl1 has invalid characters or whitespace in it=" + r"History field name hist_fincl1 has invalid characters or whitespace in it=", ): check_nml_history(self.nmlgen) @@ -175,14 +165,21 @@ def test_check_nml_history_complex_fails_array_size_not_consistent(self): self.nmlgen.set_value("hist_ndens", [1, 1]) self.nmlgen.set_value("hist_fincl2", ["A"]) with self.assertRaisesRegex( - SystemExit, "Sizes of history array options must be consistent" + SystemExit, r"hist_mfilt array size does not agree with the expected size of 2" ): check_nml_history(self.nmlgen) def test_check_nml_history_complex_fails_array_size(self): """Test the check nml history subroutine for complex fails array size""" - self.nmlgen.set_value("hist_fincl1", ["A", "B", "C", "D", "E", "F", "G"]) - with self.assertRaisesRegex(SystemExit, "History array options can not exceed array size"): + self.nmlgen.set_value("hist_mfilt", [1, 1, 1, 1, 1, 1, 1]) + self.nmlgen.set_value("hist_fincl2", ["A"]) + self.nmlgen.set_value("hist_fincl3", ["A"]) + self.nmlgen.set_value("hist_fincl4", ["A"]) + self.nmlgen.set_value("hist_fincl5", ["A"]) + self.nmlgen.set_value("hist_fincl6", ["A"]) + with self.assertRaisesRegex( + SystemExit, r"hist_mfilt array size does not agree with the expected size of 6" + ): check_nml_history(self.nmlgen) def test_check_nml_history_complex_fails_excl_with_empty(self): @@ -192,17 +189,7 @@ def test_check_nml_history_complex_fails_excl_with_empty(self): self.nmlgen.set_value("hist_empty_htapes", ".true.") self.nmlgen.set_value("hist_fexcl1", ["A"]) with self.assertRaisesRegex( - SystemExit, "Exclude history options can not be used when hist_empty_htapes is on" - ): - check_nml_history(self.nmlgen) - - def test_check_nml_history_complex_fails_excl_beyond_first(self): - """Test the check nml history subroutine for complex fails exclude used beyond first""" - self.nmlgen.set_value("hist_fexcl2", ["A"]) - with self.assertRaisesRegex( - SystemExit, - "Exclude history options should not be used for tape other than" - + " the first one which has defaults", + SystemExit, "hist_fexcl1 can not be set if hist_empty_htapes is set to true" ): check_nml_history(self.nmlgen) From 20537b4150fc8439ec68ba08439217fb7cd3f3a6 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 24 Sep 2022 22:31:00 -0600 Subject: [PATCH 078/164] Add a new sys test that duplicates the test-mod --- python/slim/test/test_sys_buildnml.py | 39 ++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 1abf2bd8..e8fe10b7 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -50,7 +50,7 @@ def addLinesToUserNL(user_nl_file, lines): print("Add lines to " + user_nl_file) with open(user_nl_file, "x") as userfile: for line in lines: - userfile.write(line) + userfile.write(line+"\n") print(line) userfile.close() print("Close file") @@ -112,6 +112,43 @@ def test_simple(self): "Input data list file should exist after running buildnml", ) + def test_default_testmod(self): + """Test the default testmod options call of buildnml""" + lines = [] + lines.append( "mml_surdat='/glade/p/cesmdata/cseg/inputdata/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc'") + lines.append( "hist_ndens = 1" ) + lines.append( "hist_nhtfrq =-24" ) + lines.append( "hist_mfilt = 5" ) + lines.append( "! Empty the default history tapes and just output the MML fields" ) + lines.append( "hist_empty_htapes = .true." ) + lines.append( "hist_fincl1 = 'MML_snowmaskdepth', 'MML_evap_rs', 'MML_bucket_cap', 'MML_soiltype', 'MML_roughness', 'MML_fsds', 'MML_fsdsnd'," ) + lines.append( "'MML_fsdsni'," ) + lines.append( "'MML_fsdsvd', 'MML_fsdsvi', 'MML_lwdn', 'MML_zref', 'MML_tbot', 'MML_thref', 'MML_qbot', 'MML_uref'," ) + lines.append( "'MML_eref', 'MML_pbot', 'MML_psrf', 'MML_pco2', 'MML_rhomol', 'MML_rhoair', 'MML_cpair', 'MML_prec_liq'," ) + lines.append( "'MML_prec_frz', 'MML_ts', 'MML_qs', 'MML_qa', 'MML_swabs', 'MML_fsr', 'MML_fsrnd', 'MML_fsrni'," ) + lines.append( "'MML_fsrvd', 'MML_fsrvi', 'MML_snowmelt', 'MML_l2a_taux', 'MML_l2a_tauy', 'MML_lwup', 'MML_shflx', 'MML_lhflx'," ) + lines.append( "'MML_gsoi', 'MML_gsnow', 'MML_evap', 'MML_ustar', 'MML_tstar', 'MML_qstar', 'MML_tvstar', 'MML_obu'," ) + lines.append( "'MML_ram', 'MML_rah', 'MML_z0m', 'MML_z0h', 'MML_alb', 'MML_fsns', 'MML_flns', 'MML_maxice'," ) + lines.append( "'MML_soilz', 'MML_soil_t', 'MML_soil_liq', 'MML_soil_ice', 'MML_dz', 'MML_zh', 'MML_tk', 'MML_tkh'," ) + lines.append( "'MML_dtsoi', 'MML_cv', 'MML_water', 'MML_snow', 'MML_runoff', 'MML_l2a_tref2m', 'MML_l2a_qref2m', 'MML_l2a_uref10m'," ) + lines.append( "'MML_diag1_1d', 'MML_diag2_1d', 'MML_diag3_1d', 'MML_diag1_2d', 'MML_diag2_2d', 'MML_diag3_2d', 'MML_q_excess'," ) + lines.append( "'MML_lh_excess'," ) + lines.append( "'MML_q_demand', 'MML_lh_demand', 'mml_err_h2o', 'mml_err_h2osno', 'mml_err_seb', 'mml_err_soi', 'mml_err_sol', 'WIND'," ) + lines.append( "'THBOT', 'RAIN', 'SNOW', 'RH'" ) + addLinesToUserNL("user_nl_slim", lines) + buildnml(self.case, self._testdir, "slim") + expect( + os.path.isfile("Buildconf/slimconf/lnd_in"), + "Namelist file lnd_in should exist in Buildconf after running buildnml", + ) + expect( + os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml" + ) + expect( + os.path.isfile("Buildconf/slim.input_data_list"), + "Input data list file should exist after running buildnml", + ) + def test_hybrid_start(self): """Test a hybrid startup call of buildnml""" self.case.set_value("SLIM_START_TYPE", "required") From 63ebcf95f0b18c7a6998e050ddc2068ac29e7799 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 24 Sep 2022 22:40:37 -0600 Subject: [PATCH 079/164] Run through black and shorten long lines so pylint passes as well --- python/slim/test/test_sys_buildnml.py | 62 ++++++++++++++++----------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index e8fe10b7..25a3363e 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -50,7 +50,7 @@ def addLinesToUserNL(user_nl_file, lines): print("Add lines to " + user_nl_file) with open(user_nl_file, "x") as userfile: for line in lines: - userfile.write(line+"\n") + userfile.write(line + "\n") print(line) userfile.close() print("Close file") @@ -115,35 +115,49 @@ def test_simple(self): def test_default_testmod(self): """Test the default testmod options call of buildnml""" lines = [] - lines.append( "mml_surdat='/glade/p/cesmdata/cseg/inputdata/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc'") - lines.append( "hist_ndens = 1" ) - lines.append( "hist_nhtfrq =-24" ) - lines.append( "hist_mfilt = 5" ) - lines.append( "! Empty the default history tapes and just output the MML fields" ) - lines.append( "hist_empty_htapes = .true." ) - lines.append( "hist_fincl1 = 'MML_snowmaskdepth', 'MML_evap_rs', 'MML_bucket_cap', 'MML_soiltype', 'MML_roughness', 'MML_fsds', 'MML_fsdsnd'," ) - lines.append( "'MML_fsdsni'," ) - lines.append( "'MML_fsdsvd', 'MML_fsdsvi', 'MML_lwdn', 'MML_zref', 'MML_tbot', 'MML_thref', 'MML_qbot', 'MML_uref'," ) - lines.append( "'MML_eref', 'MML_pbot', 'MML_psrf', 'MML_pco2', 'MML_rhomol', 'MML_rhoair', 'MML_cpair', 'MML_prec_liq'," ) - lines.append( "'MML_prec_frz', 'MML_ts', 'MML_qs', 'MML_qa', 'MML_swabs', 'MML_fsr', 'MML_fsrnd', 'MML_fsrni'," ) - lines.append( "'MML_fsrvd', 'MML_fsrvi', 'MML_snowmelt', 'MML_l2a_taux', 'MML_l2a_tauy', 'MML_lwup', 'MML_shflx', 'MML_lhflx'," ) - lines.append( "'MML_gsoi', 'MML_gsnow', 'MML_evap', 'MML_ustar', 'MML_tstar', 'MML_qstar', 'MML_tvstar', 'MML_obu'," ) - lines.append( "'MML_ram', 'MML_rah', 'MML_z0m', 'MML_z0h', 'MML_alb', 'MML_fsns', 'MML_flns', 'MML_maxice'," ) - lines.append( "'MML_soilz', 'MML_soil_t', 'MML_soil_liq', 'MML_soil_ice', 'MML_dz', 'MML_zh', 'MML_tk', 'MML_tkh'," ) - lines.append( "'MML_dtsoi', 'MML_cv', 'MML_water', 'MML_snow', 'MML_runoff', 'MML_l2a_tref2m', 'MML_l2a_qref2m', 'MML_l2a_uref10m'," ) - lines.append( "'MML_diag1_1d', 'MML_diag2_1d', 'MML_diag3_1d', 'MML_diag1_2d', 'MML_diag2_2d', 'MML_diag3_2d', 'MML_q_excess'," ) - lines.append( "'MML_lh_excess'," ) - lines.append( "'MML_q_demand', 'MML_lh_demand', 'mml_err_h2o', 'mml_err_h2osno', 'mml_err_seb', 'mml_err_soi', 'mml_err_sol', 'WIND'," ) - lines.append( "'THBOT', 'RAIN', 'SNOW', 'RH'" ) + lines.append( + "mml_surdat='/glade/p/cesmdata/cseg/inputdata/lnd/slim/surdat/" + + "slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max" + + "-ctrl-bucket_rs150_c20210401.nc'" + ) + lines.append("hist_ndens = 1") + lines.append("hist_nhtfrq =-24") + lines.append("hist_mfilt = 5") + lines.append("! Empty the default history tapes and just output the MML fields") + lines.append("hist_empty_htapes = .true.") + lines.append( + "hist_fincl1 = 'MML_snowmaskdepth', 'MML_evap_rs', 'MML_bucket_cap', 'MML_soiltype'," + ) + lines.append(" 'MML_roughness', 'MML_fsds', 'MML_fsdsnd','MML_fsdsni',") + lines.append("'MML_fsdsvd', 'MML_fsdsvi', 'MML_lwdn', 'MML_zref', 'MML_tbot', 'MML_thref'") + lines.append(",'MML_qbot', 'MML_uref',") + lines.append("'MML_eref', 'MML_pbot', 'MML_psrf', 'MML_pco2', 'MML_rhomol', 'MML_rhoair'") + lines.append(", 'MML_cpair', 'MML_prec_liq',") + lines.append("'MML_prec_frz', 'MML_ts', 'MML_qs', 'MML_qa', 'MML_swabs', 'MML_fsr',") + lines.append(" 'MML_fsrnd', 'MML_fsrni',") + lines.append("'MML_fsrvd', 'MML_fsrvi', 'MML_snowmelt', 'MML_l2a_taux', 'MML_l2a_tauy',") + lines.append(" 'MML_lwup', 'MML_shflx', 'MML_lhflx',") + lines.append("'MML_gsoi', 'MML_gsnow', 'MML_evap', 'MML_ustar', 'MML_tstar', 'MML_qstar',") + lines.append(" 'MML_tvstar', 'MML_obu',") + lines.append("'MML_ram', 'MML_rah', 'MML_z0m', 'MML_z0h', 'MML_alb', 'MML_fsns',") + lines.append(" 'MML_flns', 'MML_maxice',") + lines.append("'MML_soilz', 'MML_soil_t', 'MML_soil_liq', 'MML_soil_ice', 'MML_dz',") + lines.append("'MML_zh', 'MML_tk', 'MML_tkh',") + lines.append("'MML_dtsoi', 'MML_cv', 'MML_water', 'MML_snow', 'MML_runoff',") + lines.append(" 'MML_l2a_tref2m', 'MML_l2a_qref2m', 'MML_l2a_uref10m',") + lines.append("'MML_diag1_1d', 'MML_diag2_1d', 'MML_diag3_1d', 'MML_diag1_2d',") + lines.append(" 'MML_diag2_2d', 'MML_diag3_2d', 'MML_q_excess',") + lines.append("'MML_lh_excess',") + lines.append("'MML_q_demand', 'MML_lh_demand', 'mml_err_h2o', 'mml_err_h2osno',") + lines.append("'mml_err_seb', 'mml_err_soi', 'mml_err_sol', 'WIND',") + lines.append("'THBOT', 'RAIN', 'SNOW', 'RH'") addLinesToUserNL("user_nl_slim", lines) buildnml(self.case, self._testdir, "slim") expect( os.path.isfile("Buildconf/slimconf/lnd_in"), "Namelist file lnd_in should exist in Buildconf after running buildnml", ) - expect( - os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml" - ) + expect(os.path.isfile("lnd_in"), "Namelist file lnd_in should exist after running buildnml") expect( os.path.isfile("Buildconf/slim.input_data_list"), "Input data list file should exist after running buildnml", From 2f805290d77d39d68f36ce3c1d857b02e9a12783 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 24 Sep 2022 22:46:42 -0600 Subject: [PATCH 080/164] Remove hist_type1d_pertape and hist_dov2xy as there is no reason for SLIM to need this functionality --- cime_config/namelist_definition_slim.xml | 24 ------------------------ cime_config/slim_cime_py/buildnml.py | 2 -- python/slim/test/test_unit_buildnml.py | 1 - 3 files changed, 27 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index d679409d..d2ce4f31 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -136,30 +136,6 @@ - - char(6) - history - slim_history - GRID - - Averaging type of output for 1D vector output (when hist_dov2xy is false). - GRID means average all land-units up to the grid-point level - - - - - logical(6) - history - slim_history - - If TRUE, implies output data on a 2D latitude/longitude grid. False means - output in 1D vector format. One setting per history tape series. - - - .true. - - - logical history diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 37638a79..15a0060a 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -183,9 +183,7 @@ def check_nml_history(nmlgen): for var in ( "hist_mfilt", "hist_ndens", - "hist_type1d_pertape", "hist_nhtfrq", - "hist_dov2xy", "hist_avgflag_pertape", ): val = nmlgen.get_value(var) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 368ff4ef..fc2b07e2 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -119,7 +119,6 @@ def test_check_nml_history(self): self.nmlgen.set_value("hist_ndens", [1, 1, 2, 1, 1, 1]) self.nmlgen.set_value("hist_nhtfrq", [1, 1, -24, 2, 2, 2]) self.nmlgen.set_value("hist_avgflag_pertape", ["A", "I", "X", "M", "A", "A"]) - self.nmlgen.set_value("hist_dov2xy", [".true.", "TRUE", "FALSE", ".T.", ".F.", ".true."]) self.nmlgen.set_value("hist_fincl1", ["A:I", "B:A", "C:X", "D:M", "E:A", "F:A"]) self.nmlgen.set_value("hist_fincl2", ["A", "B", "C", "D", "E", "F"]) self.nmlgen.set_value("hist_fincl3", ["A", "B", "C", "D", "E", "F"]) From 0f6fa565814b6f5f020d0616ff3d05129b1c1e94 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 01:41:22 -0600 Subject: [PATCH 081/164] Add some checks for use_init_interp some of which fail --- python/slim/test/test_unit_buildnml.py | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index fc2b07e2..3877f28b 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -268,6 +268,53 @@ def test_check_init_data(self): ): check_nml_initial_conditions(self.nmlgen, self.case) + def test_check_use_init_interp(self): + """Test the check nml initial data subroutine for use_init_interp options""" + self.case.set_value("SLIM_START_TYPE", "startup") + finidat = "finidat_file_to_interpolate_from.nc" + self.nmlgen.set_value("finidat", finidat) + Path(finidat).touch() + self.nmlgen.set_value("use_init_interp", ".true.") + finidat_dest = "finidat_file_to_create.nc" + self.nmlgen.set_value("finidat_interp_dest", finidat_dest) + check_nml_initial_conditions(self.nmlgen, self.case) + + def test_check_use_init_interp_fails_cold(self): + """Test the check nml initial data subroutine for use_init_interp options that fail 1""" + # Cold start with use_init_interp should fail + self.case.set_value("SLIM_START_TYPE", "cold") + self.nmlgen.set_value("use_init_interp", ".true.") + with self.assertRaisesRegex( + SystemExit, "use_init_interp can not be set to TRUE for a cold start" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + + def test_check_use_init_interp_fails_setdest(self): + """Test the check nml initial data subroutine for use_init_interp options that fail 2""" + # Setting finidat_interp_dest without use_init_interp should fail + self.nmlgen.set_value("use_init_interp", ".false.") + finidat_dest = "finidat_file_to_create.nc" + self.nmlgen.set_value("finidat_interp_dest", finidat_dest) + with self.assertRaisesRegex( + SystemExit, "finidat_interp_dest can NOT be set if use_init_interp is not on" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + + def test_check_use_init_interp_fails_branch(self): + """Test the check nml initial data subroutine for use_init_interp options that fail 3""" + # Branch type should fail for use_init_interp set + self.case.set_value("RUN_TYPE", "branch") + self.case.set_value("SLIM_START_TYPE", "required") + self.case.set_value("RUN_REFCASE", "TESTCASE") + self.case.set_value("RUN_REFDATE", "0001-01-01") + nrevsn = "TESTCASE.slim.r.0001-01-01-00000.nc" + self.nmlgen.set_value("use_init_interp", ".true.") + Path(nrevsn).touch() + with self.assertRaisesRegex( + SystemExit, "use_init_interp can NOT be set to TRUE for a branch run type" + ): + check_nml_initial_conditions(self.nmlgen, self.case) + def test_check_init_data_branch(self): """Test the check nml initial data subroutine for branch""" # From 0d0d9fb37437d4bd3555624386099f1ff787396b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 02:16:11 -0600 Subject: [PATCH 082/164] Get unit test working for setting use_init_interp to true for a cold start --- python/slim/test/test_unit_buildnml.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 3877f28b..cdb2b693 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -278,16 +278,18 @@ def test_check_use_init_interp(self): finidat_dest = "finidat_file_to_create.nc" self.nmlgen.set_value("finidat_interp_dest", finidat_dest) check_nml_initial_conditions(self.nmlgen, self.case) + check_nml_data(self.nmlgen) def test_check_use_init_interp_fails_cold(self): """Test the check nml initial data subroutine for use_init_interp options that fail 1""" # Cold start with use_init_interp should fail self.case.set_value("SLIM_START_TYPE", "cold") self.nmlgen.set_value("use_init_interp", ".true.") + check_nml_initial_conditions(self.nmlgen, self.case) with self.assertRaisesRegex( SystemExit, "use_init_interp can not be set to TRUE for a cold start" ): - check_nml_initial_conditions(self.nmlgen, self.case) + check_nml_data(self.nmlgen) def test_check_use_init_interp_fails_setdest(self): """Test the check nml initial data subroutine for use_init_interp options that fail 2""" @@ -295,10 +297,11 @@ def test_check_use_init_interp_fails_setdest(self): self.nmlgen.set_value("use_init_interp", ".false.") finidat_dest = "finidat_file_to_create.nc" self.nmlgen.set_value("finidat_interp_dest", finidat_dest) + check_nml_initial_conditions(self.nmlgen, self.case) with self.assertRaisesRegex( SystemExit, "finidat_interp_dest can NOT be set if use_init_interp is not on" ): - check_nml_initial_conditions(self.nmlgen, self.case) + check_nml_data(self.nmlgen) def test_check_use_init_interp_fails_branch(self): """Test the check nml initial data subroutine for use_init_interp options that fail 3""" @@ -310,10 +313,11 @@ def test_check_use_init_interp_fails_branch(self): nrevsn = "TESTCASE.slim.r.0001-01-01-00000.nc" self.nmlgen.set_value("use_init_interp", ".true.") Path(nrevsn).touch() + check_nml_initial_conditions(self.nmlgen, self.case) with self.assertRaisesRegex( SystemExit, "use_init_interp can NOT be set to TRUE for a branch run type" ): - check_nml_initial_conditions(self.nmlgen, self.case) + check_nml_data(self.nmlgen) def test_check_init_data_branch(self): """Test the check nml initial data subroutine for branch""" From 2a50d6365d98b1a2673ab20870c7c7f1ee2b98d3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 02:16:26 -0600 Subject: [PATCH 083/164] Get unit test working for setting use_init_interp to true for a cold start --- cime_config/slim_cime_py/buildnml.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 15a0060a..a78aaa96 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -276,7 +276,7 @@ def check_nml_initial_conditions(nmlgen, case, inst_string=""): #################################################################################### def check_nml_data(nmlgen): #################################################################################### - """Set the namelist settings for data""" + """Set the namelist settings for data must be after check_nml_initial_conditions""" # pylint: disable=global-statement global logger # ------------------------------------------------------ @@ -286,6 +286,19 @@ def check_nml_data(nmlgen): if mml_surdat == "UNSET": raise SystemExit("mml_surdat file is NOT set and is required") + # + # use_init_interp requires that finidat be set + # + finidat = nmlgen.get_value("finidat") + use_init_interp = nmlgen.get_value("use_init_interp") + if use_init_interp is not None: + interp = literal_to_python_value(use_init_interp, type_="logical") + else: + interp = False + + if finidat == " " and interp: + raise SystemExit("use_init_interp can not be set to TRUE for a cold start") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements # Turn off unused-argument for inst_string, since isn't in place right now From bf700af3ad3663c8ae9b364e037154598562cdcb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 02:22:06 -0600 Subject: [PATCH 084/164] Add check for use_init_interp and branch run_type --- cime_config/slim_cime_py/buildnml.py | 10 ++++++++-- python/slim/test/test_unit_buildnml.py | 16 ++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index a78aaa96..6b635a92 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -274,7 +274,7 @@ def check_nml_initial_conditions(nmlgen, case, inst_string=""): # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements #################################################################################### -def check_nml_data(nmlgen): +def check_nml_data(nmlgen, case): #################################################################################### """Set the namelist settings for data must be after check_nml_initial_conditions""" # pylint: disable=global-statement @@ -298,6 +298,12 @@ def check_nml_data(nmlgen): if finidat == " " and interp: raise SystemExit("use_init_interp can not be set to TRUE for a cold start") + # + # use_init_interp can not be set for a branch case + # + run_type = case.get_value("RUN_TYPE") + if run_type == "branch" and interp: + raise SystemExit("use_init_interp can NOT be set to TRUE for a branch run type") # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements @@ -338,7 +344,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path check_nml_performance(nmlgen) check_nml_history(nmlgen) check_nml_initial_conditions(nmlgen, case, inst_string) - check_nml_data(nmlgen) + check_nml_data(nmlgen, case) # ---------------------------------------------------- # Write output namelist diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index cdb2b693..1e611468 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -215,23 +215,23 @@ def test_check_nml_data(self): self.case.set_value("SLIM_SCENARIO", scen) print("SLIM_SCENARIO = " + scen) self.InitNML() - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) # 1-degree has one dataset self.case.set_value("LND_GRID", "0.9x1.25") self.case.set_value("SLIM_SCENARIO", "realistic_from_2000") self.InitNML() - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) # Check that 1-degree for another scenario fails self.case.set_value("SLIM_SCENARIO", "global_uniform") self.InitNML() with self.assertRaisesRegex(SystemExit, " file is NOT set and is required"): - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) # make the dataset unset and make sure it fails var = "mml_surdat" self.nmlgen.set_value(var, "UNSET") with self.assertRaisesRegex(SystemExit, var + " file is NOT set and is required"): - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) def test_check_init_data(self): """Test the check nml initial data subroutine""" @@ -278,7 +278,7 @@ def test_check_use_init_interp(self): finidat_dest = "finidat_file_to_create.nc" self.nmlgen.set_value("finidat_interp_dest", finidat_dest) check_nml_initial_conditions(self.nmlgen, self.case) - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) def test_check_use_init_interp_fails_cold(self): """Test the check nml initial data subroutine for use_init_interp options that fail 1""" @@ -289,7 +289,7 @@ def test_check_use_init_interp_fails_cold(self): with self.assertRaisesRegex( SystemExit, "use_init_interp can not be set to TRUE for a cold start" ): - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) def test_check_use_init_interp_fails_setdest(self): """Test the check nml initial data subroutine for use_init_interp options that fail 2""" @@ -301,7 +301,7 @@ def test_check_use_init_interp_fails_setdest(self): with self.assertRaisesRegex( SystemExit, "finidat_interp_dest can NOT be set if use_init_interp is not on" ): - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) def test_check_use_init_interp_fails_branch(self): """Test the check nml initial data subroutine for use_init_interp options that fail 3""" @@ -317,7 +317,7 @@ def test_check_use_init_interp_fails_branch(self): with self.assertRaisesRegex( SystemExit, "use_init_interp can NOT be set to TRUE for a branch run type" ): - check_nml_data(self.nmlgen) + check_nml_data(self.nmlgen, self.case) def test_check_init_data_branch(self): """Test the check nml initial data subroutine for branch""" From abf13e29cb79e46ef980c86b47541bed11a6ae66 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 02:26:22 -0600 Subject: [PATCH 085/164] Add check that finidat_interp_dest can only be set if use_init_interp is set --- cime_config/slim_cime_py/buildnml.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 6b635a92..159a2dfe 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -305,6 +305,13 @@ def check_nml_data(nmlgen, case): if run_type == "branch" and interp: raise SystemExit("use_init_interp can NOT be set to TRUE for a branch run type") + # + # finidat destination file can only be set if interp is on + # + finidat_dest = nmlgen.get_value("finidat_interp_dest") + if finidat_dest is not None and not interp: + raise SystemExit("finidat_interp_dest can NOT be set if use_init_interp is not on") + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements # Turn off unused-argument for inst_string, since isn't in place right now From 52f677fd4dd570a8620903a3d337a8e6be9ff634 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 16:32:54 -0600 Subject: [PATCH 086/164] Add some tests for dtime check --- python/slim/test/test_unit_buildnml.py | 43 ++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 1e611468..47738383 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -361,6 +361,49 @@ def test_check_init_data_hybrid(self): "finidat should be set correctly for hybrid case", ) + def test_check_dtime(self): + """Test the check nml dtime""" + self.case.set_value("NCPL_BASE_PERIOD", "hour") + self.case.set_value("CALENDAR", "GREGORIAN") + self.case.set_value("LND_NCPL", 1) + self.InitNML() + check_nml_dtime(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("dtime"), + 3600, + "dtime should be 3600 seconds for an hour", + ) + self.case.set_value("NCPL_BASE_PERIOD", "day") + self.case.set_value("CALENDAR", "NO_LEAP") + self.case.set_value("LND_NCPL", 48) + self.InitNML() + check_nml_dtime(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("dtime"), + 1800, + "dtime should be 1800 seconds for 48 cycles per day", + ) + self.case.set_value("NCPL_BASE_PERIOD", "year") + self.case.set_value("CALENDAR", "NO_LEAP") + self.case.set_value("LND_NCPL", 365) + self.InitNML() + check_nml_dtime(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("dtime"), + 86400, + "dtime should be 86400 seconds for 365 cycles per year", + ) + self.case.set_value("NCPL_BASE_PERIOD", "year") + self.case.set_value("CALENDAR", "NO_LEAP") + self.case.set_value("LND_NCPL", 36500) + self.InitNML() + check_nml_dtime(self.nmlgen, self.case) + expect( + self.nmlgen.get_value("dtime"), + 8640, + "dtime should be 8640 seconds for 36500 cycles per decade", + ) + if __name__ == "__main__": unit_testing.setup_for_tests() From 08357745c634bbaf10caa0b5d88a33682b483a5e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 16:57:43 -0600 Subject: [PATCH 087/164] Add dtime check for invalid calendars --- cime_config/slim_cime_py/buildnml.py | 2 +- python/slim/test/test_unit_buildnml.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 159a2dfe..449c711c 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -38,7 +38,7 @@ def check_nml_dtime(nmlgen, case): else: expect( False, - "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period, + "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period, ) else: expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 47738383..337c5a23 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -404,6 +404,24 @@ def test_check_dtime(self): "dtime should be 8640 seconds for 36500 cycles per decade", ) + def test_check_dtime_fail_invalid_cal_year(self): + """Test the check nml dtime fail test for invalid calendar year""" + self.case.set_value("NCPL_BASE_PERIOD", "year") + self.case.set_value("CALENDAR", "GREGORIAN") + self.case.set_value("LND_NCPL", 1) + self.InitNML() + with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD year"): + check_nml_dtime(self.nmlgen, self.case) + + def test_check_dtime_fail_invalid_cal_decade(self): + """Test the check nml dtime fail test for invalid calendar decade""" + self.case.set_value("NCPL_BASE_PERIOD", "decade") + self.case.set_value("CALENDAR", "GREGORIAN") + self.case.set_value("LND_NCPL", 1) + self.InitNML() + with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD decade"): + check_nml_dtime(self.nmlgen, self.case) + if __name__ == "__main__": unit_testing.setup_for_tests() From 031c57113e639e0b4c4491a01b4fb5641f43160b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 17:02:25 -0600 Subject: [PATCH 088/164] Add test for bad ncpl base period --- cime_config/slim_cime_py/buildnml.py | 2 +- python/slim/test/test_unit_buildnml.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 449c711c..2b4d01fc 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -41,7 +41,7 @@ def check_nml_dtime(nmlgen, case): "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period, ) else: - expect(False, "invalid NCPL_BASE_PERIOD NCPL_BASE_PERIOD %s " % ncpl_base_period) + expect(False, "Invalid NCPL_BASE_PERIOD %s " % ncpl_base_period) logger.info(" basedt = %s", str(basedt)) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 337c5a23..042bbfac 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -409,7 +409,6 @@ def test_check_dtime_fail_invalid_cal_year(self): self.case.set_value("NCPL_BASE_PERIOD", "year") self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 1) - self.InitNML() with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD year"): check_nml_dtime(self.nmlgen, self.case) @@ -418,10 +417,18 @@ def test_check_dtime_fail_invalid_cal_decade(self): self.case.set_value("NCPL_BASE_PERIOD", "decade") self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 1) - self.InitNML() with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD decade"): check_nml_dtime(self.nmlgen, self.case) + def test_check_dtime_fail_invalid_base_period(self): + """Test the check nml dtime fail test for invalid base period""" + self.case.set_value("NCPL_BASE_PERIOD", "minute") + self.case.set_value("CALENDAR", "GREGORIAN") + self.case.set_value("LND_NCPL", 1) + with self.assertRaisesRegex(SystemExit, "ERROR: Invalid NCPL_BASE_PERIOD "): + check_nml_dtime(self.nmlgen, self.case) + + if __name__ == "__main__": unit_testing.setup_for_tests() From 228b9c76c7ad2efa2f97edfec3dd58f17c1afa95 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 17:11:16 -0600 Subject: [PATCH 089/164] Add a check for dividing by number of coupling time steps that doesn't evenly divide --- cime_config/slim_cime_py/buildnml.py | 2 +- python/slim/test/test_unit_buildnml.py | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 2b4d01fc..c6f5866a 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -52,7 +52,7 @@ def check_nml_dtime(nmlgen, case): if basedt % lnd_ncpl != 0: expect( False, - "lnd_ncpl %s doesn't divide evenly into basedt %s\n" % (lnd_ncpl, basedt), + "LND_NCPL=%s doesn't divide evenly into NCPL_BASE_PERIOD %s\n" % (lnd_ncpl, ncpl_base_period), ) else: dtime = basedt // lnd_ncpl diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 042bbfac..4a4fef5d 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -428,6 +428,14 @@ def test_check_dtime_fail_invalid_base_period(self): with self.assertRaisesRegex(SystemExit, "ERROR: Invalid NCPL_BASE_PERIOD "): check_nml_dtime(self.nmlgen, self.case) + def test_check_dtime_fail_invalid_division(self): + """Test the check nml dtime fail test for invalid coupling division""" + self.case.set_value("NCPL_BASE_PERIOD", "day") + self.case.set_value("CALENDAR", "GREGORIAN") + self.case.set_value("LND_NCPL", 47) + with self.assertRaisesRegex(SystemExit, "ERROR: LND_NCPL=47 doesn't divide evenly into NCPL_BASE_PERIOD day"): + check_nml_dtime(self.nmlgen, self.case) + if __name__ == "__main__": From ebc70f7da5d41177867a1710d4cc7930b67f44f9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 17:14:57 -0600 Subject: [PATCH 090/164] Run through black and get lint to work --- cime_config/slim_cime_py/buildnml.py | 3 ++- python/slim/test/test_unit_buildnml.py | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index c6f5866a..69e3de2c 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -52,7 +52,8 @@ def check_nml_dtime(nmlgen, case): if basedt % lnd_ncpl != 0: expect( False, - "LND_NCPL=%s doesn't divide evenly into NCPL_BASE_PERIOD %s\n" % (lnd_ncpl, ncpl_base_period), + "LND_NCPL=%s doesn't divide evenly into NCPL_BASE_PERIOD %s\n" + % (lnd_ncpl, ncpl_base_period), ) else: dtime = basedt // lnd_ncpl diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 4a4fef5d..cbee6cda 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -37,6 +37,7 @@ class TestPathUtils(unittest.TestCase): + # pylint: disable=too-many-public-methods """Tests of buildnml""" def setUp(self): @@ -409,16 +410,20 @@ def test_check_dtime_fail_invalid_cal_year(self): self.case.set_value("NCPL_BASE_PERIOD", "year") self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 1) - with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD year"): - check_nml_dtime(self.nmlgen, self.case) + with self.assertRaisesRegex( + SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD year" + ): + check_nml_dtime(self.nmlgen, self.case) def test_check_dtime_fail_invalid_cal_decade(self): """Test the check nml dtime fail test for invalid calendar decade""" self.case.set_value("NCPL_BASE_PERIOD", "decade") self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 1) - with self.assertRaisesRegex(SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD decade"): - check_nml_dtime(self.nmlgen, self.case) + with self.assertRaisesRegex( + SystemExit, "ERROR: Invalid CALENDAR for NCPL_BASE_PERIOD decade" + ): + check_nml_dtime(self.nmlgen, self.case) def test_check_dtime_fail_invalid_base_period(self): """Test the check nml dtime fail test for invalid base period""" @@ -426,16 +431,17 @@ def test_check_dtime_fail_invalid_base_period(self): self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 1) with self.assertRaisesRegex(SystemExit, "ERROR: Invalid NCPL_BASE_PERIOD "): - check_nml_dtime(self.nmlgen, self.case) + check_nml_dtime(self.nmlgen, self.case) def test_check_dtime_fail_invalid_division(self): """Test the check nml dtime fail test for invalid coupling division""" self.case.set_value("NCPL_BASE_PERIOD", "day") self.case.set_value("CALENDAR", "GREGORIAN") self.case.set_value("LND_NCPL", 47) - with self.assertRaisesRegex(SystemExit, "ERROR: LND_NCPL=47 doesn't divide evenly into NCPL_BASE_PERIOD day"): - check_nml_dtime(self.nmlgen, self.case) - + with self.assertRaisesRegex( + SystemExit, "ERROR: LND_NCPL=47 doesn't divide evenly into NCPL_BASE_PERIOD day" + ): + check_nml_dtime(self.nmlgen, self.case) if __name__ == "__main__": From 7849bf30ab8c844c4de55c3138315f6e0f17af0a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 17:31:27 -0600 Subject: [PATCH 091/164] Add check for dtime being either too long or too short --- python/slim/test/test_unit_buildnml.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index cbee6cda..250e9769 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -443,6 +443,26 @@ def test_check_dtime_fail_invalid_division(self): ): check_nml_dtime(self.nmlgen, self.case) + def test_check_dtime_fail_too_short(self): + """Test the check nml dtime fail test for too short""" + self.case.set_value("NCPL_BASE_PERIOD", "hour") + self.case.set_value("LND_NCPL", 3600) + with self.assertRaisesRegex( + SystemExit, + "ERROR: LND_NCPL=3600 is too frequent which gives a time step that is too short", + ): + check_nml_dtime(self.nmlgen, self.case) + + def test_check_dtime_fail_too_long(self): + """Test the check nml dtime fail test for too long""" + self.case.set_value("NCPL_BASE_PERIOD", "day") + self.case.set_value("LND_NCPL", 1) + with self.assertRaisesRegex( + SystemExit, + "ERROR: LND_NCPL=1 is too infrequent which gives a time step that is too long", + ): + check_nml_dtime(self.nmlgen, self.case) + if __name__ == "__main__": unit_testing.setup_for_tests() From 116b573ab6054b4dd1a2a67037d47900b09195ee Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 25 Sep 2022 17:40:09 -0600 Subject: [PATCH 092/164] Add check for dtime too short or too long --- cime_config/slim_cime_py/buildnml.py | 9 +++++++++ python/slim/test/test_unit_buildnml.py | 7 ++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 69e3de2c..b6c026f3 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -57,6 +57,15 @@ def check_nml_dtime(nmlgen, case): ) else: dtime = basedt // lnd_ncpl + + expect( + dtime > 1, + "LND_NCPL=%s is too frequent which gives a time step that is too short\n" % lnd_ncpl, + ) + expect( + dtime <= 86400, + "LND_NCPL=%s is too infrequent which gives a time step that is too long\n" % lnd_ncpl, + ) nmlgen.set_value("dtime", value=dtime) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 250e9769..6c6c18ad 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -455,11 +455,12 @@ def test_check_dtime_fail_too_short(self): def test_check_dtime_fail_too_long(self): """Test the check nml dtime fail test for too long""" - self.case.set_value("NCPL_BASE_PERIOD", "day") - self.case.set_value("LND_NCPL", 1) + self.case.set_value("NCPL_BASE_PERIOD", "year") + self.case.set_value("CALENDAR", "NO_LEAP") + self.case.set_value("LND_NCPL", 5) with self.assertRaisesRegex( SystemExit, - "ERROR: LND_NCPL=1 is too infrequent which gives a time step that is too long", + "ERROR: LND_NCPL=5 is too infrequent which gives a time step that is too long", ): check_nml_dtime(self.nmlgen, self.case) From efa9123bd1ef6096e87951d00735755e5190ad7b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Sep 2022 17:41:09 -0600 Subject: [PATCH 093/164] Add use_noio namelist item to turn off all history output --- cime_config/namelist_definition_slim.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index d2ce4f31..f421a881 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -146,6 +146,15 @@ + + logical + history + slim_history + + Toggle to turn all history output completely OFF (possibly used for testing) + + + char(1000) history From 90bc9ba22e9e9ad823666b07c56e4b8543fc4e84 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Sep 2022 17:50:19 -0600 Subject: [PATCH 094/164] Add some checks for use_noio --- python/slim/test/test_unit_buildnml.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 6c6c18ad..f2c3b87c 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -115,6 +115,7 @@ def test_check_nml_history(self): self.InitNML() # Make a list of settings to a list of history tape streams + self.nmlgen.set_value("use_noio", ".false.") self.nmlgen.set_value("hist_empty_htapes", ".true.") self.nmlgen.set_value("hist_mfilt", [1, 1, 2, 3, 4, 5]) self.nmlgen.set_value("hist_ndens", [1, 1, 2, 1, 1, 1]) @@ -132,6 +133,10 @@ def test_check_nml_history(self): self.nmlgen.set_value("hist_empty_htapes", ".false.") self.nmlgen.set_value("hist_fexcl1", ["A", "B", "C", "D", "E", "F"]) check_nml_history(self.nmlgen) + # Check that use_noio works if you don't set any hist_* options + self.InitNML() + self.nmlgen.set_value("use_noio", ".true.") + check_nml_history(self.nmlgen) def test_check_nml_history_simple_fails_bad_timeavg(self): """Test the check nml history subroutine for simple fails bad time avg""" @@ -193,6 +198,18 @@ def test_check_nml_history_complex_fails_excl_with_empty(self): ): check_nml_history(self.nmlgen) + def test_check_nml_history_fails_excl_use_noio(self): + """Test the check nml history subroutine for fails use_noio used with other + history settings + """ + self.nmlgen.set_value("use_noio", ".true.") + self.nmlgen.set_value("hist_fincl1", ["A"]) + with self.assertRaisesRegex( + SystemExit, + "use_noio turns off all history output, so no hist_* namelist option should be set", + ): + check_nml_history(self.nmlgen) + def test_check_nml_general(self): """Test the check nml general subroutine""" self.case.set_value("SLIM_START_TYPE", "cold") From 1af29bbfa93806d0fac92e423a0e6efe1099fb1c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Sep 2022 18:30:41 -0600 Subject: [PATCH 095/164] Make sure no other history options are set when use_noio is on (except hist_nhtfrq), get all python tests passing, add notes about namelist items --- cime_config/namelist_definition_slim.xml | 4 +++ cime_config/slim_cime_py/buildnml.py | 40 ++++++++++++++++++++++++ python/slim/test/test_unit_buildnml.py | 3 +- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index f421a881..44e3f7ff 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -6,6 +6,8 @@ + + @@ -120,6 +122,7 @@ + @@ -236,6 +239,7 @@ + integer(6) history diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index b6c026f3..2bc978a1 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -206,6 +206,46 @@ def check_nml_history(nmlgen): + " " + str(val) ) + # + # History options should not be used when use_noio is on, because it turns off all history... + # + use_noio = nmlgen.get_value("use_noio") + if use_noio is not None: + noio = literal_to_python_value(use_noio, type_="logical") + else: + noio = False + + if noio: + # NOTE: hist_nhtfrq is excluded from this list since it is set by default + # Loop over the history array options + for var in ( + "hist_fexcl1", + "hist_fincl1", + "hist_fincl2", + "hist_fincl3", + "hist_fincl4", + "hist_fincl5", + "hist_fincl6", + "hist_mfilt", + "hist_ndens", + "hist_avgflag_pertape", + ): + val = nmlgen.get_value(var) + if val != [None]: + raise SystemExit( + "use_noio turns off all history output" + + ", so no hist_ namelist option should also be set" + + ", the %s array is also being set here" % var + ) + # Loop over any history scalar options + for var in ("hist_empty_htapes",): + val = nmlgen.get_value(var) + if val is not None: + raise SystemExit( + "use_noio turns off all history output" + + ", so no hist_ namelist option should also be set" + + ", %s is also being set here" % var + ) # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index f2c3b87c..c0226732 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -206,7 +206,8 @@ def test_check_nml_history_fails_excl_use_noio(self): self.nmlgen.set_value("hist_fincl1", ["A"]) with self.assertRaisesRegex( SystemExit, - "use_noio turns off all history output, so no hist_* namelist option should be set", + r"use_noio turns off all history output" + + ", so no hist_ namelist option should also be set.*", ): check_nml_history(self.nmlgen) From 4c869f0d7b0cd2012aa0631d42ab393479b5b5e9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Mon, 26 Sep 2022 19:41:00 -0600 Subject: [PATCH 096/164] Change CLM XML config options to new SLIM config option names --- cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands | 1 - .../testdefs/testmods_dirs/slim/default/shell_commands | 4 +--- .../testmods_dirs/slim/global_uniform_g16_SOM/shell_commands | 2 -- .../testdefs/testmods_dirs/slim/save_cplhist/shell_commands | 2 -- 4 files changed, 1 insertion(+), 8 deletions(-) delete mode 100755 cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands delete mode 100755 cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands index 5e4ba742..28fa386d 100755 --- a/cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands @@ -1,4 +1,3 @@ #!/bin/bash CIMEROOT=`./xmlquery --value -s CIMEROOT` cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn* . -./xmlchange CLM_CO2_TYPE="diagnostic" diff --git a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands index d795e17a..f3a1a014 100755 --- a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands +++ b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands @@ -1,4 +1,2 @@ #!/bin/bash -./xmlchange CLM_START_TYPE="cold" -./xmlchange CLM_CO2_TYPE="constant" -./xmlchange CCSM_CO2_PPMV="999.99" +./xmlchange SLIM_START_TYPE="cold" diff --git a/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" diff --git a/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands b/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" From 26424b63fcba1c6dc985127ca106c88614df9dd2 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 27 Sep 2022 15:02:47 -0600 Subject: [PATCH 097/164] Add hash for cime branch --- Externals.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/Externals.cfg b/Externals.cfg index 2ea43fb8..295366fb 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -30,6 +30,7 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ekluzek/cime +#hash = 25ba7866ec4835b148aac9f83242d0bc6257da5e branch = add_slim_comp required = True From d72cd3c1228a1e3de4cdf539d313b75c6e293895 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 10:48:45 -0600 Subject: [PATCH 098/164] Systematically go through all compset names and make sure they are consistent, use E for with CAM and SOM, F with CAM and DOCN, and I for standalone --- cime_config/config_compsets.xml | 65 +++++++++++----------- cime_config/testdefs/ExpectedTestFails.xml | 4 +- cime_config/testdefs/testlist_slim.xml | 8 +-- 3 files changed, 40 insertions(+), 37 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 469eaf32..d8980961 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -34,15 +34,19 @@ - science_support (if this compset is supported scientifically with control simulations) - + - H_MML_2000_CAM6 + E2000Cam6SlimGsRs 2000_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV + + - H_MML_1850_CAM6 + E1850Cam6SlimGsRs 1850_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV @@ -53,55 +57,54 @@ - H_MML_2000_CAM5 + E2000Cam5SlimGsRs 2000_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - + FHistCam5SlimRsGs HIST_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - + + + - K1850MMLOFFLINE_CPLHIST - 1850_DATM%CPLHIST_SLIM_SICE_SOCN_SROF_SGLC_SWAV + IHistSlimGs + HIST_DATM%GSWP3v1_SLIM_SICE_SOCN_RTM_SGLC_SWAV + + - K2000MMLOFFLINE_CPLHIST - 2000_DATM%CPLHIST_SLIM_SICE_SOCN_SROF_SGLC_SWAV + IHistSlimQianGs + HIST_DATM%QIA_SLIM_SICE_SOCN_RTM_SGLC_SWAV + - K1850MMLOFFLINE_CRU - 1850_DATM%CRUv7_SLIM_SICE_SOCN_SROF_SGLC_SWAV + I2000SlimRsGs + 2000_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV + + - K1850MMLOFFLINE_GSWP3 + I1850SlimRsGs 1850_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV - - - - K_HIST_MMLOFFLINE_GSWP3 - HIST_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV - - - K_HIST_MMLOFFLINE_QIA - HIST_DATM%QIA_SLIM_SICE_SOCN_SROF_SGLC_SWAV - - - + + - IHistSlimQianGs - HIST_DATM%QIA_SLIM_SICE_SOCN_RTM_SGLC_SWAV + I1850SlimCruRsGs + 1850_DATM%CRUv7_SLIM_SICE_SOCN_SROF_SGLC_SWAV + - I2000SlimRsGs - 2000_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV + I1850SlimCplhistRsGs + 1850_DATM%CPLHIST_SLIM_SICE_SOCN_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index f04cec7d..6673a0e1 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,13 +29,13 @@ - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index d73ac532..5774dc09 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + From bd4baba770f6937eea26bcaa06143c513138ae04 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 12:08:57 -0600 Subject: [PATCH 099/164] Remove RTM from the externals --- Externals.cfg | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 295366fb..3639b303 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -19,13 +19,6 @@ repo_url = https://github.com/ESCOMP/CESM_CICE5 local_path = components/cice required = True -[rtm] -tag = release-cesm2.0.04 -protocol = git -repo_url = https://github.com/ESCOMP/rtm -local_path = components/rtm -required = True - [cime] local_path = cime protocol = git From 22315b0eb1d8be8fa376b60c53eed72ae2792dfe Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 12:20:00 -0600 Subject: [PATCH 100/164] Remove RTM from compsets and make all compsets use RsGs in that order --- cime_config/config_compsets.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index d8980961..ccfb34a7 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -46,7 +46,7 @@ - E1850Cam6SlimGsRs + E1850Cam6SlimRsGs 1850_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV @@ -57,7 +57,7 @@ - E2000Cam5SlimGsRs + E2000Cam5SlimRsGs 2000_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV @@ -73,15 +73,15 @@ - IHistSlimGs - HIST_DATM%GSWP3v1_SLIM_SICE_SOCN_RTM_SGLC_SWAV + IHistSlimRsGs + HIST_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV - IHistSlimQianGs - HIST_DATM%QIA_SLIM_SICE_SOCN_RTM_SGLC_SWAV + IHistSlimQianRsGs + HIST_DATM%QIA_SLIM_SICE_SOCN_SROF_SGLC_SWAV From aa7ff8079b46ee0d522547137b219e3de5b3ec58 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 15:23:24 -0600 Subject: [PATCH 101/164] Fix compsets in test list --- cime_config/config_compsets.xml | 2 +- cime_config/testdefs/testlist_slim.xml | 28 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index ccfb34a7..83f26104 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -40,7 +40,7 @@ - E2000Cam6SlimGsRs + E2000Cam6SlimRsGs 2000_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index 5774dc09..0ea15815 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -106,8 +106,8 @@ - - + + @@ -121,7 +121,7 @@ - + @@ -131,7 +131,7 @@ - + @@ -141,7 +141,7 @@ - + @@ -153,7 +153,7 @@ - + @@ -162,7 +162,7 @@ - + @@ -171,7 +171,7 @@ - + @@ -181,7 +181,7 @@ - + @@ -190,7 +190,7 @@ - + From e3a3944ace310ae18d8a64082544b0f0397a12c7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 16:27:16 -0600 Subject: [PATCH 102/164] Description needs ? option which means 0 or 1 attribute, right now there are zero attributes to _SLIM_ in the long compsetname --- cime_config/config_component.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index 5721da97..bfeb0195 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -13,7 +13,7 @@ --> - + Simple Land Model: From 631d0bebd9a27546e09d44f579576c2a95f6cb50 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 16:28:25 -0600 Subject: [PATCH 103/164] Work with logger options to buildnml, remove print statements, use different levels, have dtime check always get CALENDAR, so add setting it to tests --- cime_config/slim_cime_py/buildnml.py | 29 +++++++++++++------------- python/slim/test/test_sys_buildnml.py | 1 + python/slim/test/test_unit_buildnml.py | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 2bc978a1..a0cbcc42 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -21,21 +21,24 @@ def check_nml_dtime(nmlgen, case): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_dtime") + logger.debug(" check_nml_dtime") ncpl_base_period = case.get_value("NCPL_BASE_PERIOD") + calendar = case.get_value("CALENDAR") if ncpl_base_period == "hour": basedt = 3600 elif ncpl_base_period == "day": basedt = 3600 * 24 elif ncpl_base_period == "year": - if case.get_value("CALENDAR") == "NO_LEAP": + if calendar == "NO_LEAP": basedt = 3600 * 24 * 365 else: + logger.error("CALENDAR = %s", calendar) expect(False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period) elif ncpl_base_period == "decade": - if case.get_value("CALENDAR") == "NO_LEAP": + if calendar == "NO_LEAP": basedt = 3600 * 24 * 365 * 10 else: + logger.error("CALENDAR = %s", calendar) expect( False, "Invalid CALENDAR for NCPL_BASE_PERIOD %s " % ncpl_base_period, @@ -43,13 +46,12 @@ def check_nml_dtime(nmlgen, case): else: expect(False, "Invalid NCPL_BASE_PERIOD %s " % ncpl_base_period) - logger.info(" basedt = %s", str(basedt)) - if basedt < 0: expect(False, "basedt invalid overflow for NCPL_BASE_PERIOD %s " % ncpl_base_period) lnd_ncpl = int(case.get_value("LND_NCPL")) if basedt % lnd_ncpl != 0: + logger.error("CALENDAR = %s", calendar) expect( False, "LND_NCPL=%s doesn't divide evenly into NCPL_BASE_PERIOD %s\n" @@ -77,7 +79,7 @@ def check_nml_general(nmlgen): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_general") + logger.debug(" check_nml_general") for var in ("slim_start_type", "res"): expect(nmlgen.get_value(var) is not None, var + " must be set") @@ -102,7 +104,7 @@ def check_nml_performance(nmlgen): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_performance") + logger.debug(" check_nml_performance") expect(int(nmlgen.get_value("nsegspc")) > 0, "nsegspc must be positive") @@ -114,14 +116,13 @@ def check_nml_history(nmlgen): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_history") + logger.debug(" check_nml_history") avg_opts = ("A", "I", "X", "M") hist_mfilt = nmlgen.get_value("hist_mfilt") for mfilt in hist_mfilt: if mfilt is None: break - logger.info(" hist_mfilt = %d", int(mfilt)) if int(mfilt) <= 0: raise SystemExit("hist_mfilt must be 1 or larger") @@ -256,7 +257,7 @@ def check_nml_initial_conditions(nmlgen, case, inst_string=""): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_initial_conditions") + logger.debug(" check_nml_initial_conditions") start_type = case.get_value("SLIM_START_TYPE") run_type = case.get_value("RUN_TYPE") run_refcase = case.get_value("RUN_REFCASE") @@ -285,9 +286,7 @@ def check_nml_initial_conditions(nmlgen, case, inst_string=""): if run_type != "branch": # Handle a cold start if start_type == "cold": - logger.info(" finidat = %s", finidat) if finidat != " " and finidat != "UNSET" and finidat is not None: - print(" finidat = '" + finidat + "'") raise SystemExit( "finidat is set but SLIM_START_TYPE is cold which is a contradiction" ) @@ -318,7 +317,6 @@ def check_nml_initial_conditions(nmlgen, case, inst_string=""): check_file(nrevsn, case) if finidat is not None: - print(finidat) raise SystemExit("finidat can NOT be set when RUN_TYPE is a branch") @@ -330,7 +328,7 @@ def check_nml_data(nmlgen, case): # pylint: disable=global-statement global logger # ------------------------------------------------------ - logger.info(" check_nml_data") + logger.debug(" check_nml_data") mml_surdat = nmlgen.get_value("mml_surdat") if mml_surdat == "UNSET": @@ -424,6 +422,7 @@ def buildnml(case, caseroot, compname): # Build the component namelist if compname != "slim": + logger.error("compname = %s", compname) raise AttributeError lnd_root = case.get_value("COMP_ROOT_DIR_LND") @@ -507,5 +506,5 @@ def buildnml(case, caseroot, compname): file2 = os.path.join(rundir, "lnd_in") if ninst > 1: file2 += inst_string - logger.info("SLIM namelist copy: file1 %s file2 %s ", file1, file2) + logger.debug("SLIM namelist copy: file1 %s file2 %s ", file1, file2) shutil.copy(file1, file2) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 25a3363e..8d69e162 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -79,6 +79,7 @@ def setUp(self): self.case.set_value("RUN_REFTOD", "00000") self.case.set_value("RUN_REFDIR", "cesm2_init") self.case.set_value("RUNDIR", ".") + self.case.set_value("CALENDAR", "NO_LEAP") self.case.set_value("NINST_LND", 1) self.case.set_value("NCPL_BASE_PERIOD", "day") self.case.set_value("LND_NCPL", 48) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index c0226732..fd013733 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -66,6 +66,7 @@ def setUp(self): self.case.set_value("RUN_REFTOD", "00000") self.case.set_value("RUN_REFDIR", "cesm2_init") self.case.set_value("DIN_LOC_ROOT", ".") + self.case.set_value("CALENDAR", "NO_LEAP") self.case.set_value("LND_DOMAIN_PATH", ".") self.case.set_value("LND_DOMAIN_FILE", "domain.nc") self.case.set_value("SLIM_SCENARIO", "global_uniform") From 50b95a618ec0886e6e83cb26cfa40e435ffd7fda Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 28 Sep 2022 16:59:13 -0600 Subject: [PATCH 104/164] Remove logger level options as no arguments are sent to buildnml --- cime_config/buildnml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index 58d48be5..a79cbcc3 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -22,10 +22,6 @@ def _main_func(): caseroot = parse_input(sys.argv) level = logging.WARNING - if ( "-v" in sys.argv ): - level = logging.INFO - if ( "-d" in sys.argv ): - level = logging.DEBUG setup_logging( level ) with Case(caseroot) as case: buildnml(case, caseroot, "slim") From be3839effca360ac1414500e37337151bac34eff Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 5 Oct 2022 17:44:28 -0600 Subject: [PATCH 105/164] Append to the Filepath paths that are needed now, but won't long term --- cime_config/buildlib | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cime_config/buildlib b/cime_config/buildlib index 4528dfc6..f437f659 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -48,6 +48,10 @@ def _main_func(): os.path.join(lnd_root,"src","init_interp"), os.path.join(lnd_root,"src","utils"), os.path.join(lnd_root,"src","cpl")] + # Paths needed to build the current system, but won't be long term + paths.append( os.path.join(lnd_root,"src","biogeophys") ) + paths.append( os.path.join(lnd_root,"src","biogeochem") ) + paths.append( os.path.join(lnd_root,"src","soilbiogeochem") ) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) From 15594be30f9dc7d3c565d1f5d30319444c1dca27 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 5 Oct 2022 17:50:38 -0600 Subject: [PATCH 106/164] Point to the hash rather than the branch --- Externals.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Externals.cfg b/Externals.cfg index 3639b303..41589901 100644 --- a/Externals.cfg +++ b/Externals.cfg @@ -23,8 +23,8 @@ required = True local_path = cime protocol = git repo_url = https://github.com/ekluzek/cime -#hash = 25ba7866ec4835b148aac9f83242d0bc6257da5e -branch = add_slim_comp +hash = 25ba7866ec4835b148aac9f83242d0bc6257da5e +#branch = add_slim_comp required = True [externals_description] From 3c6e5d178c89b0b6a20782a908f7937f173c55ac Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 5 Oct 2022 18:00:34 -0600 Subject: [PATCH 107/164] Library name needs to be generic rather than specific, so that the link will happen --- cime_config/buildlib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index f437f659..d25deb98 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -61,7 +61,7 @@ def _main_func(): # create the library in libroot #------------------------------------------------------- - complib = os.path.join(libroot,"libslim.a") + complib = os.path.join(libroot,"liblnd.a") makefile = os.path.join(casetools, "Makefile") macfile = os.path.join(caseroot, "Macros.%s" % mach) From 87adec0f692852db6ec12318974986cad0e25598 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 6 Oct 2022 23:17:12 -0600 Subject: [PATCH 108/164] Don't abort when you can't find the namelist --- src/biogeochem/CNSharedParamsMod.F90 | 3 +-- src/biogeochem/CNVegCarbonStateType.F90 | 2 +- src/biogeochem/CNVegetationFacade.F90 | 2 +- src/biogeochem/SatellitePhenologyMod.F90 | 2 +- src/biogeophys/CanopyStateType.F90 | 2 +- src/biogeophys/RootBiophysMod.F90 | 2 +- src/biogeophys/SoilHydrologyType.F90 | 2 +- src/biogeophys/SoilStateInitTimeConstMod.F90 | 2 +- src/biogeophys/SoilWaterMovementMod.F90 | 2 +- src/biogeophys/UrbanParamsType.F90 | 2 +- src/init_interp/initInterp.F90 | 2 +- src/main/atm2lndType.F90 | 2 +- src/main/controlMod.F90 | 2 +- src/main/glcBehaviorMod.F90 | 3 +-- src/main/initVerticalMod.F90 | 2 +- src/main/lnd2atmType.F90 | 2 +- src/main/restFileMod.F90 | 2 +- 17 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/biogeochem/CNSharedParamsMod.F90 b/src/biogeochem/CNSharedParamsMod.F90 index 42156b11..6d373000 100644 --- a/src/biogeochem/CNSharedParamsMod.F90 +++ b/src/biogeochem/CNSharedParamsMod.F90 @@ -161,8 +161,7 @@ subroutine CNParamsReadShared_namelist(namelist_file) errMsg(sourcefile, __LINE__)) end if else - call endrun(msg='error in finding ' // namelist_group // ' namelist' // & - errMsg(sourcefile, __LINE__)) + write(iulog,*) 'Could not find ' // namelist_group // ' namelist' end if call relavu( unitn ) diff --git a/src/biogeochem/CNVegCarbonStateType.F90 b/src/biogeochem/CNVegCarbonStateType.F90 index a5800479..a9402f8f 100644 --- a/src/biogeochem/CNVegCarbonStateType.F90 +++ b/src/biogeochem/CNVegCarbonStateType.F90 @@ -174,7 +174,7 @@ subroutine InitReadNML(this, NLFilename) call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could NOT find "//nmlname//"namelist" end if call relavu( unitn ) end if diff --git a/src/biogeochem/CNVegetationFacade.F90 b/src/biogeochem/CNVegetationFacade.F90 index 02d0f98a..6bb79f96 100644 --- a/src/biogeochem/CNVegetationFacade.F90 +++ b/src/biogeochem/CNVegetationFacade.F90 @@ -221,7 +221,7 @@ subroutine CNReadNML( this, NLFilename ) call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could NOT find "//nmlname//"namelist" end if call relavu( unitn ) end if diff --git a/src/biogeochem/SatellitePhenologyMod.F90 b/src/biogeochem/SatellitePhenologyMod.F90 index 78b2cf0e..6bb6e5f4 100644 --- a/src/biogeochem/SatellitePhenologyMod.F90 +++ b/src/biogeochem/SatellitePhenologyMod.F90 @@ -131,7 +131,7 @@ subroutine lai_init(bounds) call endrun(subname // ':: ERROR reading lai_streams namelist') end if else - call endrun(subname // ':: ERROR finding lai_streams namelist') + write(iulog,*) "Could NOT find lai_streams namelist" end if close(nu_nml) call relavu( nu_nml ) diff --git a/src/biogeophys/CanopyStateType.F90 b/src/biogeophys/CanopyStateType.F90 index beef9527..e1e600bf 100644 --- a/src/biogeophys/CanopyStateType.F90 +++ b/src/biogeophys/CanopyStateType.F90 @@ -429,7 +429,7 @@ subroutine ReadNML( this, NLFilename ) call endrun(msg="ERROR reading clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding clm_canopy_inparm namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find clm_canopy_inparm namelist" end if call relavu( unitn ) diff --git a/src/biogeophys/RootBiophysMod.F90 b/src/biogeophys/RootBiophysMod.F90 index ba057056..65a2666b 100644 --- a/src/biogeophys/RootBiophysMod.F90 +++ b/src/biogeophys/RootBiophysMod.F90 @@ -77,7 +77,7 @@ subroutine init_rootprof(NLFilename) call endrun(subname // ':: ERROR reading rooting_profile namelist') end if else - call endrun(subname // ':: ERROR finding rooting_profile namelist') + write(iulog,*) "Could not find rooting_profile namelist" end if close(nu_nml) call relavu( nu_nml ) diff --git a/src/biogeophys/SoilHydrologyType.F90 b/src/biogeophys/SoilHydrologyType.F90 index be78df49..e3e893a4 100644 --- a/src/biogeophys/SoilHydrologyType.F90 +++ b/src/biogeophys/SoilHydrologyType.F90 @@ -321,7 +321,7 @@ subroutine ReadNL( this, NLFilename ) call endrun(msg="ERROR reading clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding clm_soilhydrology_inparm namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find clm_soilhydrology_inparm namelist" end if call relavu( unitn ) diff --git a/src/biogeophys/SoilStateInitTimeConstMod.F90 b/src/biogeophys/SoilStateInitTimeConstMod.F90 index 1c8f1342..1fcfffb3 100644 --- a/src/biogeophys/SoilStateInitTimeConstMod.F90 +++ b/src/biogeophys/SoilStateInitTimeConstMod.F90 @@ -73,7 +73,7 @@ subroutine ReadNL( nlfilename ) call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find '//nl_name//' namelist" end if call relavu( unitn ) diff --git a/src/biogeophys/SoilWaterMovementMod.F90 b/src/biogeophys/SoilWaterMovementMod.F90 index d458768e..e26cfa45 100644 --- a/src/biogeophys/SoilWaterMovementMod.F90 +++ b/src/biogeophys/SoilWaterMovementMod.F90 @@ -124,7 +124,7 @@ subroutine init_soilwater_movement() call endrun(subname // ':: ERROR reading soilwater_movement namelist') end if else - call endrun(subname // ':: ERROR reading soilwater_movement namelist') + write(iulog,*) 'Could not read soilwater_movement namelist' end if close(nu_nml) call relavu( nu_nml ) diff --git a/src/biogeophys/UrbanParamsType.F90 b/src/biogeophys/UrbanParamsType.F90 index 4b4187c3..c3c25b0f 100644 --- a/src/biogeophys/UrbanParamsType.F90 +++ b/src/biogeophys/UrbanParamsType.F90 @@ -870,7 +870,7 @@ subroutine UrbanReadNML ( NLFilename ) call endrun(msg="ERROR reading clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding clmu_inparm namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find clmu_inparm namelist" end if call relavu( unitn ) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 07d93178..93bddc1d 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -100,7 +100,7 @@ subroutine initInterp_readnl(NLFilename) call endrun(msg="ERROR reading clm_initinterp_inparm namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding clm_initinterp_inparm namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find clm_initinterp_inparm namelist" end if call relavu( unitn ) end if diff --git a/src/main/atm2lndType.F90 b/src/main/atm2lndType.F90 index f0d58fe1..8b2d72e0 100644 --- a/src/main/atm2lndType.F90 +++ b/src/main/atm2lndType.F90 @@ -602,7 +602,7 @@ subroutine ReadNamelist(this, NLFilename) call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "could NOT find "//nmlname//"namelist" end if call relavu( unitn ) end if diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index aef6715a..00bc0409 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -259,7 +259,7 @@ subroutine control_init( ) call endrun(msg='ERROR reading clm_inparm namelist'//errMsg(sourcefile, __LINE__)) end if else - call endrun(msg='ERROR finding clm_inparm namelist'//errMsg(sourcefile, __LINE__)) + write(iulog,*) 'Could not find clm_inparm namelist' end if call relavu( unitn ) diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 index 2fa47857..aa957cc5 100644 --- a/src/main/glcBehaviorMod.F90 +++ b/src/main/glcBehaviorMod.F90 @@ -629,8 +629,7 @@ subroutine read_namelist(NLFilename, glacier_region_behavior, & errMsg(sourcefile, __LINE__)) end if else - call endrun(msg='ERROR finding clm_glacier_behavior namelist'// & - errMsg(sourcefile, __LINE__)) + write(iulog,*) 'Could not find clm_glacier_behavior namelist' end if call relavu( unitn ) endif diff --git a/src/main/initVerticalMod.F90 b/src/main/initVerticalMod.F90 index c4f3f9a8..6fdaef70 100644 --- a/src/main/initVerticalMod.F90 +++ b/src/main/initVerticalMod.F90 @@ -94,7 +94,7 @@ subroutine ReadNL( ) call endrun(msg="ERROR reading '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR finding '//nl_name//' namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "Could not find '//nl_name//' namelist" end if call relavu( unitn ) diff --git a/src/main/lnd2atmType.F90 b/src/main/lnd2atmType.F90 index fbfab7b8..cdc1e981 100644 --- a/src/main/lnd2atmType.F90 +++ b/src/main/lnd2atmType.F90 @@ -241,7 +241,7 @@ subroutine ReadNamelist(this, NLFilename) call endrun(msg="ERROR reading "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) end if else - call endrun(msg="ERROR could NOT find "//nmlname//"namelist"//errmsg(sourcefile, __LINE__)) + write(iulog,*) "could NOT find "//nmlname//"namelist" end if call relavu( unitn ) end if diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index d30d59a8..92cc0cff 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -838,7 +838,7 @@ subroutine restFile_read_consistency_nl( & call endrun(msg='ERROR reading finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) end if else - call endrun(msg='ERROR finding finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) + write(iulog,*) 'Could not find finidat_consistency_checks namelist' end if close(nu_nml) call relavu( nu_nml ) From 97ac23c940164c271d5d1d6655556f70a4f17ac8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 10:04:03 -0600 Subject: [PATCH 109/164] Temporarily add in clm_inparm and move fatmlndfrc to it, until it can be removed --- cime_config/namelist_definition_slim.xml | 19 ++++++++++++++++++- cime_config/slim_cime_py/buildnml.py | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 44e3f7ff..7755893b 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -82,7 +82,7 @@ - + char datasets abs @@ -287,4 +287,21 @@ Horizontal resolutions + + + + + + char + datasets + abs + clm_inparm + + + $LND_DOMAIN_PATH/$LND_DOMAIN_FILE + + Full pathname of land fraction data file. + + + diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index a0cbcc42..8d1a4446 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -406,10 +406,11 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # ---------------------------------------------------- logger.info("Write namelists") namelist_file = os.path.join(confdir, "lnd_in") + # Include clm_inparm until can be removed... nmlgen.write_output_file( namelist_file, data_list_path, - groups=["slim_inparm", "slim_data_and_initial", "slim_history", "slim_perf"], + groups=["slim_inparm", "slim_data_and_initial", "slim_history", "slim_perf", "clm_inparm"], ) From 086f6fff2d487d5399909767f396bd0f12227fd7 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 10:04:23 -0600 Subject: [PATCH 110/164] Set some needed default values --- src/main/controlMod.F90 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 00bc0409..4824218f 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -235,6 +235,12 @@ subroutine control_init( ) #else clump_pproc = 1 #endif + dtime = 1800 + maxpatch_glcmec = 10 + nlevsno = 5 + h2osno_max = 1000.0_r8 + int_snow_max = 1.e30_r8 + n_melt_glcmec = 10.0_r8 override_nsrest = nsrest From 2582932c10783088cf35d6cca5b8360187f0b7be Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 10:58:30 -0600 Subject: [PATCH 111/164] fsurdat is still required in clm_inparm --- cime_config/namelist_definition_slim.xml | 18 ++++++++++++++++++ cime_config/slim_cime_py/buildnml.py | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 7755893b..5512de8d 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -303,5 +303,23 @@ Full pathname of land fraction data file. + + char + datasets + abs + clm_inparm + + UNSET + $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc + $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc + + + Surface dataset from CLM + + + diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 8d1a4446..072e414f 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -360,6 +360,14 @@ def check_nml_data(nmlgen, case): if finidat_dest is not None and not interp: raise SystemExit("finidat_interp_dest can NOT be set if use_init_interp is not on") + #----------------------------------------------------------------------------------------- + # Requirements still in clm_inparm + #----------------------------------------------------------------------------------------- + fsurdat = nmlgen.get_value("fsurdat") + if fsurdat == "UNSET": + raise SystemExit("fsurdat file is NOT set and is required") + + # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements # Turn off unused-argument for inst_string, since isn't in place right now From c7ca76d50b4c4feabacda65e4b4078ce1531162e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 14:18:23 -0600 Subject: [PATCH 112/164] Set the default values as they are not needed for glacier behavior --- src/main/glcBehaviorMod.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 index aa957cc5..111db6d5 100644 --- a/src/main/glcBehaviorMod.F90 +++ b/src/main/glcBehaviorMod.F90 @@ -617,6 +617,9 @@ subroutine read_namelist(NLFilename, glacier_region_behavior, & glacier_region_behavior(:) = behavior_str_unset glacier_region_melt_behavior(:) = behavior_str_unset glacier_region_ice_runoff_behavior(:) = behavior_str_unset + glacier_region_behavior(0:3) = (/ 'single_at_atm_topo','virtual ','virtual ','multiple ' /) + glacier_region_ice_runoff_behavior(0:3) = (/ 'melted ','melted ','remains_ice','remains_ice' /) + glacier_region_melt_behavior(0:3) = (/ 'remains_in_place','replaced_by_ice ','replaced_by_ice ','replaced_by_ice ' /) if (masterproc) then unitn = getavu() From 3c849cc3f361c0d9d27a4adbf05e6fd5e8918399 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 14:21:53 -0600 Subject: [PATCH 113/164] paramfile is currently required --- cime_config/namelist_definition_slim.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 5512de8d..031284fc 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -321,5 +321,18 @@ + + char + datasets + abs + clm_inparm + + $DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params.c170913.nc + + + PFT and parameter file + + + From d3793360788dc76018cee289ab1b8d3abe6b045a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 7 Oct 2022 14:48:43 -0600 Subject: [PATCH 114/164] Set create_crop_landunit to true which is the default case --- src/main/clm_varctl.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/clm_varctl.F90 b/src/main/clm_varctl.F90 index a60aa1f6..e66ebbcf 100644 --- a/src/main/clm_varctl.F90 +++ b/src/main/clm_varctl.F90 @@ -126,7 +126,7 @@ module clm_varctl logical, public :: use_crop = .false. ! true => separate crop landunit is not created by default - logical, public :: create_crop_landunit = .false. + logical, public :: create_crop_landunit = .true. ! do not irrigate by default logical, public :: irrigate = .false. From 9b5647036f6029724766cc4e4c53a78160ea5512 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 8 Oct 2022 19:32:18 -0600 Subject: [PATCH 115/164] Make sure SLIM_SCENARIO is set, and remove the UNSET option for it, for HIST_ compsets set it to realistic_from_1850 --- cime_config/config_component.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index bfeb0195..b00fe93b 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -28,11 +28,12 @@ char - UNSET - UNSET,global_uniform,realistic_from_1850,realistic_from_2000 + global_uniform + global_uniform,realistic_from_1850,realistic_from_2000 realistic_from_2000 realistic_from_1850 + realistic_from_1850 run_component_slim env_run.xml From eefc20b49370e68729472bd059bcec89cafae909 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 9 Oct 2022 14:31:29 -0600 Subject: [PATCH 116/164] Add readnml_datasets subroutine to mml_main that reads in slim specific dataset namelist items --- src/main/mml_main.F90 | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index 8eb1955e..0c3b2d83 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -50,6 +50,8 @@ module mml_mainMod ! !PUBLIC MEMBER FUNCTIONS: public :: mml_main + + public :: readnml_datasets ! !PRIVATE MEMBER FUNCTIONS: private :: nc_import @@ -81,6 +83,57 @@ module mml_mainMod contains + !----------------------------------------------------------------------- + subroutine readnml_datasets( NLFilename ) + use shr_mpi_mod , only : shr_mpi_bcast + use spmdMod , only : mpicom + use clm_nlUtilsMod , only : find_nlgroup_name + use clm_varctl , only : finidat, fatmlndfrc, finidat_interp_dest + use clm_varctl , only : nrevsn, fname_len + + implicit none + + character(len=*), intent(IN) :: NLFilename ! Namelist file names + !----------------------------------------------------------------------- + ! !LOCAL VARIABLES: + integer :: nu_nml ! Unit for namelist file + integer :: nml_error ! Error code + character(len=fname_len) :: fatmlndfrc_new + character(len=*), parameter :: nml_name = 'slim_data_and_initial' + character(len=*), parameter :: subname = 'readnml_datasets' + namelist /slim_data_and_initial/ mml_surdat, finidat, fatmlndfrc_new + namelist /slim_data_and_initial/ finidat_interp_dest, nrevsn + !----------------------------------------------------------------------- + + fatmlndfrc_new = ' ' + if (masterproc) then + open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, nml_name, status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=slim_data_and_initial,iostat=nml_error) + if (nml_error /= 0) then + call endrun(subname // ':: ERROR reading '//nml_name//' namelist') + end if + else + call endrun(subname // ':: ERROR could NOT find '//nml_name//' namelist') + end if + close(nu_nml) + end if + call shr_mpi_bcast( mml_surdat, mpicom ) + call shr_mpi_bcast( finidat, mpicom ) + call shr_mpi_bcast( finidat_interp_dest, mpicom ) + call shr_mpi_bcast( nrevsn, mpicom ) + call shr_mpi_bcast( fatmlndfrc_new, mpicom ) + fatmlndfrc = fatmlndfrc_new + if (masterproc) then + write(iulog,*) 'mml_surdat = ', trim(mml_surdat) + write(iulog,*) 'nrevsn = ', trim(nrevsn) + write(iulog,*) 'fatmlndfrc = ', trim(fatmlndfrc) + write(iulog,*) 'finidat = ', trim(finidat) + write(iulog,*) 'finidat_interp_dest = ', trim(finidat_interp_dest) + end if + end subroutine readnml_datasets + !----------------------------------------------------------------------- subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst From d051e3770d98286b2a140fe1ce69e9629368e1cc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 9 Oct 2022 14:32:03 -0600 Subject: [PATCH 117/164] Add readnml_datasets subroutine to mml_main that reads in slim specific dataset namelist items --- src/main/clm_initializeMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 57a91504..11da9968 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -54,6 +54,7 @@ subroutine initialize1( ) use ncdio_pio , only: ncd_pio_init use initGridCellsMod , only: initGridCells use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp + use mml_MainMod , only: readnml_datasets ! ! !LOCAL VARIABLES: integer :: ier ! error status @@ -88,6 +89,7 @@ subroutine initialize1( ) call clm_varcon_init( IsSimpleBuildTemp() ) call landunit_varcon_init() call ncd_pio_init() + call readnml_datasets( NLFilename ) if (masterproc) call control_print() From 264177b581c881087f91d34be72380ffd6eef034 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 9 Oct 2022 19:35:32 -0600 Subject: [PATCH 118/164] Move the write for the namelist for mml_surdat and fatmlndfrc to the new readnamelist subroutine --- src/main/controlMod.F90 | 10 ---------- src/main/mml_main.F90 | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 4824218f..cc6ebee4 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -582,16 +582,6 @@ subroutine control_print () else write(iulog,*) ' surface data = ',trim(fsurdat) end if - if (fatmlndfrc == ' ') then - write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' - else - write(iulog,*) ' land frac data = ',trim(fatmlndfrc) - end if - if (mml_surdat == ' ') then - write(iulog,*) ' mml_surdat NOT set, check that we are using the default' - else - write(iulog,*) ' mml_surdat IS set, and = ',trim(mml_surdat) - end if if (use_cn) then if (nfix_timeconst /= 0._r8) then write(iulog,*) ' nfix_timeconst, timescale for smoothing npp in N fixation term: ', nfix_timeconst diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index 0c3b2d83..8dc84313 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -126,11 +126,21 @@ subroutine readnml_datasets( NLFilename ) call shr_mpi_bcast( fatmlndfrc_new, mpicom ) fatmlndfrc = fatmlndfrc_new if (masterproc) then - write(iulog,*) 'mml_surdat = ', trim(mml_surdat) write(iulog,*) 'nrevsn = ', trim(nrevsn) - write(iulog,*) 'fatmlndfrc = ', trim(fatmlndfrc) write(iulog,*) 'finidat = ', trim(finidat) write(iulog,*) 'finidat_interp_dest = ', trim(finidat_interp_dest) + + if (fatmlndfrc == ' ') then + write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' + else + write(iulog,*) ' land frac data = ',trim(fatmlndfrc) + end if + + if (mml_surdat == ' ') then + write(iulog,*) ' mml_surdat NOT set, check that we are using the default' + else + write(iulog,*) ' mml_surdat IS set, and = ',trim(mml_surdat) + end if end if end subroutine readnml_datasets From 627fa453418242415d7cd13ab6075a163296863a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 9 Oct 2022 19:37:40 -0600 Subject: [PATCH 119/164] Remove fatmlndfrc_new and only have one version of fatmlndfrc --- cime_config/namelist_definition_slim.xml | 14 +------------- src/main/mml_main.F90 | 8 +++----- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 031284fc..cec1cc5e 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -82,7 +82,7 @@ - + char datasets abs @@ -291,18 +291,6 @@ - - char - datasets - abs - clm_inparm - - - $LND_DOMAIN_PATH/$LND_DOMAIN_FILE - - Full pathname of land fraction data file. - - char datasets diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index 8dc84313..2dff6911 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -98,14 +98,13 @@ subroutine readnml_datasets( NLFilename ) ! !LOCAL VARIABLES: integer :: nu_nml ! Unit for namelist file integer :: nml_error ! Error code - character(len=fname_len) :: fatmlndfrc_new character(len=*), parameter :: nml_name = 'slim_data_and_initial' character(len=*), parameter :: subname = 'readnml_datasets' - namelist /slim_data_and_initial/ mml_surdat, finidat, fatmlndfrc_new + namelist /slim_data_and_initial/ mml_surdat, finidat, fatmlndfrc namelist /slim_data_and_initial/ finidat_interp_dest, nrevsn !----------------------------------------------------------------------- - fatmlndfrc_new = ' ' + fatmlndfrc = ' ' if (masterproc) then open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) call find_nlgroup_name(nu_nml, nml_name, status=nml_error) @@ -123,8 +122,7 @@ subroutine readnml_datasets( NLFilename ) call shr_mpi_bcast( finidat, mpicom ) call shr_mpi_bcast( finidat_interp_dest, mpicom ) call shr_mpi_bcast( nrevsn, mpicom ) - call shr_mpi_bcast( fatmlndfrc_new, mpicom ) - fatmlndfrc = fatmlndfrc_new + call shr_mpi_bcast( fatmlndfrc, mpicom ) if (masterproc) then write(iulog,*) 'nrevsn = ', trim(nrevsn) write(iulog,*) 'finidat = ', trim(finidat) From 8a76392fd849e8a5273580864bb2242d5a5ef1b5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 15:08:18 -0600 Subject: [PATCH 120/164] Add a history reading namelist and a slim_physics reading namelist and remove their reads from the clm_inparm namelist, also move the apply_use_init_interp subroutine over as well as the setting of default history items --- src/main/clm_initializeMod.F90 | 11 +- src/main/controlMod.F90 | 201 +++++++++++---------------------- src/main/histFileMod.F90 | 70 ++++++++++++ src/main/mml_main.F90 | 57 +++++++++- 4 files changed, 197 insertions(+), 142 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 11da9968..62ec1e77 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -50,7 +50,7 @@ subroutine initialize1( ) use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp use domainMod , only: domain_check, ldomain, domain_init use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data - use controlMod , only: control_init, control_print, NLFilename + use controlMod , only: control_init, control_print, NLFilename, control_readNL_Physics use ncdio_pio , only: ncd_pio_init use initGridCellsMod , only: initGridCells use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp @@ -79,17 +79,18 @@ subroutine initialize1( ) if ( masterproc )then write(iulog,*) trim(version) write(iulog,*) - write(iulog,*) 'Attempting to initialize the land model .....' + write(iulog,*) 'Attempting to initialize the SLIM land model .....' write(iulog,*) call shr_sys_flush(iulog) endif + call control_readNL_Physics() + call readnml_datasets( NLFilename ) call control_init() call clm_varpar_init() call clm_varcon_init( IsSimpleBuildTemp() ) call landunit_varcon_init() call ncd_pio_init() - call readnml_datasets( NLFilename ) if (masterproc) call control_print() @@ -244,6 +245,7 @@ subroutine initialize2( ) use fileutils , only : getfil use initInterpMod , only : initInterp use subgridWeightsMod , only : init_subgrid_weights_mod + use histFileMod , only : hist_readNML use histFileMod , only : hist_htapes_build, htapes_fieldlist, hist_printflds use histFileMod , only : hist_addfld1d, hist_addfld2d, no_snow_normal use restFileMod , only : restFile_getfile, restFile_open, restFile_close @@ -319,6 +321,9 @@ subroutine initialize2( ) call timemgr_restart() end if + ! History namelist read + call hist_readNML( NLFilename ) + ! ------------------------------------------------------------------------ ! Initialize daylength from the previous time step (needed so prev_dayl can be set correctly) ! ------------------------------------------------------------------------ diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index cc6ebee4..da1b21a2 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -19,39 +19,31 @@ module controlMod use decompMod , only: clump_pproc use clm_varcon , only: h2osno_max, int_snow_max, n_melt_glcmec use clm_varpar , only: maxpatch_pft, maxpatch_glcmec, numrad, nlevsno - use histFileMod , only: max_tapes, max_namlen - use histFileMod , only: hist_empty_htapes, hist_dov2xy, hist_avgflag_pertape, hist_type1d_pertape - use histFileMod , only: hist_nhtfrq, hist_ndens, hist_mfilt, hist_fincl1, hist_fincl2, hist_fincl3 - use histFileMod , only: hist_fincl4, hist_fincl5, hist_fincl6, hist_fexcl1, hist_fexcl2, hist_fexcl3 - use histFileMod , only: hist_fexcl4, hist_fexcl5, hist_fexcl6 use initInterpMod , only: initInterp_readnl use UrbanParamsType , only: UrbanReadNML use SurfaceAlbedoMod , only: albice use CNSharedParamsMod , only: use_fun use clm_varctl , only: iundef, rundef, nsrest, caseid, ctitle, nsrStartup, nsrContinue use clm_varctl , only: nsrBranch, brnch_retain_casename, hostname, username, source, version, conventions - use clm_varctl , only: iulog, outnc_large_files, finidat, fsurdat, fatmgrid, fatmlndfrc, paramfile, nrevsn - use clm_varctl , only: mml_surdat, finidat_interp_source, finidat_interp_dest, all_active, co2_type + use clm_varctl , only: iulog, outnc_large_files, finidat, fsurdat, fatmgrid, paramfile + use clm_varctl , only: all_active, co2_type use clm_varctl , only: wrtdia, co2_ppmv, use_bedrock, soil_layerstruct, nsegspc, rpntdir, rpntfil - use clm_varctl , only: use_cn, use_noio, NLFilename_in, use_century_decomp + use clm_varctl , only: use_cn, NLFilename_in, use_century_decomp use clm_varctl , only: use_nitrif_denitrif, create_crop_landunit, glc_snow_persistence_max_days use clm_varctl , only: subgridflag, use_nguardrail, nfix_timeconst, use_vertsoilc use clm_varctl , only: clm_varctl_set use clm_varctl , only: use_lch4, irrigate, create_crop_landunit, use_crop, use_dynroot use clm_varctl , only: use_fates, use_flexiblecn, use_hydrstress, use_luna, spinup_state - use clm_varctl , only: single_column + use clm_varctl , only: single_column, nrevsn, finidat_interp_source ! ! !PUBLIC TYPES: implicit none ! ! !PUBLIC MEMBER FUNCTIONS: - public :: control_setNL ! Set namelist filename - public :: control_init ! initial run control information - public :: control_print ! print run control information - ! - ! - ! !PRIVATE MEMBER FUNCTIONS: - private :: apply_use_init_interp ! apply the use_init_interp namelist option, if set + public :: control_setNL ! Set namelist filename + public :: control_init ! initial run control information + public :: control_readNL_Physics ! read in the namelist for SLIM physics settings + public :: control_print ! print run control information ! ! !PRIVATE TYPES: character(len= 7) :: runtyp(4) ! run type @@ -105,8 +97,8 @@ subroutine control_init( ) ! Initialize CLM run control information ! ! !USES: - use clm_time_manager , only : set_timemgr_init use fileutils , only : getavu, relavu + use clm_time_manager , only : get_step_size ! ! !LOCAL VARIABLES: integer :: i ! loop indices @@ -114,49 +106,20 @@ subroutine control_init( ) integer :: unitn ! unit for namelist file integer :: dtime ! Integer time-step integer :: override_nsrest ! If want to override the startup type sent from driver - logical :: use_init_interp ! Apply initInterp to the file given by finidat !------------------------------------------------------------------------ ! ---------------------------------------------------------------------- ! Namelist Variables ! ---------------------------------------------------------------------- - ! Time step - namelist / clm_inparm/ & - dtime - ! CLM namelist settings - namelist /clm_inparm / & - fatmlndfrc, finidat, nrevsn, & - finidat_interp_dest, & - use_init_interp - ! Input datasets namelist /clm_inparm/ & fsurdat, & paramfile - ! MML Input datasets for simple model - namelist /clm_inparm/ & - mml_surdat - ! MML forcing file w/ albedo, roughness, etc - ! /glade/p/work/mlague/cesm_source/cesm1_5_beta05_mml_land/components/clm/bld/namelist_files/namelist_defaults.xml - ! I think I need to modify one of the namelis_defaults xml files in the above folder in order for - ! the model to know to accept my new namelist var... - - ! History, restart options - - namelist /clm_inparm/ & - hist_empty_htapes, hist_dov2xy, & - hist_avgflag_pertape, hist_type1d_pertape, & - hist_nhtfrq, hist_ndens, hist_mfilt, & - hist_fincl1, hist_fincl2, hist_fincl3, & - hist_fincl4, hist_fincl5, hist_fincl6, & - hist_fexcl1, hist_fexcl2, hist_fexcl3, & - hist_fexcl4, hist_fexcl5, hist_fexcl6 - ! BGC info namelist /clm_inparm / & @@ -187,7 +150,7 @@ subroutine control_init( ) namelist /clm_inparm/ & use_vertsoilc, & - use_century_decomp, use_cn, use_noio, & + use_century_decomp, use_cn, & use_nguardrail, use_nitrif_denitrif ! Items not really needed, but do need to be properly set as they are used @@ -235,7 +198,6 @@ subroutine control_init( ) #else clump_pproc = 1 #endif - dtime = 1800 maxpatch_glcmec = 10 nlevsno = 5 h2osno_max = 1000.0_r8 @@ -244,8 +206,6 @@ subroutine control_init( ) override_nsrest = nsrest - use_init_interp = .false. - if (masterproc) then ! ---------------------------------------------------------------------- @@ -274,8 +234,6 @@ subroutine control_init( ) ! Process some namelist variables, and perform consistency checks ! ---------------------------------------------------------------------- - call set_timemgr_init( dtime_in=dtime ) - ! Check for namelist variables that SLIM can NOT use if ( use_fates )then call endrun(msg='ERROR SLIM can NOT run with use_fates on'//errMsg(sourcefile, __LINE__)) @@ -290,20 +248,6 @@ subroutine control_init( ) call endrun(msg='ERROR SLIM can NOT run with single_column on'//errMsg(sourcefile, __LINE__)) end if - if (use_init_interp) then - call apply_use_init_interp(finidat, finidat_interp_source) - end if - - ! History and restart files - - do i = 1, max_tapes - if (hist_nhtfrq(i) == 0) then - hist_mfilt(i) = 1 - else if (hist_nhtfrq(i) < 0) then - hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) - endif - end do - ! Override start-type (can only override to branch (3) and only ! if the driver is a startup type if ( override_nsrest /= nsrest )then @@ -414,6 +358,61 @@ subroutine control_init( ) end subroutine control_init + !------------------------------------------------------------------------ + subroutine control_readNL_Physics( ) + ! + ! !DESCRIPTION: + ! Initialize CLM run control information + ! + ! !USES: + use shr_mpi_mod , only : shr_mpi_bcast + use clm_time_manager, only : set_timemgr_init + use spmdMod , only : mpicom + ! + ! !LOCAL VARIABLES: + integer :: i ! loop indices + integer :: ierr ! error code + integer :: unitn ! unit for namelist file + integer :: dtime ! Integer time-step + character(len=*), parameter :: subname = "control_readNL_Physics" + character(len=*), parameter :: nmlName = "slim_inparm" + !------------------------------------------------------------------------ + + ! ---------------------------------------------------------------------- + ! Namelist Variables + ! ---------------------------------------------------------------------- + + ! Time step + namelist / slim_inparm/ dtime + + if (masterproc) then + + ! ---------------------------------------------------------------------- + ! Read namelist from standard input. + ! ---------------------------------------------------------------------- + + if ( len_trim(NLFilename) == 0 )then + call endrun(msg=subname//'::ERROR: nlfilename not set'//errMsg(sourcefile, __LINE__)) + end if + write(iulog,*) 'Read in '//nmlName//' namelist from: ', trim(NLFilename) + open( newunit=unitn, file=trim(NLFilename), status='old' ) + call shr_nl_find_group_name(unitn, nmlName, status=ierr) + if (ierr == 0) then + read(unitn, slim_inparm, iostat=ierr) + if (ierr /= 0) then + call endrun(msg=subname//'::ERROR reading '//nmlName//' namelist'//errMsg(sourcefile, __LINE__)) + end if + else + call endrun(msg=subname//'::ERROR reading '//nmlName//' namelist'//errMsg(sourcefile, __LINE__)) + end if + close(unitn) + end if + call shr_mpi_bcast( dtime, mpicom ) + + call set_timemgr_init( dtime_in=dtime ) + + end subroutine control_readNL_Physics + !------------------------------------------------------------------------ subroutine control_spmd() ! @@ -448,20 +447,11 @@ subroutine control_spmd() call mpi_bcast (use_cn, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_nguardrail, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (use_crop, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (use_noio, 1, MPI_LOGICAL, 0, mpicom, ier) ! initial file variables - call mpi_bcast (nrevsn, len(nrevsn), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat, len(finidat), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat_interp_source, len(finidat_interp_source), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (finidat_interp_dest, len(finidat_interp_dest), MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (fsurdat, len(fsurdat), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (fatmlndfrc,len(fatmlndfrc),MPI_CHARACTER, 0, mpicom, ier) call mpi_bcast (paramfile, len(paramfile) , MPI_CHARACTER, 0, mpicom, ier) - ! mml input file vars for simple model - call mpi_bcast (mml_surdat, len(mml_surdat), MPI_CHARACTER, 0, mpicom, ier) - ! Irrigation call mpi_bcast(irrigate, 1, MPI_LOGICAL, 0, mpicom, ier) @@ -516,27 +506,6 @@ subroutine control_spmd() call mpi_bcast (maxpatch_glcmec, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (glc_snow_persistence_max_days, 1, MPI_INTEGER, 0, mpicom, ier) - ! history file variables - call mpi_bcast (hist_empty_htapes, 1, MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_dov2xy, size(hist_dov2xy), MPI_LOGICAL, 0, mpicom, ier) - call mpi_bcast (hist_nhtfrq, size(hist_nhtfrq), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_mfilt, size(hist_mfilt), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_ndens, size(hist_ndens), MPI_INTEGER, 0, mpicom, ier) - call mpi_bcast (hist_avgflag_pertape, size(hist_avgflag_pertape), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_type1d_pertape, max_namlen*size(hist_type1d_pertape), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl1, max_namlen*size(hist_fexcl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl2, max_namlen*size(hist_fexcl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl3, max_namlen*size(hist_fexcl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl4, max_namlen*size(hist_fexcl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl5, max_namlen*size(hist_fexcl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fexcl6, max_namlen*size(hist_fexcl6), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl1, (max_namlen+2)*size(hist_fincl1), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl2, (max_namlen+2)*size(hist_fincl2), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl3, (max_namlen+2)*size(hist_fincl3), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl4, (max_namlen+2)*size(hist_fincl4), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl5, (max_namlen+2)*size(hist_fincl5), MPI_CHARACTER, 0, mpicom, ier) - call mpi_bcast (hist_fincl6, (max_namlen+2)*size(hist_fincl6), MPI_CHARACTER, 0, mpicom, ier) - ! restart file variables call mpi_bcast (rpntfil, len(rpntfil), MPI_CHARACTER, 0, mpicom, ier) @@ -573,7 +542,6 @@ subroutine control_print () write(iulog,*) ' use_vertsoilc = ', use_vertsoilc write(iulog,*) ' use_century_decomp = ', use_century_decomp write(iulog,*) ' use_cn = ', use_cn - write(iulog,*) ' use_noio = ', use_noio write(iulog,*) 'input data files:' write(iulog,*) ' PFT physiology and parameters file = ',trim(paramfile) @@ -641,43 +609,4 @@ subroutine control_print () end subroutine control_print - - !----------------------------------------------------------------------- - subroutine apply_use_init_interp(finidat, finidat_interp_source) - ! - ! !DESCRIPTION: - ! Applies the use_init_interp option, setting finidat_interp_source to finidat - ! - ! Should be called if use_init_interp is true. - ! - ! Does error checking to ensure that it is valid to set use_init_interp to true, - ! given the values of finidat and finidat_interp_source. - ! - ! !USES: - ! - ! !ARGUMENTS: - character(len=*), intent(inout) :: finidat - character(len=*), intent(inout) :: finidat_interp_source - ! - ! !LOCAL VARIABLES: - - character(len=*), parameter :: subname = 'apply_use_init_interp' - !----------------------------------------------------------------------- - - if (finidat == ' ') then - call endrun(msg=' ERROR: Can only set use_init_interp if finidat is set') - end if - - if (finidat_interp_source /= ' ') then - call endrun(msg=' ERROR: Cannot set use_init_interp if finidat_interp_source is & - &already set') - end if - - finidat_interp_source = finidat - finidat = ' ' - - end subroutine apply_use_init_interp - - - end module controlMod diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 918b0259..4e2347a3 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -105,6 +105,7 @@ module histFileMod logical, private :: if_disphist(max_tapes) ! restart, true => save history file ! ! !PUBLIC MEMBER FUNCTIONS: + public :: hist_readNML ! Read in the history namelist settings public :: hist_addfld1d ! Add a 1d single-level field to the master field list public :: hist_addfld2d ! Add a 2d multi-level field to the master field list public :: hist_addfld_decomp ! Add a 2d multi-level field to the master field list @@ -4375,6 +4376,75 @@ character(len=max_length_filename) function set_hist_filename (hist_freq, hist_m end if end function set_hist_filename + !----------------------------------------------------------------------- + subroutine hist_readNML ( NLFilename ) + use shr_mpi_mod , only : shr_mpi_bcast + use spmdMod , only : mpicom + use clm_nlUtilsMod , only : find_nlgroup_name + use clm_varctl , only : use_noio + use shr_const_mod , only : SHR_CONST_CDAY + use clm_time_manager, only : get_step_size + + implicit none + + character(len=*), intent(IN) :: NLFilename ! Namelist file names + !----------------------------------------------------------------------- + ! !LOCAL VARIABLES: + integer :: i ! Indices + integer :: nu_nml ! Unit for namelist file + integer :: nml_error ! Error code + integer :: dtime ! time step + character(len=*), parameter :: nml_name = 'slim_history' + character(len=*), parameter :: subname = 'hist_readNML' + namelist /slim_history/ use_noio, hist_empty_htapes + namelist /slim_history/ hist_avgflag_pertape + namelist /slim_history/ hist_nhtfrq, hist_ndens + namelist /slim_history/ hist_mfilt, hist_fincl1, hist_fincl2, hist_fincl3 + namelist /slim_history/ hist_fincl4, hist_fincl5 + namelist /slim_history/ hist_fincl6, hist_fexcl1 + !----------------------------------------------------------------------- + + if (masterproc) then + open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) + call find_nlgroup_name(nu_nml, nml_name, status=nml_error) + if (nml_error == 0) then + read(nu_nml, nml=slim_history,iostat=nml_error) + if (nml_error /= 0) then + call endrun(subname // ':: ERROR reading '//nml_name//' namelist') + end if + else + call endrun(subname // ':: ERROR could NOT find '//nml_name//' namelist') + end if + close(nu_nml) + end if + + call shr_mpi_bcast( use_noio, mpicom ) + call shr_mpi_bcast( hist_empty_htapes, mpicom ) + call shr_mpi_bcast( hist_avgflag_pertape, mpicom ) + call shr_mpi_bcast( hist_nhtfrq, mpicom ) + call shr_mpi_bcast( hist_ndens, mpicom ) + call shr_mpi_bcast( hist_mfilt, mpicom ) + call shr_mpi_bcast( hist_fincl1, mpicom ) + call shr_mpi_bcast( hist_fincl2, mpicom ) + call shr_mpi_bcast( hist_fincl3, mpicom ) + call shr_mpi_bcast( hist_fincl4, mpicom ) + call shr_mpi_bcast( hist_fincl5, mpicom ) + call shr_mpi_bcast( hist_fincl6, mpicom ) + call shr_mpi_bcast( hist_fexcl1, mpicom ) + + ! History and restart files + + dtime = get_step_size() + do i = 1, max_tapes + if (hist_nhtfrq(i) == 0) then + hist_mfilt(i) = 1 + else if (hist_nhtfrq(i) < 0) then + hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) + endif + end do + + end subroutine hist_readNML + !----------------------------------------------------------------------- subroutine hist_addfld1d (fname, units, avgflag, long_name, type1d_out, & ptr_gcell, ptr_lunit, ptr_col, ptr_patch, ptr_lnd, & diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index 2dff6911..f35cf64e 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -55,6 +55,7 @@ module mml_mainMod ! !PRIVATE MEMBER FUNCTIONS: private :: nc_import + private :: apply_use_init_interp ! apply the use_init_interp namelist option, if set ! mml: can I store the subroutines in other files? (just to keep this one from getting outrageously long? ! try it... (move nc_import, for starters... ) @@ -89,7 +90,7 @@ subroutine readnml_datasets( NLFilename ) use spmdMod , only : mpicom use clm_nlUtilsMod , only : find_nlgroup_name use clm_varctl , only : finidat, fatmlndfrc, finidat_interp_dest - use clm_varctl , only : nrevsn, fname_len + use clm_varctl , only : nrevsn, fname_len, mml_surdat, finidat_interp_source implicit none @@ -98,13 +99,15 @@ subroutine readnml_datasets( NLFilename ) ! !LOCAL VARIABLES: integer :: nu_nml ! Unit for namelist file integer :: nml_error ! Error code + logical :: use_init_interp ! Turn on interpolation of initial conditions character(len=*), parameter :: nml_name = 'slim_data_and_initial' character(len=*), parameter :: subname = 'readnml_datasets' namelist /slim_data_and_initial/ mml_surdat, finidat, fatmlndfrc - namelist /slim_data_and_initial/ finidat_interp_dest, nrevsn + namelist /slim_data_and_initial/ finidat_interp_dest, nrevsn, use_init_interp !----------------------------------------------------------------------- fatmlndfrc = ' ' + use_init_interp = .false. if (masterproc) then open( newunit=nu_nml, file=trim(NLFilename), status='old', iostat=nml_error ) call find_nlgroup_name(nu_nml, nml_name, status=nml_error) @@ -123,10 +126,19 @@ subroutine readnml_datasets( NLFilename ) call shr_mpi_bcast( finidat_interp_dest, mpicom ) call shr_mpi_bcast( nrevsn, mpicom ) call shr_mpi_bcast( fatmlndfrc, mpicom ) + call shr_mpi_bcast( use_init_interp, mpicom ) + + if (use_init_interp) then + call apply_use_init_interp(finidat, finidat_interp_source) + end if + if (masterproc) then write(iulog,*) 'nrevsn = ', trim(nrevsn) write(iulog,*) 'finidat = ', trim(finidat) - write(iulog,*) 'finidat_interp_dest = ', trim(finidat_interp_dest) + if ( use_init_interp )then + write(iulog,*) 'Interpolate initial conditions' + write(iulog,*) 'finidat_interp_dest = ', trim(finidat_interp_dest) + end if if (fatmlndfrc == ' ') then write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' @@ -140,7 +152,46 @@ subroutine readnml_datasets( NLFilename ) write(iulog,*) ' mml_surdat IS set, and = ',trim(mml_surdat) end if end if + end subroutine readnml_datasets + + !----------------------------------------------------------------------- + subroutine apply_use_init_interp(finidat, finidat_interp_source) + ! + ! !DESCRIPTION: + ! Applies the use_init_interp option, setting finidat_interp_source to + ! finidat + ! + ! Should be called if use_init_interp is true. + ! + ! Does error checking to ensure that it is valid to set use_init_interp to + ! true, + ! given the values of finidat and finidat_interp_source. + ! + ! !USES: + ! + ! !ARGUMENTS: + character(len=*), intent(inout) :: finidat + character(len=*), intent(inout) :: finidat_interp_source + ! + ! !LOCAL VARIABLES: + + character(len=*), parameter :: subname = 'apply_use_init_interp' + !----------------------------------------------------------------------- + + if (finidat == ' ') then + call endrun(msg=subname//'::ERROR: Can only set use_init_interp if finidat is set') + end if + + if (finidat_interp_source /= ' ') then + call endrun(msg=subname//'::ERROR: Cannot set use_init_interp if finidat_interp_source is & + &already set') + end if + + finidat_interp_source = finidat + finidat = ' ' + + end subroutine apply_use_init_interp !----------------------------------------------------------------------- subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst From f62a65a579aa4cf9f637ab3ad33c0656427adce0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 16:06:55 -0600 Subject: [PATCH 121/164] Add back in some namelist items that may be added in later, or could currently be used, including two namelists for initialization interpolation --- cime_config/namelist_definition_slim.xml | 91 ++++++++++++++++++++++++ cime_config/slim_cime_py/buildnml.py | 15 ++-- 2 files changed, 102 insertions(+), 4 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index cec1cc5e..3e1a93ba 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -287,6 +287,44 @@ Horizontal resolutions + + + + + + logical + datasets + finidat_consistency_checks + .true. + + If TRUE (which is the default), check consistency between pct_pft on the finidat file + and pct_pft read from the surface dataset. + + This requires that finidat be non-blank. + + This should probably be removed. + + + + + logical + datasets + clm_initinterp_inparm + .false. + + If FALSE (which is the default): If an output type cannot be found in the input for initInterp, + code aborts + If TRUE: If an output type cannot be found in the input, fill with closest natural veg column + (using bare soil for patch-level variables) + + NOTE: Natural vegetation and crop landunits always behave as if this were true. e.g., if + we can't find a column with the same type as a given crop column in the output, then we + always fill with the closest natural veg patch / column, regardless of the value of this + flag. So interpolation from non-crop to crop cases can be done without setting this flag. + + This should probably be removed. + + @@ -323,4 +361,57 @@ + + logical + slim_physics + clm_inparm + + If Carbon/Nitrogen model should be used + Currently this is used in a couple places in SLIM, but should be removed. + + + + + + + + + + + integer + performance + clm_inparm + + Number of processors to use per clump (when threading is implemented) + Currently has no effect + See this issue: + https://github.com/ESCOMP/SimpleLand/issues/29 + + + + + logical + datasets + clm_inparm + + Write diagnostics out to the log file about global statistics + Currently is implemented, but should be removed. + + + + + + logical + datasets + clm_inparm + .false. + .false. + + Run as a single column (NOT currently implemented) + See this issue: + https://github.com/ESCOMP/SimpleLand/issues/29 + + + + diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 072e414f..242975b4 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -360,15 +360,14 @@ def check_nml_data(nmlgen, case): if finidat_dest is not None and not interp: raise SystemExit("finidat_interp_dest can NOT be set if use_init_interp is not on") - #----------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------- # Requirements still in clm_inparm - #----------------------------------------------------------------------------------------- + # ----------------------------------------------------------------------------------------- fsurdat = nmlgen.get_value("fsurdat") if fsurdat == "UNSET": raise SystemExit("fsurdat file is NOT set and is required") - # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements # Turn off unused-argument for inst_string, since isn't in place right now # pylint: disable=unused-argument @@ -418,7 +417,15 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path nmlgen.write_output_file( namelist_file, data_list_path, - groups=["slim_inparm", "slim_data_and_initial", "slim_history", "slim_perf", "clm_inparm"], + groups=[ + "slim_inparm", + "slim_data_and_initial", + "slim_history", + "slim_perf", + "finidat_consistency_checks", + "clm_initinterp_inparm", + "clm_inparm", + ], ) From 43378ce3ceb4d01fa568ef819015fe4e8f8e5b37 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 16:25:40 -0600 Subject: [PATCH 122/164] Set value of new namelist items added back in --- cime_config/namelist_definition_slim.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 3e1a93ba..f18e4811 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -296,6 +296,9 @@ datasets finidat_consistency_checks .true. + + .true. + If TRUE (which is the default), check consistency between pct_pft on the finidat file and pct_pft read from the surface dataset. @@ -311,6 +314,9 @@ datasets clm_initinterp_inparm .false. + + .false. + If FALSE (which is the default): If an output type cannot be found in the input for initInterp, code aborts From 31e8e4545b2586d58adfad70b3529a39f799426b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 20:18:42 -0600 Subject: [PATCH 123/164] Add read of slim_perf namelist --- src/main/clm_initializeMod.F90 | 3 +- src/main/controlMod.F90 | 63 ++++++++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/src/main/clm_initializeMod.F90 b/src/main/clm_initializeMod.F90 index 62ec1e77..03b41227 100644 --- a/src/main/clm_initializeMod.F90 +++ b/src/main/clm_initializeMod.F90 @@ -50,7 +50,7 @@ subroutine initialize1( ) use decompInitMod , only: decompInit_lnd, decompInit_clumps, decompInit_glcp use domainMod , only: domain_check, ldomain, domain_init use surfrdMod , only: surfrd_get_globmask, surfrd_get_grid, surfrd_get_data - use controlMod , only: control_init, control_print, NLFilename, control_readNL_Physics + use controlMod , only: control_init, control_print, NLFilename, control_readNL_Physics, control_readNL_Perf use ncdio_pio , only: ncd_pio_init use initGridCellsMod , only: initGridCells use UrbanParamsType , only: UrbanInput, IsSimpleBuildTemp @@ -86,6 +86,7 @@ subroutine initialize1( ) call control_readNL_Physics() call readnml_datasets( NLFilename ) + call control_readNL_Perf() call control_init() call clm_varpar_init() call clm_varcon_init( IsSimpleBuildTemp() ) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index da1b21a2..f6f8c63e 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -42,6 +42,7 @@ module controlMod ! !PUBLIC MEMBER FUNCTIONS: public :: control_setNL ! Set namelist filename public :: control_init ! initial run control information + public :: control_readNL_Perf ! read in the namelist for SLIM performance settings public :: control_readNL_Physics ! read in the namelist for SLIM physics settings public :: control_print ! print run control information ! @@ -137,7 +138,7 @@ subroutine control_init( ) namelist /clm_inparm/ & clump_pproc, wrtdia, & - create_crop_landunit, nsegspc, co2_ppmv, override_nsrest, & + create_crop_landunit, co2_ppmv, override_nsrest, & albice, soil_layerstruct, subgridflag, & all_active @@ -209,7 +210,7 @@ subroutine control_init( ) if (masterproc) then ! ---------------------------------------------------------------------- - ! Read namelist from standard input. + ! Read namelist ! ---------------------------------------------------------------------- if ( len_trim(NLFilename) == 0 )then @@ -362,7 +363,7 @@ end subroutine control_init subroutine control_readNL_Physics( ) ! ! !DESCRIPTION: - ! Initialize CLM run control information + ! Initialize SLIM run physics information ! ! !USES: use shr_mpi_mod , only : shr_mpi_bcast @@ -388,7 +389,7 @@ subroutine control_readNL_Physics( ) if (masterproc) then ! ---------------------------------------------------------------------- - ! Read namelist from standard input. + ! Read namelist ! ---------------------------------------------------------------------- if ( len_trim(NLFilename) == 0 )then @@ -413,6 +414,58 @@ subroutine control_readNL_Physics( ) end subroutine control_readNL_Physics + !------------------------------------------------------------------------ + subroutine control_readNL_Perf( ) + ! + ! !DESCRIPTION: + ! Initialize SLIM run performance information + ! + ! !USES: + use shr_mpi_mod , only : shr_mpi_bcast + use clm_time_manager, only : set_timemgr_init + use spmdMod , only : mpicom + ! + ! !LOCAL VARIABLES: + integer :: i ! loop indices + integer :: ierr ! error code + integer :: unitn ! unit for namelist file + character(len=*), parameter :: subname = "control_readNL_Perf" + character(len=*), parameter :: nmlName = "slim_perf" + !------------------------------------------------------------------------ + + ! ---------------------------------------------------------------------- + ! Namelist Variables + ! ---------------------------------------------------------------------- + + ! Time step + namelist / slim_perf/ nsegspc + + if (masterproc) then + + ! ---------------------------------------------------------------------- + ! Read namelist + ! ---------------------------------------------------------------------- + + if ( len_trim(NLFilename) == 0 )then + call endrun(msg=subname//'::ERROR: nlfilename not set'//errMsg(sourcefile, __LINE__)) + end if + write(iulog,*) 'Read in '//nmlName//' namelist from: ', trim(NLFilename) + open( newunit=unitn, file=trim(NLFilename), status='old' ) + call shr_nl_find_group_name(unitn, nmlName, status=ierr) + if (ierr == 0) then + read(unitn, slim_perf, iostat=ierr) + if (ierr /= 0) then + call endrun(msg=subname//'::ERROR reading '//nmlName//' namelist'//errMsg(sourcefile, __LINE__)) + end if + else + call endrun(msg=subname//'::ERROR reading '//nmlName//' namelist'//errMsg(sourcefile, __LINE__)) + end if + close(unitn) + end if + call shr_mpi_bcast( nsegspc, mpicom ) + + end subroutine control_readNL_Perf + !------------------------------------------------------------------------ subroutine control_spmd() ! @@ -488,7 +541,6 @@ subroutine control_spmd() end if ! physics variables - call mpi_bcast (nsegspc, 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (subgridflag , 1, MPI_INTEGER, 0, mpicom, ier) call mpi_bcast (wrtdia, 1, MPI_LOGICAL, 0, mpicom, ier) call mpi_bcast (single_column,1, MPI_LOGICAL, 0, mpicom, ier) @@ -605,7 +657,6 @@ subroutine control_print () write(iulog,*) ' Surface data set and reference date should not differ from initial run' end if write(iulog,*) ' maxpatch_pft = ',maxpatch_pft - write(iulog,*) ' nsegspc = ',nsegspc end subroutine control_print From 9f6a21dc72cc547f60e13df086368fdb7ae1ccfd Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 20:21:20 -0600 Subject: [PATCH 124/164] Abort if the finidat_consistency_checks wasn't found --- src/main/restFileMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 92cc0cff..3123b707 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -838,7 +838,7 @@ subroutine restFile_read_consistency_nl( & call endrun(msg='ERROR reading finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) end if else - write(iulog,*) 'Could not find finidat_consistency_checks namelist' + call endrun(msg='Could not find finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) end if close(nu_nml) call relavu( nu_nml ) From 781cbc360d69606ab5145d47da5b57cd9d5d8027 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Tue, 11 Oct 2022 20:23:35 -0600 Subject: [PATCH 125/164] Require the clm_initinterp_inparm namelist --- src/init_interp/initInterp.F90 | 2 +- src/main/restFileMod.F90 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init_interp/initInterp.F90 b/src/init_interp/initInterp.F90 index 93bddc1d..e15b7303 100644 --- a/src/init_interp/initInterp.F90 +++ b/src/init_interp/initInterp.F90 @@ -100,7 +100,7 @@ subroutine initInterp_readnl(NLFilename) call endrun(msg="ERROR reading clm_initinterp_inparm namelist"//errmsg(sourcefile, __LINE__)) end if else - write(iulog,*) "Could not find clm_initinterp_inparm namelist" + call endrun(msg='ERROR Could not find clm_initinterp_inparm namelist'//errmsg(sourcefile, __LINE__)) end if call relavu( unitn ) end if diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 3123b707..7d0354a9 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -838,7 +838,7 @@ subroutine restFile_read_consistency_nl( & call endrun(msg='ERROR reading finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) end if else - call endrun(msg='Could not find finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) + call endrun(msg='ERROR Could not find finidat_consistency_checks namelist'//errMsg(sourcefile, __LINE__)) end if close(nu_nml) call relavu( nu_nml ) From 7007cadede55b2fba363dec6e001535516599f3c Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sun, 30 Oct 2022 20:45:06 -0600 Subject: [PATCH 126/164] Add user_defined SLIM_SCENARIO to make it more obvious how to set your own surface conditions --- cime_config/config_component.xml | 6 +++++- cime_config/namelist_definition_slim.xml | 1 + cime_config/slim_cime_py/buildnml.py | 6 ++++++ python/slim/test/test_unit_buildnml.py | 10 ++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cime_config/config_component.xml b/cime_config/config_component.xml index b00fe93b..e90e3dcc 100644 --- a/cime_config/config_component.xml +++ b/cime_config/config_component.xml @@ -29,7 +29,7 @@ char global_uniform - global_uniform,realistic_from_1850,realistic_from_2000 + global_uniform,realistic_from_1850,realistic_from_2000,user_defined realistic_from_2000 realistic_from_1850 @@ -40,6 +40,10 @@ SLIM namelist use_case scenario. Determines the use-case scenario that will be used in the SLIM buildnml utility. This is normally set by the component set. + 'global_uniform' is for surface conditions are globally constant + 'realistic_from_1850' are surface conditions taken from a 1850 control simulation with CTSM + 'realistic_from_2000' are surface conditions taken from a 2000 control simulation with CTSM + 'user_defined' means the user will provide their own surface condition file (mml_surdat) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index f18e4811..dfe5c21a 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -17,6 +17,7 @@ slim_data_and_initial UNSET + UNSET $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 242975b4..2fe01c4a 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -332,6 +332,12 @@ def check_nml_data(nmlgen, case): mml_surdat = nmlgen.get_value("mml_surdat") if mml_surdat == "UNSET": + slim_scenario = case.get_value("SLIM_SCENARIO") + if slim_scenario == "user_defined": + raise SystemExit( + "When SLIM_SCENARIO is set to user_defined, you must provide the mml_surdat " + + "file by adding it to the user_nl_slim file to add it to the namelist" + ) raise SystemExit("mml_surdat file is NOT set and is required") # diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index fd013733..534bd5d1 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -288,6 +288,16 @@ def test_check_init_data(self): ): check_nml_initial_conditions(self.nmlgen, self.case) + def test_check_set_user_defined(self): + """Test the check nml initial data subroutine for user_defined """ + self.case.set_value("SLIM_SCENARIO", "user_defined") + self.InitNML() + with self.assertRaisesRegex( + SystemExit, "When SLIM_SCENARIO is set to user_defined, you must provide the mml_surdat" + ): + check_nml_data(self.nmlgen, self.case) + + def test_check_use_init_interp(self): """Test the check nml initial data subroutine for use_init_interp options""" self.case.set_value("SLIM_START_TYPE", "startup") From 76a5ca3ead1fa8dba4176b8b41a985922fb38121 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 15:43:15 -0700 Subject: [PATCH 127/164] Run through black --- python/slim/test/test_unit_buildnml.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/slim/test/test_unit_buildnml.py b/python/slim/test/test_unit_buildnml.py index 534bd5d1..5a2cd5d9 100755 --- a/python/slim/test/test_unit_buildnml.py +++ b/python/slim/test/test_unit_buildnml.py @@ -289,7 +289,7 @@ def test_check_init_data(self): check_nml_initial_conditions(self.nmlgen, self.case) def test_check_set_user_defined(self): - """Test the check nml initial data subroutine for user_defined """ + """Test the check nml initial data subroutine for user_defined""" self.case.set_value("SLIM_SCENARIO", "user_defined") self.InitNML() with self.assertRaisesRegex( @@ -297,7 +297,6 @@ def test_check_set_user_defined(self): ): check_nml_data(self.nmlgen, self.case) - def test_check_use_init_interp(self): """Test the check nml initial data subroutine for use_init_interp options""" self.case.set_value("SLIM_START_TYPE", "startup") From d3410c02bf06f841c1909acae8af53e930f3b084 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 15:55:42 -0700 Subject: [PATCH 128/164] When getting variables from the namelist make the variable name is an exact match, not just another variable that includes the variable name, so for example finidat as opposed to check_finidat_pct_consistency --- python/slim/test/test_sys_buildnml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 8d69e162..64fdb9ad 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -32,7 +32,7 @@ def getVariableFromNML(nmlfile, variable): """Get a variable from the namelist file""" with open(nmlfile, "r") as nfile: for line in nfile: - if variable in line: + if re.search( "^\s*"+variable+"\s*=", line) is not None: print("lnd_in:" + line) match = re.search('= ["]*([ a-zA-Z0-9._//-]+)["]*', line) if match is not None: @@ -255,7 +255,7 @@ def test_start_types(self): "Input data list file should exist after running buildnml", ) value = getVariableFromNML("lnd_in", "finidat") - self.assertEqual(value, finidat, msg="finidat not set as expected") + self.assertEqual(value, finidat, msg="finidat not set as expected: type="+stype) stype = "required" finidat = "TESTFINIDATFILENAME.nc" Path(finidat).touch() From 69131d54fea92941fb55c4edbfc6e8ac60260381 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 15:57:54 -0700 Subject: [PATCH 129/164] Run black and fix pylint --- python/slim/test/test_sys_buildnml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index 64fdb9ad..a8945ce2 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -32,12 +32,12 @@ def getVariableFromNML(nmlfile, variable): """Get a variable from the namelist file""" with open(nmlfile, "r") as nfile: for line in nfile: - if re.search( "^\s*"+variable+"\s*=", line) is not None: + if re.search(r"^\s*" + variable + r"\s*=", line) is not None: print("lnd_in:" + line) - match = re.search('= ["]*([ a-zA-Z0-9._//-]+)["]*', line) + match = re.search(r'= ["]*([ a-zA-Z0-9._//-]+)["]*', line) if match is not None: return match.group(1) - match = re.search("= [']*([ a-zA-Z0-9._//-]+)[']*", line) + match = re.search(r"= [']*([ a-zA-Z0-9._//-]+)[']*", line) if match is not None: return match.group(1) return None @@ -255,7 +255,7 @@ def test_start_types(self): "Input data list file should exist after running buildnml", ) value = getVariableFromNML("lnd_in", "finidat") - self.assertEqual(value, finidat, msg="finidat not set as expected: type="+stype) + self.assertEqual(value, finidat, msg="finidat not set as expected: type=" + stype) stype = "required" finidat = "TESTFINIDATFILENAME.nc" Path(finidat).touch() From d8787266d53ee0a45b09fc2316235f826703a82e Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 17:02:54 -0700 Subject: [PATCH 130/164] Change compsets to follow the new CAM naming convention as well as possible (but include CAM and CICE version numbers which is against the convention --- cime_config/config_compsets.xml | 10 +++++----- cime_config/testdefs/testlist_slim.xml | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cime_config/config_compsets.xml b/cime_config/config_compsets.xml index 9ab1d2d8..d985f733 100644 --- a/cime_config/config_compsets.xml +++ b/cime_config/config_compsets.xml @@ -40,30 +40,30 @@ - E2000Cam6SlimRsGs + ELT2000ClimoTESTC6I5Slim 2000_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - E1850Cam6SlimRsGs + ELT1850TESTC6I5Slim 1850_CAM60_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - F2000Cam6SlimRsGs + FLT2000ClimoC6I5Slim 2000_CAM60_SLIM_CICE%PRES_DOCN%DOM_SROF_SGLC_SWAV - E2000Cam5SlimRsGs + ELT2000ClimoTESTC5I5Slim 2000_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV - FHistCam5SlimRsGs + FLTHISTC5I5Slim HIST_CAM50_SLIM_CICE_DOCN%SOM_SROF_SGLC_SWAV diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index 8c5e6bb0..b827771f 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -106,7 +106,7 @@ - + @@ -135,7 +135,7 @@ - + From f2594018d5ca12a9a68835d62de5ae5490063b77 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 17:40:52 -0700 Subject: [PATCH 131/164] Remove some variables so that it will compile --- src/main/controlMod.F90 | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index 5806d004..ed0a525b 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -21,7 +21,7 @@ module controlMod use initInterpMod , only: initInterp_readnl use clm_varctl , only: iundef, rundef, nsrest, caseid, ctitle, nsrStartup, nsrContinue use clm_varctl , only: nsrBranch, brnch_retain_casename, hostname, username, source, version, conventions - use clm_varctl , only: iulog, outnc_large_files, finidat, fsurdat, fatmgrid + use clm_varctl , only: iulog, outnc_large_files, fsurdat, fatmgrid use clm_varctl , only: co2_type use clm_varctl , only: wrtdia, co2_ppmv, nsegspc, rpntdir, rpntfil use clm_varctl , only: NLFilename_in @@ -153,11 +153,7 @@ subroutine control_init( ) #else clump_pproc = 1 #endif - maxpatch_glcmec = 10 nlevsno = 5 - h2osno_max = 1000.0_r8 - int_snow_max = 1.e30_r8 - n_melt_glcmec = 10.0_r8 override_nsrest = nsrest @@ -243,26 +239,12 @@ subroutine control_init( ) call endrun(msg=' ERROR:: must set nsrest'//& errMsg(sourcefile, __LINE__)) end if - if (nsrest == nsrBranch .and. nrevsn == ' ') then - call endrun(msg=' ERROR: need to set restart data file name'//& - errMsg(sourcefile, __LINE__)) - end if - ! Consistency settings for co2_ppvm if ( (co2_ppmv <= 0.0_r8) .or. (co2_ppmv > 3000.0_r8) ) then call endrun(msg=' ERROR: co2_ppmv is out of a reasonable range'//& errMsg(sourcefile, __LINE__)) end if - ! Consistency settings for nrevsn - - if (nsrest == nsrStartup ) nrevsn = ' ' - if (nsrest == nsrContinue) nrevsn = 'set by restart pointer file file' - if (nsrest /= nsrStartup .and. nsrest /= nsrContinue .and. nsrest /= nsrBranch ) then - call endrun(msg=' ERROR: nsrest NOT set to a valid value'//& - errMsg(sourcefile, __LINE__)) - end if - if (masterproc) then write(iulog,*) 'Successfully initialized run control settings' write(iulog,*) @@ -458,18 +440,6 @@ subroutine control_print () end if write(iulog,*) ' Number of snow layers =', nlevsno - if (nsrest == nsrStartup) then - if (finidat /= ' ') then - write(iulog,*) ' initial data: ', trim(finidat) - else if (finidat_interp_source /= ' ') then - write(iulog,*) ' initial data interpolated from: ', trim(finidat_interp_source) - else - write(iulog,*) ' initial data created by model (cold start)' - end if - else - write(iulog,*) ' restart data = ',trim(nrevsn) - end if - write(iulog,*) ' atmospheric forcing data is from cesm atm model' write(iulog,*) 'Restart parameters:' write(iulog,*)' restart pointer file directory = ',trim(rpntdir) From 4a1fd909afddccbddce8e04be5827b148e23b762 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 20:13:46 -0700 Subject: [PATCH 132/164] Remove nsegspc from the clm_inparm namelist, should just be in the slim_perf namelist --- src/main/controlMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index ed0a525b..41277261 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -123,7 +123,7 @@ subroutine control_init( ) namelist /clm_inparm/ & clump_pproc, wrtdia, & - nsegspc, co2_ppmv, override_nsrest + co2_ppmv, override_nsrest ! All old cpp-ifdefs are below and have been converted to namelist variables From 5b7b9d82b856f3bd704acdad01182af62b245852 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 20:14:19 -0700 Subject: [PATCH 133/164] Remove paramfile and use_cn as @slevisconsulting was able to remove the need for them --- cime_config/namelist_definition_slim.xml | 25 ------------------------ 1 file changed, 25 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index dfe5c21a..dc587e04 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -354,31 +354,6 @@ - - char - datasets - abs - clm_inparm - - $DIN_LOC_ROOT/lnd/clm2/paramdata/clm_params.c170913.nc - - - PFT and parameter file - - - - - - logical - slim_physics - clm_inparm - - If Carbon/Nitrogen model should be used - Currently this is used in a couple places in SLIM, but should be removed. - - - - From 4b72a30e5fd86bf6a8cc97f1b6eb850975f3772d Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 14 Dec 2022 20:32:39 -0700 Subject: [PATCH 134/164] Hardwire glacier behavior to the default value --- src/main/glcBehaviorMod.F90 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 index cf5869a5..41b85fac 100644 --- a/src/main/glcBehaviorMod.F90 +++ b/src/main/glcBehaviorMod.F90 @@ -415,6 +415,8 @@ subroutine read_namelist(NLFilename, glacier_region_behavior) ! Initialize options to default values glacier_region_behavior(:) = behavior_str_unset + ! Hardwire to the current defaults + glacier_region_behavior(0:3) = (/'single_at_atm_topo','virtual','virtual','multiple' /) if (masterproc) then unitn = getavu() From b73f5653590110212e15e9ccbd9153f9200b3b92 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 12:03:08 -0700 Subject: [PATCH 135/164] Remove shell_commands as the CLM_CO2 setting is not needed any more --- .../realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands | 2 -- 1 file changed, 2 deletions(-) delete mode 100755 cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" From 92ebc85efe025832aa3491d54fe5b9ff9f98a8f0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 12:05:08 -0700 Subject: [PATCH 136/164] Change CLM_FORCE_COLDSTART=on to SLIM_START_TYPE cold --- .../clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands b/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands index 5d354486..f3a1a014 100755 --- a/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands +++ b/cime_config/testdefs/testmods_dirs/clm/2000_CMIP6_AMIP_1deg_ensemble/shell_commands @@ -1,2 +1,2 @@ #!/bin/bash -./xmlchange CLM_FORCE_COLDSTART="on" +./xmlchange SLIM_START_TYPE="cold" From d5ef29e850f205fa970a761b4b2e360bb00540e5 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 12:18:13 -0700 Subject: [PATCH 137/164] Fix compset and testmod names in testlist --- cime_config/testdefs/testlist_slim.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index b827771f..120b301d 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -106,7 +106,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -135,7 +135,7 @@ - + From a6204329a562998425535c2c29399fb95d2ffa3b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 12:58:32 -0700 Subject: [PATCH 138/164] Fix some more tests --- .../include_user_mods | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble_FHistMonthly/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble_FHistMonthly/include_user_mods index 4b850273..7aeecdf4 100644 --- a/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble_FHistMonthly/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_1deg_ensemble_FHistMonthly/include_user_mods @@ -1,2 +1,2 @@ ../Monthly -../2000_CMIP6_AMIP_1deg_ensemble_FHist +../2000_CMIP6_AMIP_1deg_ensemble From fb04ba41045a5f35c62130a75cc0434b0340c4a3 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 12:58:41 -0700 Subject: [PATCH 139/164] Fix some more tests --- cime_config/testdefs/testlist_slim.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index 120b301d..51ae385b 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -116,7 +116,7 @@ - + @@ -125,7 +125,7 @@ - + From 3ab5aa7c72abe89f5e1d7f62b684edeba2d00a34 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 13:12:39 -0700 Subject: [PATCH 140/164] gnu compiler required character strings to be of the same length --- src/main/glcBehaviorMod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/glcBehaviorMod.F90 b/src/main/glcBehaviorMod.F90 index 41b85fac..21b4eb83 100644 --- a/src/main/glcBehaviorMod.F90 +++ b/src/main/glcBehaviorMod.F90 @@ -416,7 +416,7 @@ subroutine read_namelist(NLFilename, glacier_region_behavior) ! Initialize options to default values glacier_region_behavior(:) = behavior_str_unset ! Hardwire to the current defaults - glacier_region_behavior(0:3) = (/'single_at_atm_topo','virtual','virtual','multiple' /) + glacier_region_behavior(0:3) = (/'single_at_atm_topo','virtual ','virtual ','multiple ' /) if (masterproc) then unitn = getavu() From 219f013d31736adf090acffd48d199b6c37b0651 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 14:17:40 -0700 Subject: [PATCH 141/164] Correct compset names for expected fails --- cime_config/testdefs/ExpectedTestFails.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 6673a0e1..a2e2d541 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,37 +29,37 @@ - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 @@ -77,19 +77,19 @@ marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#14 - + FAIL marysa/SimpleLand#25? From 8553b99b903858dc57fc5be3eae9961ff6ff91eb Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 15:07:46 -0700 Subject: [PATCH 142/164] Add shr_assert to check dimension bounds --- src/main/mml_main.F90 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index f35cf64e..f4328cd2 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -20,6 +20,7 @@ module mml_mainMod ! !USES: +#include "shr_assert.h" ! MML: bounds & data type use decompMod , only : bounds_type use spmdMod , only : masterproc @@ -80,7 +81,8 @@ module mml_mainMod ! then used those coeffs instead of the more recent one!) Instead, I'm using the equivalent, but newer, clm ! function QSat, and doing the lhflx calculations with specific humidity rather than saturation vapour pressure - + character(len=*), parameter, private :: sourcefile = & + __FILE__ contains @@ -196,6 +198,7 @@ end subroutine apply_use_init_interp !----------------------------------------------------------------------- subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst + use clm_varpar, only : numrad implicit none type(bounds_type), intent(in) :: bounds @@ -580,6 +583,13 @@ subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst psrf = atm2lnd_inst%forc_psrf_grc ! surface pressure (Pa) pbot = atm2lnd_inst%forc_pbot_not_downscaled_grc ! not downscaled atm pressure (Pa) qbot = atm2lnd_inst%forc_q_not_downscaled_grc ! not downscaled atm specific humidity (kg/kg) + + + SHR_ASSERT(numrad == 2, errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(fsds_dir) == (/bounds%endg,numrad/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(fsds_dir) == (/bounds%begg,1/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((ubound(atm2lnd_inst%forc_solad_grc) == (/bounds%endg,numrad/)), errMsg(sourcefile, __LINE__)) + SHR_ASSERT_ALL((lbound(atm2lnd_inst%forc_solad_grc) == (/bounds%begg,1/)), errMsg(sourcefile, __LINE__)) ! NOTE: this is NOT going to be consistent with CAM, still, if I use pbot and psrf as the "edges" of ! my lowest atm layer; cam uses the actual pressure levels at the edges of the lowermost ! atmospheric layer, but all I've got is pbot (which is likely in the middle of the lowest layer) From dc2e4c6685bab2d831e511357b064eb809742571 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 15 Dec 2022 16:04:16 -0700 Subject: [PATCH 143/164] The current nsegspc default is 35 rather than 20 --- cime_config/namelist_definition_slim.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index dc587e04..47b66e6e 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -104,9 +104,9 @@ slim_performance slim_perf number of segments per clump for decomposition - 20 + 35 - 20 + 35 From 36c6e5242b8977ef8ece3130af6921a9a49163fc Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 09:03:35 -0700 Subject: [PATCH 144/164] Add message if use_noio is set --- src/main/histFileMod.F90 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 1e02d6f3..5b229a02 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -4293,6 +4293,9 @@ subroutine hist_readNML ( NLFilename ) hist_nhtfrq(i) = nint(-hist_nhtfrq(i)*SHR_CONST_CDAY/(24._r8*dtime)) endif end do + if ( masterproc )then + if ( use_noio ) write(iulog,*) ' History output is turned off with use_noio = ', use_noio + end if end subroutine hist_readNML From c59aa61db43df1dca1b6c29e7c79f3e60cbbb09b Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 09:05:19 -0700 Subject: [PATCH 145/164] Add back the writing and error checking on the startup type, and die if mml_surdat or fatmlndfrc isn't given --- src/main/mml_main.F90 | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index f4328cd2..eabb70c9 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -91,8 +91,9 @@ subroutine readnml_datasets( NLFilename ) use shr_mpi_mod , only : shr_mpi_bcast use spmdMod , only : mpicom use clm_nlUtilsMod , only : find_nlgroup_name - use clm_varctl , only : finidat, fatmlndfrc, finidat_interp_dest + use clm_varctl , only : finidat, fatmlndfrc, finidat_interp_dest, nsrest use clm_varctl , only : nrevsn, fname_len, mml_surdat, finidat_interp_source + use clm_varctl , only : nsrStartup, nsrContinue, nsrBranch implicit none @@ -143,16 +144,41 @@ subroutine readnml_datasets( NLFilename ) end if if (fatmlndfrc == ' ') then - write(iulog,*) ' fatmlndfrc not set, setting frac/mask to 1' + call endrun(subname // ':: ERROR fatmlndfrc was NOT set and needs to be' ) else write(iulog,*) ' land frac data = ',trim(fatmlndfrc) end if if (mml_surdat == ' ') then - write(iulog,*) ' mml_surdat NOT set, check that we are using the default' + call endrun(subname // ':: ERROR mml_surdat was NOT set and needs to be' ) else write(iulog,*) ' mml_surdat IS set, and = ',trim(mml_surdat) end if + + if (nsrest == nsrBranch .and. nrevsn == ' ') then + call endrun(msg=' ERROR: need to set restart data file name'//& + errMsg(sourcefile, __LINE__)) + end if + ! Consistency settings for nrevsn + + if (nsrest == nsrStartup ) nrevsn = ' ' + if (nsrest == nsrContinue) nrevsn = 'set by restart pointer file file' + if (nsrest /= nsrStartup .and. nsrest /= nsrContinue .and. nsrest /= nsrBranch ) then + call endrun(msg=' ERROR: nsrest NOT set to a valid value'//& + errMsg(sourcefile, __LINE__)) + end if + if (nsrest == nsrStartup) then + if (finidat /= ' ') then + write(iulog,*) ' initial data: ', trim(finidat) + else if (finidat_interp_source /= ' ') then + write(iulog,*) ' initial data interpolated from: ', trim(finidat_interp_source) + else + write(iulog,*) ' initial data created by model (cold start)' + end if + else + write(iulog,*) ' restart data = ',trim(nrevsn) + end if + end if end subroutine readnml_datasets From f8b2b413f1afe611e89dbda4f193b25f069c744f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 09:46:35 -0700 Subject: [PATCH 146/164] Add back co2_type to the namelist as still needed for HIST_CAM compsets --- cime_config/namelist_definition_slim.xml | 17 +++++++++++++++++ cime_config/slim_cime_py/buildnml.py | 1 + 2 files changed, 18 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 47b66e6e..014eabe0 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -354,6 +354,23 @@ + + char + clm_leftover + clm_inparm + constant,prognostic,diagnostic + + constant + diagnostic + + + Type of CO2 feedback. + constant = use the input co2_ppmv value + prognostic = use the prognostic value sent from the atmosphere + diagnostic = use the diagnostic value sent from the atmosphere + + + diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 2fe01c4a..cf86b7ff 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -394,6 +394,7 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # ------------------------------------------------------ config = {} config["lnd_grid"] = case.get_value("LND_GRID") + config["compset"] = case.get_value("COMPSET") config["slim_scenario"] = case.get_value("SLIM_SCENARIO") config["slim_start_type"] = case.get_value("SLIM_START_TYPE") From 53b48531b2c24e33121a3da9beba4879bd1e03f9 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 10:32:37 -0700 Subject: [PATCH 147/164] Add co2_ppmv set to a constant 999.99 value, this is needed for one because there is a MML_pco2 value --- cime_config/namelist_definition_slim.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 014eabe0..31519e9a 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -371,6 +371,18 @@ + + real + clm_leftover + clm_inparm + + 999.9 + + + Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) + + + From 17c5bc9e4b483a5751129984965f32b9b5e3770f Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 15:51:34 -0700 Subject: [PATCH 148/164] Change the testing grids from the old form of f19_g16 to the new form f19_f19_mg16, also change documentation on repository from marysa to ESCOMP --- cime_config/testdefs/ExpectedTestFails.xml | 52 +++++++++++----------- cime_config/testdefs/testlist_slim.xml | 34 +++++++------- 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index a2e2d541..a735b94c 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,82 +29,82 @@ - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#14 + ESCOMP/SimpleLand#14 - + FAIL - marysa/SimpleLand#25? + ESCOMP/SimpleLand#25? - + FAIL - marysa/SimpleLand#17 + ESCOMP/SimpleLand#17 - + FAIL - marysa/SimpleLand#17 + ESCOMP/SimpleLand#17 diff --git a/cime_config/testdefs/testlist_slim.xml b/cime_config/testdefs/testlist_slim.xml index 51ae385b..2b4f1305 100644 --- a/cime_config/testdefs/testlist_slim.xml +++ b/cime_config/testdefs/testlist_slim.xml @@ -6,7 +6,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -52,7 +52,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -89,7 +89,7 @@ - + @@ -106,7 +106,7 @@ - + @@ -116,7 +116,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -145,7 +145,7 @@ - + @@ -154,7 +154,7 @@ - + @@ -168,7 +168,7 @@ - + @@ -178,7 +178,7 @@ - + From 8773ebd2bfbd61a4b6ffb21332946e0d021f1f80 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 17:44:40 -0700 Subject: [PATCH 149/164] Add some write to show why the SHR_ASSERT might be failing --- src/main/mml_main.F90 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index eabb70c9..c8c59caf 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -24,6 +24,7 @@ module mml_mainMod ! MML: bounds & data type use decompMod , only : bounds_type use spmdMod , only : masterproc + use shr_sys_mod, only : shr_sys_flush use atm2lndType, only : atm2lnd_type use lnd2atmType, only : lnd2atm_type ! MML: probably going to need a lnd2atm type ! to hand to the coupler as data coming from the land going to the atmosphere (l2x) @@ -42,7 +43,7 @@ module mml_mainMod use perf_mod ! for t_startf and t_stopf ! For using month-dependent values from forcing files - use clm_time_manager, only : get_curr_date, get_nstep, get_step_size + use clm_time_manager, only : get_curr_date, get_nstep, get_step_size, is_first_step_of_this_run_segment ! For namelist var use clm_varctl , only: mml_surdat @@ -611,6 +612,15 @@ subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst qbot = atm2lnd_inst%forc_q_not_downscaled_grc ! not downscaled atm specific humidity (kg/kg) +#ifdef NDEBUG + if ( is_first_step_of_this_run_segment() )then + write(iulog,*) 'fsds_dir ubounds = ', ubound(fsds_dir) + write(iulog,*) 'fsds_dir lbounds = ', lbound(fsds_dir) + write(iulog,*) 'forc_solad_grc ubounds = ', ubound(atm2lnd_inst%forc_solad_grc) + write(iulog,*) 'forc_solad_grc lbounds = ', lbound(atm2lnd_inst%forc_solad_grc) + call shr_sys_flush(iulog) + end if +#endif SHR_ASSERT(numrad == 2, errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((ubound(fsds_dir) == (/bounds%endg,numrad/)), errMsg(sourcefile, __LINE__)) SHR_ASSERT_ALL((lbound(fsds_dir) == (/bounds%begg,1/)), errMsg(sourcefile, __LINE__)) From ab435db828b5220da87cd420288b88df61405ada Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 16 Dec 2022 18:49:32 -0700 Subject: [PATCH 150/164] Correct so the writes only happen if DEBUG==TRUE --- src/main/mml_main.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/mml_main.F90 b/src/main/mml_main.F90 index c8c59caf..c09970ff 100644 --- a/src/main/mml_main.F90 +++ b/src/main/mml_main.F90 @@ -612,7 +612,8 @@ subroutine mml_main (bounds, atm2lnd_inst, lnd2atm_inst) !lnd2atm_inst qbot = atm2lnd_inst%forc_q_not_downscaled_grc ! not downscaled atm specific humidity (kg/kg) -#ifdef NDEBUG +#ifndef NDEBUG + ! Only execute this code if DEBUG=TRUE if ( is_first_step_of_this_run_segment() )then write(iulog,*) 'fsds_dir ubounds = ', ubound(fsds_dir) write(iulog,*) 'fsds_dir lbounds = ', lbound(fsds_dir) From baa4ef5c4b824b6dcd6a0882e3ae54c8dc879302 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Sat, 17 Dec 2022 12:44:18 -0700 Subject: [PATCH 151/164] Correct some of the expected fail testnames --- cime_config/testdefs/ExpectedTestFails.xml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index a735b94c..778e135b 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,67 +29,67 @@ - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#14 - + FAIL ESCOMP/SimpleLand#25? From 0d0fb80768ddd45c9f5e9aff1128fae8ce3eec7a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Mar 2023 00:11:49 -0600 Subject: [PATCH 152/164] Remove the namelist variables that have been removed by @slevisconsulting --- cime_config/namelist_definition_slim.xml | 73 ------------------------ 1 file changed, 73 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 31519e9a..929dc023 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -310,79 +310,6 @@ - - logical - datasets - clm_initinterp_inparm - .false. - - .false. - - - If FALSE (which is the default): If an output type cannot be found in the input for initInterp, - code aborts - If TRUE: If an output type cannot be found in the input, fill with closest natural veg column - (using bare soil for patch-level variables) - - NOTE: Natural vegetation and crop landunits always behave as if this were true. e.g., if - we can't find a column with the same type as a given crop column in the output, then we - always fill with the closest natural veg patch / column, regardless of the value of this - flag. So interpolation from non-crop to crop cases can be done without setting this flag. - - This should probably be removed. - - - - - - - - char - datasets - abs - clm_inparm - - UNSET - $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr1850_c170824.nc - $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_1.9x2.5_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - $DIN_LOC_ROOT/lnd/clm2/surfdata_map/surfdata_0.9x1.25_16pfts_Irrig_CMIP6_simyr2000_c170824.nc - - - Surface dataset from CLM - - - - - char - clm_leftover - clm_inparm - constant,prognostic,diagnostic - - constant - diagnostic - - - Type of CO2 feedback. - constant = use the input co2_ppmv value - prognostic = use the prognostic value sent from the atmosphere - diagnostic = use the diagnostic value sent from the atmosphere - - - - - real - clm_leftover - clm_inparm - - 999.9 - - - Atmospheric CO2 molar ratio (by volume) only used when co2_type==constant (umol/mol) - - - From 01dbc653047376138855e0477085038370e40709 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Mar 2023 10:15:31 -0600 Subject: [PATCH 153/164] Remove fsurdat that is no longer there, unit test now works --- cime_config/slim_cime_py/buildnml.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index cf86b7ff..9b099a1b 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -366,13 +366,6 @@ def check_nml_data(nmlgen, case): if finidat_dest is not None and not interp: raise SystemExit("finidat_interp_dest can NOT be set if use_init_interp is not on") - # ----------------------------------------------------------------------------------------- - # Requirements still in clm_inparm - # ----------------------------------------------------------------------------------------- - fsurdat = nmlgen.get_value("fsurdat") - if fsurdat == "UNSET": - raise SystemExit("fsurdat file is NOT set and is required") - # pylint: disable=too-many-arguments,too-many-locals,too-many-branches,too-many-statements # Turn off unused-argument for inst_string, since isn't in place right now From 2762750687d64ff088ca0e9d6afa8ab7ea2920a1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 17 Mar 2023 10:21:07 -0600 Subject: [PATCH 154/164] Set COMPSET and remove clm_* namelist groups no longer needed, systest now passes --- cime_config/slim_cime_py/buildnml.py | 3 --- python/slim/test/test_sys_buildnml.py | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/cime_config/slim_cime_py/buildnml.py b/cime_config/slim_cime_py/buildnml.py index 9b099a1b..d3bf36af 100644 --- a/cime_config/slim_cime_py/buildnml.py +++ b/cime_config/slim_cime_py/buildnml.py @@ -413,7 +413,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path # ---------------------------------------------------- logger.info("Write namelists") namelist_file = os.path.join(confdir, "lnd_in") - # Include clm_inparm until can be removed... nmlgen.write_output_file( namelist_file, data_list_path, @@ -423,8 +422,6 @@ def _create_namelists(case, confdir, inst_string, infile, nmlgen, data_list_path "slim_history", "slim_perf", "finidat_consistency_checks", - "clm_initinterp_inparm", - "clm_inparm", ], ) diff --git a/python/slim/test/test_sys_buildnml.py b/python/slim/test/test_sys_buildnml.py index a8945ce2..ea438743 100755 --- a/python/slim/test/test_sys_buildnml.py +++ b/python/slim/test/test_sys_buildnml.py @@ -72,6 +72,7 @@ def setUp(self): ) self.case = FakeCase(compiler=None, mpilib=None, debug=None) self.case.set_value("CASEROOT", self._testdir) + self.case.set_value("COMPSET", "2000_DATM%GSWP3v1_SLIM_SICE_SOCN_SROF_SGLC_SWAV") self.case.set_value("RUN_TYPE", "any") self.case.set_value("RUN_STARTDATE", "2000-01-01") self.case.set_value("RUN_REFCASE", "case.std") From 1b6e1d00702b45135be68b1f8a65b73bc6c17048 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Apr 2023 18:25:56 -0600 Subject: [PATCH 155/164] Make sure all user_nl_clm files are renameed to user_nl_slim --- .../slim/2000_CMIP6_AMIP_ensemble/{user_nl_clm => user_nl_slim} | 0 .../testmods_dirs/slim/Monthly/{user_nl_clm => user_nl_slim} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_ensemble/{user_nl_clm => user_nl_slim} (100%) rename cime_config/testdefs/testmods_dirs/slim/Monthly/{user_nl_clm => user_nl_slim} (100%) diff --git a/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_ensemble/user_nl_clm b/cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_ensemble/user_nl_slim similarity index 100% rename from cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_ensemble/user_nl_clm rename to cime_config/testdefs/testmods_dirs/slim/2000_CMIP6_AMIP_ensemble/user_nl_slim diff --git a/cime_config/testdefs/testmods_dirs/slim/Monthly/user_nl_clm b/cime_config/testdefs/testmods_dirs/slim/Monthly/user_nl_slim similarity index 100% rename from cime_config/testdefs/testmods_dirs/slim/Monthly/user_nl_clm rename to cime_config/testdefs/testmods_dirs/slim/Monthly/user_nl_slim From 63d414ba2365e5a3ea384dfc573fffe6b86e3b57 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Apr 2023 19:21:56 -0600 Subject: [PATCH 156/164] Fix the conflicts that got commited --- cime_config/buildnml | 420 ------------------ .../testmods_dirs/slim/g16_SOM/shell_commands | 15 - 2 files changed, 435 deletions(-) diff --git a/cime_config/buildnml b/cime_config/buildnml index f63fe177..a79cbcc3 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -12,430 +12,10 @@ from slim import add_cime_to_path from slim import add_slim_cime_py_to_path from slim.slim_logging import setup_logging -<<<<<<< HEAD from standard_script_setup import * from CIME.buildnml import parse_input from CIME.case import Case from slim_cime_py import buildnml -||||||| 0f5a42e -from standard_script_setup import * -from CIME.buildnml import create_namelist_infile, parse_input -from CIME.case import Case -from CIME.utils import expect, run_cmd - -logger = logging.getLogger(__name__) - -_config_cache_template = """ - - - -Specifies clm physics - -""" - -############################################################################### -def buildnml(case, caseroot, compname): -############################################################################### - """Build the clm namelist """ - - # Build the component namelist - if compname != "clm": - raise AttributeError - - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - din_loc_root = case.get_value("DIN_LOC_ROOT") - ccsm_co2_ppmv = case.get_value("CCSM_CO2_PPMV") - clm_co2_type = case.get_value("CLM_CO2_TYPE") - clm_namelist_opts = case.get_value("CLM_NAMELIST_OPTS") - clm_bldnml_opts = case.get_value("CLM_BLDNML_OPTS") - clm_nml_use_case = case.get_value("CLM_NML_USE_CASE") - clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART") - comp_glc = case.get_value("COMP_GLC") - comp_atm = case.get_value("COMP_ATM") - lnd_grid = case.get_value("LND_GRID") - lnd_ncpl = case.get_value("LND_NCPL") - lnd_domain_path = case.get_value("LND_DOMAIN_PATH") - lnd_domain_file = case.get_value("LND_DOMAIN_FILE") - ninst_lnd = case.get_value("NINST_LND") - rundir = case.get_value("RUNDIR") - run_type = case.get_value("RUN_TYPE") - run_startdate = case.get_value("RUN_STARTDATE") - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - mask = case.get_value("MASK_GRID") - - # ----------------------------------------------------- - # Clear out old data - # ----------------------------------------------------- - - input_data_list = os.path.join(caseroot,"Buildconf","clm.input_data_list") - if os.path.exists(input_data_list): - os.remove(input_data_list) - - # ----------------------------------------------------- - # Set clmconf - # ----------------------------------------------------- - - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) - - # ----------------------------------------------------- - # Create config_cache.xml file - # ----------------------------------------------------- - - # Note that build-namelist utilizes the contents of the config_cache.xml file in - # the namelist_defaults.xml file to obtain namelist variables - - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5 or clm5_0 physics") - - config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "clmconf", "config_cache.xml") - with open(config_cache_path, 'w') as config_cache_file: - config_cache_file.write(config_cache_text) - - # ----------------------------------------------------- - # Determine input arguments into build-namelist - # ----------------------------------------------------- - - startfile_type = "finidat" - start_type = "default" - if run_type == "hybrid": - start_type = "startup" - elif run_type != "startup": - start_type = run_type - - if run_type == "branch": - startfile_type = "nrevsn" - if clm_force_coldstart == "on": - clm_force_coldstart = "off" - logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" - ) - - if (clm_force_coldstart == "on"): - logger.warning( "WARNING: CLM is starting up from a cold state" ) - start_type = "cold" - - if lnd_grid == 'T31': - lnd_grid = '48x96' - if lnd_grid == 'T42': - lnd_grid = '64x128' - if lnd_grid == 'T85': - lnd_grid = '128x256' - if lnd_grid == 'T341': - lnd_grid = '512x1024' - - if clm_nml_use_case != "UNSET": - usecase = "-use_case %s" %clm_nml_use_case - else: - usecase = "" - - if ( (mask != "null") and (mask != "UNSET") ): - gridmask = "-mask %s" %mask - else: - gridmask = "" - - start_ymd = run_startdate.replace('-','') - - if ('-01-01' in run_startdate) or ('-09-01' in run_startdate): - ignore = "-ignore_ic_year" - else: - ignore = "-ignore_ic_date" - - infile = os.path.join(clmconf, "namelist") - - inputdata_file = os.path.join(caseroot,"Buildconf","clm.input_data_list") - - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - - config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml") - - # ----------------------------------------------------- - # loop over instances - # ----------------------------------------------------- - - ninst = int(ninst_lnd) - for inst_counter in range(1, ninst+1): - - # determine instance string - inst_string = "" - if ninst > 1: - inst_string = '_' + '%04d' % inst_counter - - # If multi-instance case does not have restart file, use - # single-case restart for each instance - rpointer = "rpointer.lnd" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) - - # ----------------------------------------------------- - # call build-namelist - # ----------------------------------------------------- - - if run_type == "hybrid" or run_type == "branch": - clm_startfile = "%s.clm2%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, clm_startfile)): - clm_startfile = "%s.clm2.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - clm_icfile = "%s = \'%s\'"%(startfile_type, clm_startfile) - else: - clm_icfile = "" - - infile_lines = [] - infile_lines.append(clm_icfile) - - user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) - namelist_infile = os.path.join(clmconf, "namelist") - - create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) - - cmd = os.path.join(lnd_root,"bld","build-namelist") - - command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s/ \" " - "%s %s -res %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " - "-lnd_frac %s -co2_ppmv %s -co2_type %s -config %s " - "%s %s" - %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, - usecase, lnd_grid, start_type, caseroot, lnd_ncpl, - lndfrac_file, ccsm_co2_ppmv, clm_co2_type, config_cache_file, - clm_bldnml_opts, gridmask)) - - rc, out, err = run_cmd(command, from_dir=clmconf) - expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - if out is not None: - logger.debug(" %s"%out) - if err is not None: - logger.debug(" %s"%err) - - # ----------------------------------------------------- - # copy resolved namelist to rundir - # ----------------------------------------------------- - - if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") - file2 = os.path.join(rundir, "lnd_in") - if ninst > 1: - file2 += inst_string - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) -======= -from standard_script_setup import * -from CIME.buildnml import create_namelist_infile, parse_input -from CIME.case import Case -from CIME.utils import expect, run_cmd - -logger = logging.getLogger(__name__) - -_config_cache_template = """ - - - -Specifies clm physics - -""" - -############################################################################### -def buildnml(case, caseroot, compname): -############################################################################### - """Build the clm namelist """ - - # Build the component namelist - if compname != "clm": - raise AttributeError - - lnd_root = case.get_value("COMP_ROOT_DIR_LND") - din_loc_root = case.get_value("DIN_LOC_ROOT") - clm_namelist_opts = case.get_value("CLM_NAMELIST_OPTS") - clm_bldnml_opts = case.get_value("CLM_BLDNML_OPTS") - clm_nml_use_case = case.get_value("CLM_NML_USE_CASE") - clm_force_coldstart = case.get_value("CLM_FORCE_COLDSTART") - comp_glc = case.get_value("COMP_GLC") - comp_atm = case.get_value("COMP_ATM") - lnd_grid = case.get_value("LND_GRID") - lnd_ncpl = case.get_value("LND_NCPL") - lnd_domain_path = case.get_value("LND_DOMAIN_PATH") - lnd_domain_file = case.get_value("LND_DOMAIN_FILE") - ninst_lnd = case.get_value("NINST_LND") - rundir = case.get_value("RUNDIR") - run_type = case.get_value("RUN_TYPE") - run_startdate = case.get_value("RUN_STARTDATE") - run_refcase = case.get_value("RUN_REFCASE") - run_refdate = case.get_value("RUN_REFDATE") - run_reftod = case.get_value("RUN_REFTOD") - mask = case.get_value("MASK_GRID") - - # ----------------------------------------------------- - # Clear out old data - # ----------------------------------------------------- - - input_data_list = os.path.join(caseroot,"Buildconf","clm.input_data_list") - if os.path.exists(input_data_list): - os.remove(input_data_list) - - # ----------------------------------------------------- - # Set clmconf - # ----------------------------------------------------- - - clmconf = os.path.join(caseroot, "Buildconf", "clmconf") - if not os.path.isdir(clmconf): - os.makedirs(clmconf) - - # ----------------------------------------------------- - # Create config_cache.xml file - # ----------------------------------------------------- - - # Note that build-namelist utilizes the contents of the config_cache.xml file in - # the namelist_defaults.xml file to obtain namelist variables - - clm_config_opts = case.get_value("CLM_CONFIG_OPTS") - if "clm4_5" in clm_config_opts: - clm_phys = "clm4_5" - elif "clm5_0" in clm_config_opts: - clm_phys = "clm5_0" - else: - expect(False, "CLM_CONFIG_OPTS must support either clm4_5 or clm5_0 physics") - - config_cache_text = _config_cache_template.format(clm_phys=clm_phys) - config_cache_path = os.path.join(caseroot, "Buildconf", "clmconf", "config_cache.xml") - with open(config_cache_path, 'w') as config_cache_file: - config_cache_file.write(config_cache_text) - - # ----------------------------------------------------- - # Determine input arguments into build-namelist - # ----------------------------------------------------- - - startfile_type = "finidat" - start_type = "default" - if run_type == "hybrid": - start_type = "startup" - elif run_type != "startup": - start_type = run_type - - if run_type == "branch": - startfile_type = "nrevsn" - if clm_force_coldstart == "on": - clm_force_coldstart = "off" - logger.warning( "WARNING: You've turned on CLM_FORCE_COLDSTART for a branch run_type, which is a contradiction, the coldstart will be ignored\n" + - " turn off CLM_FORCE_COLDSTART, or set RUN_TYPE=hybrid to get rid of this warning" - ) - - if (clm_force_coldstart == "on"): - logger.warning( "WARNING: CLM is starting up from a cold state" ) - start_type = "cold" - - if lnd_grid == 'T31': - lnd_grid = '48x96' - if lnd_grid == 'T42': - lnd_grid = '64x128' - if lnd_grid == 'T85': - lnd_grid = '128x256' - if lnd_grid == 'T341': - lnd_grid = '512x1024' - - if clm_nml_use_case != "UNSET": - usecase = "-use_case %s" %clm_nml_use_case - else: - usecase = "" - - if ( (mask != "null") and (mask != "UNSET") ): - gridmask = "-mask %s" %mask - else: - gridmask = "" - - start_ymd = run_startdate.replace('-','') - - if ('-01-01' in run_startdate) or ('-09-01' in run_startdate): - ignore = "-ignore_ic_year" - else: - ignore = "-ignore_ic_date" - - infile = os.path.join(clmconf, "namelist") - - inputdata_file = os.path.join(caseroot,"Buildconf","clm.input_data_list") - - lndfrac_file = os.path.join(lnd_domain_path,lnd_domain_file) - - config_cache_file = os.path.join(caseroot,"Buildconf","clmconf","config_cache.xml") - - # ----------------------------------------------------- - # loop over instances - # ----------------------------------------------------- - - ninst = int(ninst_lnd) - for inst_counter in range(1, ninst+1): - - # determine instance string - inst_string = "" - if ninst > 1: - inst_string = '_' + '%04d' % inst_counter - - # If multi-instance case does not have restart file, use - # single-case restart for each instance - rpointer = "rpointer.lnd" - if (os.path.isfile(os.path.join(rundir,rpointer)) and - (not os.path.isfile(os.path.join(rundir,rpointer + inst_string)))): - shutil.copy(os.path.join(rundir, rpointer), - os.path.join(rundir, rpointer + inst_string)) - - # ----------------------------------------------------- - # call build-namelist - # ----------------------------------------------------- - - if run_type == "hybrid" or run_type == "branch": - clm_startfile = "%s.clm2%s.r.%s-%s.nc"%(run_refcase,inst_string,run_refdate,run_reftod) - if not os.path.exists(os.path.join(rundir, clm_startfile)): - clm_startfile = "%s.clm2.r.%s-%s.nc"%(run_refcase,run_refdate,run_reftod) - clm_icfile = "%s = \'%s\'"%(startfile_type, clm_startfile) - else: - clm_icfile = "" - - infile_lines = [] - infile_lines.append(clm_icfile) - - user_nl_file = os.path.join(caseroot, "user_nl_clm" + inst_string) - namelist_infile = os.path.join(clmconf, "namelist") - - create_namelist_infile(case, user_nl_file, namelist_infile, "\n".join(infile_lines)) - - cmd = os.path.join(lnd_root,"bld","build-namelist") - - command = ("%s -cimeroot %s -infile %s -csmdata %s -inputdata %s %s -namelist \"&clm_inparm start_ymd=%s/ \" " - "%s %s -res %s -clm_start_type %s -envxml_dir %s -l_ncpl %s " - "-lnd_frac %s -config %s " - "%s %s" - %(cmd, _CIMEROOT, infile, din_loc_root, inputdata_file, ignore, start_ymd, clm_namelist_opts, - usecase, lnd_grid, start_type, caseroot, lnd_ncpl, - lndfrac_file, config_cache_file, - clm_bldnml_opts, gridmask)) - - rc, out, err = run_cmd(command, from_dir=clmconf) - expect(rc==0,"Command %s failed rc=%d\nout=%s\nerr=%s"%(cmd,rc,out,err)) - if out is not None: - logger.debug(" %s"%out) - if err is not None: - logger.debug(" %s"%err) - - # ----------------------------------------------------- - # copy resolved namelist to rundir - # ----------------------------------------------------- - - if os.path.isdir(rundir): - file1 = os.path.join(clmconf, "lnd_in") - file2 = os.path.join(rundir, "lnd_in") - if ninst > 1: - file2 += inst_string - logger.debug("CLM namelist copy: file1 %s file2 %s " %(file1, file2)) - shutil.copy(file1,file2) ->>>>>>> escomp/cesm2_1_slim ############################################################################### def _main_func(): diff --git a/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands index 5ef181ad..1638132d 100755 --- a/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands +++ b/cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands @@ -1,18 +1,3 @@ -<<<<<<< HEAD #!/bin/bash CIMEROOT=`./xmlquery --value -s CIMEROOT` cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/slim/g16_SOM/user_docn* . -||||||| 3ec536a -======= -#!/bin/bash -CIMEROOT=`./xmlquery --value -s CIMEROOT` -<<<<<<<< HEAD:cime_config/testdefs/testmods_dirs/slim/g16_SOM/shell_commands -cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/slim/g16_SOM/user_docn* . -./xmlchange CLM_CO2_TYPE="diagnostic" -|||||||| 3ec536a:cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands -cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn* . -./xmlchange CLM_CO2_TYPE="diagnostic" -======== -cp $CIMEROOT/../cime_config/testdefs/testmods_dirs/clm/g16_SOM/user_docn* . ->>>>>>>> escomp/cesm2_1_slim:cime_config/testdefs/testmods_dirs/clm/g16_SOM/shell_commands ->>>>>>> escomp/cesm2_1_slim From 864bfdd2dc0a33bb34480c553b3690af08264863 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Apr 2023 19:24:14 -0600 Subject: [PATCH 157/164] Run build scripts through black --- cime_config/buildlib | 56 ++++++++++++++++++++++++++------------------ cime_config/buildnml | 6 +++-- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/cime_config/buildlib b/cime_config/buildlib index d25deb98..598f5dc8 100755 --- a/cime_config/buildlib +++ b/cime_config/buildlib @@ -21,7 +21,7 @@ logger = logging.getLogger(__name__) ############################################################################### def _main_func(): -############################################################################### + ############################################################################### caseroot, libroot, bldroot = parse_input(sys.argv) @@ -34,46 +34,56 @@ def _main_func(): mach = case.get_value("MACH") nthrds = case.get_value("LND_NTHRDS") - if ( nthrds > 1 ): - expect(False, "LND_NTHRDS must be 1 as threading isn't implemented (see issue #14)" ) + if nthrds > 1: + expect( + False, + "LND_NTHRDS must be 1 as threading isn't implemented (see issue #14)", + ) - #------------------------------------------------------- + # ------------------------------------------------------- # create Filepath file - #------------------------------------------------------- - filepath_file = os.path.join(bldroot,"Filepath") + # ------------------------------------------------------- + filepath_file = os.path.join(bldroot, "Filepath") if not os.path.isfile(filepath_file): caseroot = case.get_value("CASEROOT") - paths = [os.path.join(caseroot,"SourceMods","src.slim"), - os.path.join(lnd_root,"src","main"), - os.path.join(lnd_root,"src","init_interp"), - os.path.join(lnd_root,"src","utils"), - os.path.join(lnd_root,"src","cpl")] + paths = [ + os.path.join(caseroot, "SourceMods", "src.slim"), + os.path.join(lnd_root, "src", "main"), + os.path.join(lnd_root, "src", "init_interp"), + os.path.join(lnd_root, "src", "utils"), + os.path.join(lnd_root, "src", "cpl"), + ] # Paths needed to build the current system, but won't be long term - paths.append( os.path.join(lnd_root,"src","biogeophys") ) - paths.append( os.path.join(lnd_root,"src","biogeochem") ) - paths.append( os.path.join(lnd_root,"src","soilbiogeochem") ) + paths.append(os.path.join(lnd_root, "src", "biogeophys")) + paths.append(os.path.join(lnd_root, "src", "biogeochem")) + paths.append(os.path.join(lnd_root, "src", "soilbiogeochem")) with open(filepath_file, "w") as filepath: filepath.write("\n".join(paths)) filepath.write("\n") - - #------------------------------------------------------- + + # ------------------------------------------------------- # create the library in libroot - #------------------------------------------------------- + # ------------------------------------------------------- - complib = os.path.join(libroot,"liblnd.a") + complib = os.path.join(libroot, "liblnd.a") makefile = os.path.join(casetools, "Makefile") - macfile = os.path.join(caseroot, "Macros.%s" % mach) + macfile = os.path.join(caseroot, "Macros.%s" % mach) - cmd = "%s complib -j %d MODEL=slim COMPLIB=%s -f %s MACFILE=%s " \ - % (gmake, gmake_j, complib, makefile, macfile ) + cmd = "%s complib -j %d MODEL=slim COMPLIB=%s -f %s MACFILE=%s " % ( + gmake, + gmake_j, + complib, + makefile, + macfile, + ) rc, out, err = run_cmd(cmd) - logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n"%(cmd,out,err)) + logger.info("%s: \n\n output:\n %s \n\n err:\n\n%s\n" % (cmd, out, err)) expect(rc == 0, "Command %s failed with rc=%s" % (cmd, rc)) + ############################################################################### if __name__ == "__main__": _main_func() - diff --git a/cime_config/buildnml b/cime_config/buildnml index a79cbcc3..9c2a0c3f 100755 --- a/cime_config/buildnml +++ b/cime_config/buildnml @@ -5,7 +5,9 @@ SLIM namelist creator executable """ import sys, os -_SLIM_PYTHON = os.path.normpath( os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, 'python') ) +_SLIM_PYTHON = os.path.normpath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, "python") +) sys.path.insert(1, _SLIM_PYTHON) from slim import add_cime_to_path @@ -22,7 +24,7 @@ def _main_func(): caseroot = parse_input(sys.argv) level = logging.WARNING - setup_logging( level ) + setup_logging(level) with Case(caseroot) as case: buildnml(case, caseroot, "slim") From 86cb09d18a2b32c2cc115934bb20749f36f10cb4 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Apr 2023 23:18:45 -0600 Subject: [PATCH 158/164] Remove nlevsno and override_nsrest namelist items as now gone --- src/main/controlMod.F90 | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/main/controlMod.F90 b/src/main/controlMod.F90 index ca46642b..a05ac5e5 100644 --- a/src/main/controlMod.F90 +++ b/src/main/controlMod.F90 @@ -96,7 +96,6 @@ subroutine control_init( ) integer :: ierr ! error code integer :: unitn ! unit for namelist file integer :: dtime ! Integer time-step - integer :: override_nsrest ! If want to override the startup type sent from driver !------------------------------------------------------------------------ ! ---------------------------------------------------------------------- @@ -110,8 +109,7 @@ subroutine control_init( ) ! Other options namelist /clm_inparm/ & - clump_pproc, wrtdia, & - override_nsrest + clump_pproc, wrtdia ! All old cpp-ifdefs are below and have been converted to namelist variables @@ -141,9 +139,6 @@ subroutine control_init( ) #else clump_pproc = 1 #endif - nlevsno = 5 - - override_nsrest = nsrest if (masterproc) then @@ -178,17 +173,6 @@ subroutine control_init( ) call endrun(msg='ERROR SLIM can NOT run with single_column on'//errMsg(sourcefile, __LINE__)) end if - ! Override start-type (can only override to branch (3) and only - ! if the driver is a startup type - if ( override_nsrest /= nsrest )then - if ( override_nsrest /= nsrBranch .and. nsrest /= nsrStartup )then - call endrun(msg= ' ERROR: can ONLY override clm start-type ' // & - 'to branch type and ONLY if driver is a startup type'// & - errMsg(sourcefile, __LINE__)) - end if - call clm_varctl_set( nsrest_in=override_nsrest ) - end if - endif ! end of if-masterproc if-block ! ---------------------------------------------------------------------- From aaea467e9658bee5c2ae902c4e4262d4c02c8dc0 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Wed, 12 Apr 2023 23:23:43 -0600 Subject: [PATCH 159/164] Remove old CLM XML variables --- .../testdefs/testmods_dirs/slim/default/shell_commands | 4 +--- .../testmods_dirs/slim/global_uniform_g16_SOM/shell_commands | 2 -- .../shell_commands | 2 -- .../testdefs/testmods_dirs/slim/save_cplhist/shell_commands | 2 -- 4 files changed, 1 insertion(+), 9 deletions(-) delete mode 100755 cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands delete mode 100755 cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands delete mode 100755 cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands diff --git a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands index b212e325..f3a1a014 100755 --- a/cime_config/testdefs/testmods_dirs/slim/default/shell_commands +++ b/cime_config/testdefs/testmods_dirs/slim/default/shell_commands @@ -1,4 +1,2 @@ #!/bin/bash -./xmlchange CLM_FORCE_COLDSTART="on" -./xmlchange CLM_CO2_TYPE="constant" -./xmlchange CCSM_CO2_PPMV="999.99" +./xmlchange SLIM_START_TYPE="cold" diff --git a/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands b/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/global_uniform_g16_SOM/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" diff --git a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850_g16_SOM_save_cplhist/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" diff --git a/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands b/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands deleted file mode 100755 index 626ff59f..00000000 --- a/cime_config/testdefs/testmods_dirs/slim/save_cplhist/shell_commands +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./xmlchange CLM_CO2_TYPE="diagnostic" From 1a8d13f05a31a6b628633de25c427aa90ee49666 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 13 Apr 2023 20:41:55 -0600 Subject: [PATCH 160/164] Just have check_finidat_year_consistency in the finidat check namelist --- cime_config/namelist_definition_slim.xml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index 929dc023..f5976d62 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -292,21 +292,19 @@ - + logical datasets finidat_consistency_checks - .true. - - .true. - + .false. + + .false. + - If TRUE (which is the default), check consistency between pct_pft on the finidat file - and pct_pft read from the surface dataset. + If TRUE, check consistency between year on the finidat file + and the current model year. This check is only done for a transient run. This requires that finidat be non-blank. - - This should probably be removed. From 0b77533ef9d4072c6edd3791451967fd6d4f7cc1 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Thu, 13 Apr 2023 20:42:32 -0600 Subject: [PATCH 161/164] Switch out instances of clm2 for slim which is important for archiving of slim files --- src/cpl/lnd_comp_mct.F90 | 4 ++-- src/main/histFileMod.F90 | 8 ++++---- src/main/restFileMod.F90 | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/cpl/lnd_comp_mct.F90 b/src/cpl/lnd_comp_mct.F90 index 577d0f27..929651ec 100644 --- a/src/cpl/lnd_comp_mct.F90 +++ b/src/cpl/lnd_comp_mct.F90 @@ -459,9 +459,9 @@ subroutine lnd_run_mct(EClock, cdata_l, x2l_l, l2x_l) ! Advance clm time step !write(*,*)'MML advance clm timestep' - call t_startf ('lc_clm2_adv_timestep') + call t_startf ('lc_slim_adv_timestep') call advance_timestep() - call t_stopf ('lc_clm2_adv_timestep') + call t_stopf ('lc_slim_adv_timestep') end do diff --git a/src/main/histFileMod.F90 b/src/main/histFileMod.F90 index 78055ff2..bb85d4df 100644 --- a/src/main/histFileMod.F90 +++ b/src/main/histFileMod.F90 @@ -401,7 +401,7 @@ subroutine hist_htapes_build () !----------------------------------------------------------------------- if (masterproc) then - write(iulog,*) trim(subname),' Initializing clm2 history files' + write(iulog,*) trim(subname),' Initializing slim history files' write(iulog,'(72a1)') ("-",i=1,60) call shr_sys_flush(iulog) endif @@ -448,7 +448,7 @@ subroutine hist_htapes_build () end do if (masterproc) then - write(iulog,*) trim(subname),' Successfully initialized clm2 history files' + write(iulog,*) trim(subname),' Successfully initialized slim history files' write(iulog,'(72a1)') ("-",i=1,60) call shr_sys_flush(iulog) endif @@ -2461,7 +2461,7 @@ subroutine hist_restart_ncd (bounds, ncid, flag, rdate) ! Create the restart history filename and open it write(hnum,'(i1.1)') t-1 - locfnhr(t) = "./" // trim(caseid) //".clm2"// trim(inst_suffix) & + locfnhr(t) = "./" // trim(caseid) //".slim"// trim(inst_suffix) & // ".rh" // hnum //"."// trim(rdate) //".nc" call htape_create( t, histrest=.true. ) @@ -3139,7 +3139,7 @@ character(len=max_length_filename) function set_hist_filename (hist_freq, hist_m write(cdate,'(i4.4,"-",i2.2,"-",i2.2,"-",i5.5)') yr,mon,day,sec endif write(hist_index,'(i1.1)') hist_file - 1 - set_hist_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& + set_hist_filename = "./"//trim(caseid)//".slim"//trim(inst_suffix)//& ".h"//hist_index//"."//trim(cdate)//".nc" ! check to see if the concatenated filename exceeded the diff --git a/src/main/restFileMod.F90 b/src/main/restFileMod.F90 index 768afe59..531686d2 100644 --- a/src/main/restFileMod.F90 +++ b/src/main/restFileMod.F90 @@ -231,8 +231,8 @@ subroutine restFile_getfile( file, path ) end if call getfil( path, file, 0 ) - ! tcraig, adding xx. and .clm2 makes this more robust - ctest = 'xx.'//trim(caseid)//'.clm2' + ! tcraig, adding xx. and .slim makes this more robust + ctest = 'xx.'//trim(caseid)//'.slim' ftest = 'xx.'//trim(file) status = index(trim(ftest),trim(ctest)) if (status /= 0 .and. .not.(brnch_retain_casename)) then @@ -409,7 +409,7 @@ character(len=256) function restFile_filename( rdate ) character(len=*), intent(in) :: rdate ! input date for restart file name !----------------------------------------------------------------------- - restFile_filename = "./"//trim(caseid)//".clm2"//trim(inst_suffix)//& + restFile_filename = "./"//trim(caseid)//".slim"//trim(inst_suffix)//& ".r."//trim(rdate)//".nc" if (masterproc) then write(iulog,*)'writing restart file ',trim(restFile_filename),' for model date = ',rdate From 5fe6c108c5c80cb71d8b087e77d6055e8d8a8a32 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Apr 2023 00:20:00 -0600 Subject: [PATCH 162/164] Update mml_surdat dataset for f09 --- cime_config/namelist_definition_slim.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index f5976d62..bb1d1a36 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -21,7 +21,7 @@ $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc - $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_f19_20190110_reverse_cutout_to_f09_c20230224.nc Surface dataset describing surface properties at each gridcell From 84a56f692a10b65e73293c35c7e8821c30cda10a Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Apr 2023 10:41:49 -0600 Subject: [PATCH 163/164] Remove the user-mod directories and put it all in the namelist_definition --- cime_config/namelist_definition_slim.xml | 10 ++++++---- .../slim/global_uniform/include_user_mods | 1 - .../testmods_dirs/slim/global_uniform/shell_commands | 2 ++ .../slim/realistic_fromCLM5_1850/include_user_mods | 1 - cime_config/usermods_dirs/global_uniform/user_nl_slim | 1 - .../usermods_dirs/realistic_fromCLM5_1850/user_nl_slim | 1 - .../usermods_dirs/realistic_fromCLM5_2000/user_nl_slim | 1 - 7 files changed, 8 insertions(+), 9 deletions(-) create mode 100755 cime_config/testdefs/testmods_dirs/slim/global_uniform/shell_commands delete mode 100644 cime_config/usermods_dirs/global_uniform/user_nl_slim delete mode 100644 cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim delete mode 100644 cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim diff --git a/cime_config/namelist_definition_slim.xml b/cime_config/namelist_definition_slim.xml index bb1d1a36..99ed1089 100644 --- a/cime_config/namelist_definition_slim.xml +++ b/cime_config/namelist_definition_slim.xml @@ -17,11 +17,13 @@ slim_data_and_initial UNSET - UNSET - $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc - $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc - $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc + UNSET + $DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_f19_20190110_reverse_cutout_to_f09_c20230224.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_f19_20190110_cutout_to_f45_c20230131.nc + $DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_f19_20190110_cutout_to_f10_c20230131.nc Surface dataset describing surface properties at each gridcell diff --git a/cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods index d243c2a4..fe0e18cf 100644 --- a/cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/slim/global_uniform/include_user_mods @@ -1,2 +1 @@ ../default -../../../../usermods_dirs/global_uniform diff --git a/cime_config/testdefs/testmods_dirs/slim/global_uniform/shell_commands b/cime_config/testdefs/testmods_dirs/slim/global_uniform/shell_commands new file mode 100755 index 00000000..9c10e11c --- /dev/null +++ b/cime_config/testdefs/testmods_dirs/slim/global_uniform/shell_commands @@ -0,0 +1,2 @@ +#!/bin/bash +./xmlchange SLIM_SCENARIO="global_uniform" diff --git a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods index ad975dc0..fe0e18cf 100644 --- a/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods +++ b/cime_config/testdefs/testmods_dirs/slim/realistic_fromCLM5_1850/include_user_mods @@ -1,2 +1 @@ ../default -../../../../usermods_dirs/realistic_fromCLM5_1850 diff --git a/cime_config/usermods_dirs/global_uniform/user_nl_slim b/cime_config/usermods_dirs/global_uniform/user_nl_slim deleted file mode 100644 index f84c9987..00000000 --- a/cime_config/usermods_dirs/global_uniform/user_nl_slim +++ /dev/null @@ -1 +0,0 @@ -mml_surdat = '$DIN_LOC_ROOT/lnd/slim/surdat/globalconst_alpha0.2_soilcv2e6_hc0.1_rs100.0_glc_hc0.01_f19_cdf5_20211105.nc' diff --git a/cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim b/cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim deleted file mode 100644 index f7953f1f..00000000 --- a/cime_config/usermods_dirs/realistic_fromCLM5_1850/user_nl_slim +++ /dev/null @@ -1 +0,0 @@ -mml_surdat = '$DIN_LOC_ROOT/lnd/slim/surdat/slim_realistic_fromCLM5_alb1850_hc1850_rs1850_f19_20190110.nc' diff --git a/cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim b/cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim deleted file mode 100644 index 171aa345..00000000 --- a/cime_config/usermods_dirs/realistic_fromCLM5_2000/user_nl_slim +++ /dev/null @@ -1 +0,0 @@ -mml_surdat = '$DIN_LOC_ROOT/lnd/slim/surdat/slim2deg_fromCMIP6-AMIP-1deg_ensemble001-010_1991to2010clim_max-ctrl-bucket_rs150_c20210401.nc' From 159ecad343b82f5136dd86fdb45f1de7cf99cee8 Mon Sep 17 00:00:00 2001 From: Erik Kluzek Date: Fri, 14 Apr 2023 15:26:37 -0600 Subject: [PATCH 164/164] Add two fail tests to expected fail, that will fix in the next tag --- cime_config/testdefs/ExpectedTestFails.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cime_config/testdefs/ExpectedTestFails.xml b/cime_config/testdefs/ExpectedTestFails.xml index 23804416..2d940c46 100644 --- a/cime_config/testdefs/ExpectedTestFails.xml +++ b/cime_config/testdefs/ExpectedTestFails.xml @@ -29,6 +29,16 @@ + + + FAIL + + + + + FAIL + + FAIL