Skip to content

Commit

Permalink
Fix some bugs in generating CUPiD config
Browse files Browse the repository at this point in the history
1. adf_root should be a subdirectory of case_root
2. All components should use end_year and base_end_year for time series, not
just atm
3. Look to see if specific notebooks are in template config file before
changing parameters for them
  • Loading branch information
mnlevy1981 committed Jan 6, 2025
1 parent 66a6fcf commit f5bd90a
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions helper_scripts/generate_cupid_config_for_cesm_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,23 @@ def generate_cupid_config(case_root, cesm_root, cupid_example):
my_dict["global_params"]["base_end_date"] = base_end_date
my_dict["timeseries"]["case_name"] = [case, base_case]

my_dict["timeseries"]["atm"]["end_years"] = [nyears, base_nyears]
my_dict["compute_notebooks"]["glc"]["Greenland_SMB_visual_compare_obs"][
"parameter_groups"
]["none"]["climo_nyears"] = climo_nyears
my_dict["compute_notebooks"]["glc"]["Greenland_SMB_visual_compare_obs"][
"parameter_groups"
]["none"]["base_climo_nyears"] = base_climo_nyears
for component in my_dict["timeseries"]:
if (
isinstance(my_dict["timeseries"][component], dict)
and "end_years" in my_dict["timeseries"][component]
):
my_dict["timeseries"][component]["end_years"] = [nyears, base_nyears]
if "link_to_ADF" in my_dict["compute_notebooks"]["atm"]:
my_dict["compute_notebooks"]["atm"]["link_to_ADF"]["parameter_groups"]["none"][
"adf_root"
] = os.path.join(case_root, "ADF_output")
if "Greenland_SMB_visual_compare_obs" in my_dict["compute_notebooks"]["glc"]:
my_dict["compute_notebooks"]["glc"]["Greenland_SMB_visual_compare_obs"][
"parameter_groups"
]["none"]["climo_nyears"] = climo_nyears
my_dict["compute_notebooks"]["glc"]["Greenland_SMB_visual_compare_obs"][
"parameter_groups"
]["none"]["base_climo_nyears"] = base_climo_nyears

# replace with environment variable
my_dict["global_params"]["CESM_output_dir"] = os.path.dirname(dout_s_root)
Expand Down

0 comments on commit f5bd90a

Please sign in to comment.