Skip to content

Commit

Permalink
run_neon: Add --xmlchange option.
Browse files Browse the repository at this point in the history
  • Loading branch information
samsrabin committed Nov 18, 2024
1 parent 1caa2c9 commit 3e63547
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions python/ctsm/site_and_regional/neon_arg_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@ def get_parser(args, description, valid_neon_sites):
choices=["v1", "v2", "v3"],
)

parser.add_argument(
"--xmlchange",
help="""
Any xmlchanges (e.g., CLM_CO2_TYPE=constant,CCSM_CO2_PPMV=500)
[default: %(default)s]
""",
required=False,
type=str,
default=None,
)

args = parse_args_and_handle_standard_logging_options(args, parser)

if "all" in args.neon_sites:
Expand Down Expand Up @@ -254,4 +265,5 @@ def get_parser(args, description, valid_neon_sites):
args.rerun,
args.no_input_data_check,
args.user_version,
args.xmlchange,
)
2 changes: 2 additions & 0 deletions python/ctsm/site_and_regional/neon_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def run_case(
rerun=False,
experiment=False,
no_input_data_check=False,
xmlchange=None,
):
"""
Run case.
Expand Down Expand Up @@ -116,6 +117,7 @@ def run_case(
rerun,
experiment,
no_input_data_check,
xmlchange,
)

def modify_user_nl(self, case_root, run_type, rundir, site_lines=None):
Expand Down
2 changes: 2 additions & 0 deletions python/ctsm/site_and_regional/run_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ def main(description):
rerun,
no_input_data_check,
user_version,
xmlchange,
) = get_parser(sys.argv, description, valid_neon_sites)

if output_root:
Expand Down Expand Up @@ -242,4 +243,5 @@ def main(description):
rerun=rerun,
experiment=experiment,
no_input_data_check=no_input_data_check,
xmlchange=xmlchange,
)
7 changes: 7 additions & 0 deletions python/ctsm/site_and_regional/tower_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ def run_case(
rerun,
experiment,
no_input_data_check,
xmlchange,
):
"""
Run case.
Expand Down Expand Up @@ -411,6 +412,12 @@ def run_case(
if not rundir:
rundir = case.get_value("RUNDIR")

if xmlchange:
xmlchange_list = xmlchange.split(",")
for setting in xmlchange_list:
setting_split = setting.split("=")
case.set_value(*setting_split)

self.modify_user_nl(case_root, run_type, rundir)

case.create_namelists()
Expand Down

0 comments on commit 3e63547

Please sign in to comment.