From de497e21c3c9fa293e42458d60a1de980b2efbe2 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 11:33:36 -0600 Subject: [PATCH 1/4] Add call in case_setup to run cam python script This update is based on existing code for cism but uses a python script rather than a shell script. The update is needed for use with GEOS-Chem chemistry so that run-time configuration files can be copied to the case directory upon case setup. Signed-off-by: Lizzie Lundgren --- CIME/case/case_setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CIME/case/case_setup.py b/CIME/case/case_setup.py index 363e8f4fab4..ce10057cb64 100644 --- a/CIME/case/case_setup.py +++ b/CIME/case/case_setup.py @@ -404,6 +404,13 @@ def _case_setup_impl( run_cmd_no_fail( "{}/cime_config/cism.template {}".format(glcroot, caseroot) ) + if comp == "cam": + camroot = case.get_value("COMP_ROOT_DIR_ATM") + camoptions = case.get_value("CAM_CONFIG_OPTS") + logger.debug("Running cam.case_setup.py") + run_cmd_no_fail( + "python {}/cime_config/cam.case_setup.py {} {} \"{}\"".format(camroot, caseroot, camroot, camoptions) + ) _build_usernl_files(case, "drv", "cpl") From c452e8aeaff71cc3d9c08165b3c2c3f00a99fac7 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 13 Oct 2023 14:54:51 -0600 Subject: [PATCH 2/4] Use named string arguments when calling cam case setup script This avoids a duplicate string formatting warning when using a linter. Signed-off-by: Lizzie Lundgren --- CIME/case/case_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CIME/case/case_setup.py b/CIME/case/case_setup.py index ce10057cb64..0c1f59a9f26 100644 --- a/CIME/case/case_setup.py +++ b/CIME/case/case_setup.py @@ -409,7 +409,7 @@ def _case_setup_impl( camoptions = case.get_value("CAM_CONFIG_OPTS") logger.debug("Running cam.case_setup.py") run_cmd_no_fail( - "python {}/cime_config/cam.case_setup.py {} {} \"{}\"".format(camroot, caseroot, camroot, camoptions) + "python {cam}/cime_config/cam.case_setup.py {case} {cam} \"{opt}\"".format(cam=camroot, case=caseroot, opt=camoptions) ) _build_usernl_files(case, "drv", "cpl") From 603b5302847edc2ecd810ce7c6f4e7142c6736c6 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Tue, 31 Oct 2023 09:50:09 -0600 Subject: [PATCH 3/4] Change cam.case_setup.py arguments to accompany changes in script in CAM Signed-off-by: Lizzie Lundgren --- CIME/case/case_setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CIME/case/case_setup.py b/CIME/case/case_setup.py index 0c1f59a9f26..d541ff6a5ea 100644 --- a/CIME/case/case_setup.py +++ b/CIME/case/case_setup.py @@ -409,7 +409,7 @@ def _case_setup_impl( camoptions = case.get_value("CAM_CONFIG_OPTS") logger.debug("Running cam.case_setup.py") run_cmd_no_fail( - "python {cam}/cime_config/cam.case_setup.py {case} {cam} \"{opt}\"".format(cam=camroot, case=caseroot, opt=camoptions) + "python {cam}/cime_config/cam.case_setup.py {cam} {case}".format(cam=camroot, case=caseroot) ) _build_usernl_files(case, "drv", "cpl") From 627a3bcea27486aa1c8c83d6188419fbc56c7768 Mon Sep 17 00:00:00 2001 From: Lizzie Lundgren Date: Fri, 3 Nov 2023 08:50:45 -0600 Subject: [PATCH 4/4] Changes applied by linter (black) Signed-off-by: Lizzie Lundgren --- CIME/case/case_setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CIME/case/case_setup.py b/CIME/case/case_setup.py index d541ff6a5ea..56cf275ab26 100644 --- a/CIME/case/case_setup.py +++ b/CIME/case/case_setup.py @@ -28,6 +28,7 @@ logger = logging.getLogger(__name__) + ############################################################################### def _build_usernl_files(case, model, comp): ############################################################################### @@ -406,10 +407,11 @@ def _case_setup_impl( ) if comp == "cam": camroot = case.get_value("COMP_ROOT_DIR_ATM") - camoptions = case.get_value("CAM_CONFIG_OPTS") logger.debug("Running cam.case_setup.py") run_cmd_no_fail( - "python {cam}/cime_config/cam.case_setup.py {cam} {case}".format(cam=camroot, case=caseroot) + "python {cam}/cime_config/cam.case_setup.py {cam} {case}".format( + cam=camroot, case=caseroot + ) ) _build_usernl_files(case, "drv", "cpl")