Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run_tower fixes and improvements #2963

Merged
merged 17 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ bd535c710db78420b8e8b9d71d88d8339e899c59
4b20bbd7003e6f77dab4e3268cc4a43f9b5a3b5d
cf433215b58ba8776ec5edfb0b0d80c0836ed3a0
16d57ff37859b34dab005693e3085d64e2bcd95a
e8fc526e0d7818d45f171488c78392c4ff63902a
16 changes: 15 additions & 1 deletion python/ctsm/site_and_regional/neon_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,15 @@ def build_base_case(
self.cesmroot, "cime_config", "usermods_dirs", "clm", "NEON", self.name
)
]
case_path = super().build_base_case(cesmroot, output_root, res, compset, user_mods_dirs)
case_path = super().build_base_case(
cesmroot,
output_root,
res,
compset,
user_mods_dirs,
overwrite=overwrite,
setup_only=setup_only,
)

return case_path

Expand All @@ -68,6 +76,8 @@ def run_case(
no_batch=False,
rerun=False,
experiment=False,
no_input_data_check=False,
xmlchange=None,
):
"""
Run case.
Expand All @@ -92,6 +102,8 @@ def run_case(
default False
experiment: str, opt
name of experiment, default False
no_input_data_check: bool, opt
default False
"""
user_mods_dirs = [
os.path.join(self.cesmroot, "cime_config", "usermods_dirs", "clm", "NEON", self.name)
Expand All @@ -110,6 +122,8 @@ def run_case(
no_batch,
rerun,
experiment,
no_input_data_check,
xmlchange,
)

def modify_user_nl(self, case_root, run_type, rundir, site_lines=None):
Expand Down
14 changes: 13 additions & 1 deletion python/ctsm/site_and_regional/plumber_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,15 @@ def build_base_case(
self.cesmroot, "cime_config", "usermods_dirs", "clm", "PLUMBER2", self.name
)
]
case_path = super().build_base_case(cesmroot, output_root, res, compset, user_mods_dirs)
case_path = super().build_base_case(
cesmroot,
output_root,
res,
compset,
user_mods_dirs,
overwrite=overwrite,
setup_only=setup_only,
)

return case_path

Expand All @@ -67,6 +75,8 @@ def run_case(
no_batch=False,
rerun=False,
experiment=False,
no_input_data_check=False,
xmlchange=None,
):
"""
Run case.
Expand Down Expand Up @@ -113,6 +123,8 @@ def run_case(
no_batch,
rerun,
experiment,
no_input_data_check,
xmlchange,
)

def set_ref_case(self, case):
Expand Down
6 changes: 6 additions & 0 deletions python/ctsm/site_and_regional/run_tower.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ def main(description):
setup_only,
no_batch,
rerun,
no_input_data_check,
user_version,
xmlchange,
) = get_parser(sys.argv, description, valid_neon_sites, valid_plumber_sites)

if output_root:
Expand Down Expand Up @@ -278,6 +280,8 @@ def main(description):
no_batch=no_batch,
rerun=rerun,
experiment=experiment,
no_input_data_check=no_input_data_check,
xmlchange=xmlchange,
)

# -- check for available plumber data:
Expand Down Expand Up @@ -306,4 +310,6 @@ def main(description):
no_batch=no_batch,
rerun=rerun,
experiment=experiment,
no_input_data_check=no_input_data_check,
xmlchange=xmlchange,
)
30 changes: 30 additions & 0 deletions python/ctsm/site_and_regional/tower_arg_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ def get_parser(args, description, valid_neon_sites, valid_plumber_sites):
default=False,
)

parser.add_argument(
"--no-input-data-check",
"--no-check-input-data",
help="""
Don't check for input data. Implies --setup-only.
[default: %(default)s]
""",
action="store_true",
dest="no_input_data_check",
required=False,
default=False,
)

parser.add_argument(
"--rerun",
help="""
Expand Down Expand Up @@ -185,6 +198,17 @@ def get_parser(args, description, valid_neon_sites, valid_plumber_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 args.neon_sites:
Expand Down Expand Up @@ -230,6 +254,10 @@ def get_parser(args, description, valid_neon_sites, valid_plumber_sites):
root_logger = logging.getLogger()
root_logger.setLevel(logging.WARN)

# --no-input-data-check implies --setup-only
if args.no_input_data_check and not args.setup_only:
args.setup_only = True

return (
neon_sites,
plumber_sites,
Expand All @@ -243,5 +271,7 @@ def get_parser(args, description, valid_neon_sites, valid_plumber_sites):
args.setup_only,
args.no_batch,
args.rerun,
args.no_input_data_check,
args.user_version,
args.xmlchange,
)
13 changes: 12 additions & 1 deletion python/ctsm/site_and_regional/tower_site.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def build_base_case(
abort("Input output_root directory does NOT exist: " + str(output_root))

case_path = os.path.join(output_root, self.name)
print(case_path)

logger.info("base_case_name : %s", self.name)
logger.info("user_mods_dir : %s", user_mods_dirs[0])
Expand Down Expand Up @@ -296,6 +297,8 @@ def run_case(
no_batch,
rerun,
experiment,
no_input_data_check,
xmlchange,
):
"""
Run case.
Expand Down Expand Up @@ -445,11 +448,19 @@ 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()

# explicitly run check_input_data
case.check_all_input_data()
if not no_input_data_check:
case.check_all_input_data()
if not setup_only:
case.submit(no_batch=no_batch)
print("-----------------------------------")
Expand Down
Loading