Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
c8aa983
Claude-Augment enhancement on zppy-pcmdi
zhangshixuan1987 May 1, 2026
4220184
Claude-augument enhancement: fix time precision and bnds dimension wa…
zhangshixuan1987 May 1, 2026
7c0e1cf
Rebase to latest main
zhangshixuan1987 May 2, 2026
5040692
Rebase to latest main
zhangshixuan1987 May 3, 2026
e4e3b17
Claude-Augment Enhancement for robustness
zhangshixuan1987 May 3, 2026
a550cb6
bug fix
zhangshixuan1987 May 3, 2026
5e38c52
precommit refromat
zhangshixuan1987 May 5, 2026
bede594
rebase to latest main
zhangshixuan1987 May 11, 2026
7767d88
Ajust to allow enso metrics and revise enso vars to be identified by
zhangshixuan1987 May 11, 2026
faf9999
Modify the job dependency workflow for the pcmdi
zhangshixuan1987 May 13, 2026
aa1a3f4
Enanble ts processing on mpaso and mpassi model output
zhangshixuan1987 May 13, 2026
4b0370d
Correct the variable name for default setup for enso
zhangshixuan1987 May 13, 2026
44fce79
Bug fix in zppy/templates/ts.bash for variable filtering in global
zhangshixuan1987 May 14, 2026
3d24cde
Fix the ocean and seaice data processing typ setup
zhangshixuan1987 May 14, 2026
6345cfd
Add export MPLBACKEND=Agg to the pcmdi workflow
zhangshixuan1987 May 15, 2026
1595ef6
Enable MPAS ocean/sea-ice time-series processing to support pcmdi
zhangshixuan1987 May 15, 2026
740f231
Fix by pre-commit check
zhangshixuan1987 May 15, 2026
d2c8d7f
Rebase code to the main branch and refactor MPAS regrid handling
zhangshixuan1987 Jun 29, 2026
f17a7e1
Update tests for MPAS TS defaults
zhangshixuan1987 Jun 29, 2026
9b02629
Remove obsolete mpas_rst_template default
zhangshixuan1987 Jun 29, 2026
984e77e
Save PCMDI mean climate data
zhangshixuan1987 Jun 29, 2026
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
14 changes: 14 additions & 0 deletions tests/test_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ def test_sections():
"input_component": "",
"job_nbr": 0,
"mapping_file": "MAPPING_FILE_TS",
"mpas_calendar": "noleap",
"mpas_start_time": "0001-01-01 00:00:00",
"tpd": 1,
"vars": "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT",
"vrt_remap_vars": "",
Expand Down Expand Up @@ -155,6 +157,8 @@ def test_sections():
"input_subdir": "INPUT_SUBDIR",
"job_nbr": 0,
"mapping_file": "MAPPING_FILE_TS",
"mpas_calendar": "noleap",
"mpas_start_time": "0001-01-01 00:00:00",
"ncclimo_cmd": "ncclimo",
"nco_path": "",
"nodes": 1,
Expand Down Expand Up @@ -333,6 +337,8 @@ def test_subsections():
"input_component": None,
"job_nbr": None,
"mapping_file": "MAPPING_FILE_TS_GRID1",
"mpas_calendar": None,
"mpas_start_time": None,
"tpd": None,
"vrt_remap_vars": None,
"vrt_in_file": None,
Expand All @@ -346,13 +352,17 @@ def test_subsections():
"input_component": None,
"job_nbr": None,
"mapping_file": "MAPPING_FILE_TS_GRID2",
"mpas_calendar": None,
"mpas_start_time": None,
"tpd": None,
"vrt_remap_vars": None,
"vrt_in_file": None,
"vrt_remap_file": None,
"years": ["0001:0020:10"],
},
"vars": "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT",
"mpas_calendar": "noleap",
"mpas_start_time": "0001-01-01 00:00:00",
"vrt_remap_vars": "",
"vrt_in_file": "",
"vrt_remap_file": "",
Expand Down Expand Up @@ -387,6 +397,8 @@ def test_subsections():
"input_subdir": "INPUT_SUBDIR",
"job_nbr": 0,
"mapping_file": "MAPPING_FILE_TS_GRID1",
"mpas_calendar": "noleap",
"mpas_start_time": "0001-01-01 00:00:00",
"ncclimo_cmd": "ncclimo",
"nco_path": "",
"nodes": 1,
Expand Down Expand Up @@ -442,6 +454,8 @@ def test_subsections():
"input_subdir": "INPUT_SUBDIR",
"job_nbr": 0,
"mapping_file": "MAPPING_FILE_TS_GRID2",
"mpas_calendar": "noleap",
"mpas_start_time": "0001-01-01 00:00:00",
"ncclimo_cmd": "ncclimo",
"nco_path": "",
"nodes": 1,
Expand Down
1 change: 1 addition & 0 deletions tests/test_zppy_pcmdi_diags.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def test_add_ts_dependencies():
dependencies: List[str] = []
c = {
"current_set": "mean_climate",
"infer_section_parameters": True,
"ts_num_years": 5,
}
script_dir = "/scripts"
Expand Down
13 changes: 12 additions & 1 deletion zppy/defaults/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ job_nbr = integer(default=0)
tpd = integer(default=1)
# Model component having generated input files (eam, eamxx, elm, mosart, ...)
input_component = string(default="")
# MPAS calendar used to construct a CF-style numeric time coordinate
# from timeMonthly_avg_daysSinceStartOfSim when native MPAS time-series
# files do not contain a standard time variable.
mpas_calendar = string(default="noleap")
# MPAS simulation start time used as the reference time for constructing
# a CF-style numeric time coordinate:
# time:units = "days since <mpas_start_time>"
# This should match the MPAS/E3SM config_start_time when possible.
mpas_start_time = string(default="0001-01-01 00:00:00")
# Vertical regrid (model levels → pressure levels) — applied after ncclimo splits
# files into per-var time-series. Vars listed here will additionally be regridded
# and written to a sibling directory `ts_vrt_remap/` parallel to `ts/`, so users
Expand All @@ -171,6 +180,8 @@ vrt_in_file = string(default="")
job_nbr = integer(default=None)
tpd = integer(default=None)
input_component = string(default=None)
mpas_calendar = string(default=None)
mpas_start_time = string(default=None)
vrt_remap_vars = string(default=None)
vrt_remap_file = string(default=None)
vrt_in_file = string(default=None)
Expand Down Expand Up @@ -647,7 +658,7 @@ enso_groups = string(default="ENSO_perf,ENSO_proc,ENSO_tel")
# Specify these for the enso subtask AND the synthetic_plots subtask
###########################################################################################
# enso: vars = "psl,pr,prsn,ts,tas,tauu,tauv,hflx,hfss,rlds,rsds,rlus,rlut,rsdt"
enso_vars = string(default="psl,pr,prsn,ts,tas,tauu,tauv,hflx,hfss,rlds,rsds,rlus,rlut,rsdt")
enso_vars = string(default="psl,pr,ts,tas,tauu,tauv,hfls,hfss,rlds,rsds,rlus,rlut,rsdt")
###########################################################################################
# Specify these for the synthetic_plots subtask
###########################################################################################
Expand Down
96 changes: 71 additions & 25 deletions zppy/pcmdi_diags.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def pcmdi_diags(config, script_dir, existing_bundles, job_ids_file):
define_current_set(c)
if c["current_set"] == "enso":
logger.warning(
"The 'enso' set is not yet supported in PCMDI Diags. Skipping launching of associated jobs."
"The 'enso' set is currently a testing mode in PCMDI Diags. Turn on it with care."
)
break # Skip this task
# continue # Skip this task
Comment on lines +57 to +59

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Claude:


The enso set now runs instead of being skipped. A few questions: (1) Is this intentional and is enso considered stable enough for general use? (2) The commented-out continue is misleading — if the intent is to allow it to run, the comment should be removed entirely rather than left as dead code. (3) The warning message has a grammatical issue: "Turn on it with care" should be "Use with care" or "Enable with care."

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a big change -- is this the PR that enables ENSO support for pcmdi_diags?

c["sub"] = get_value_from_parameter(
c, "subsection", "sub", ParameterInferenceType.SECTION_INFERENCE
)
Expand Down Expand Up @@ -89,7 +89,7 @@ def pcmdi_diags(config, script_dir, existing_bundles, job_ids_file):

if c["current_set"] != "synthetic_plots":
check_and_define_parameters(c)
print(c["prefix"])
logger.debug(c["prefix"])
define_relevant_years(c)
else:
prefix = f"pcmdi_diags_{c['sub']}_{c['run_type']}"
Expand Down Expand Up @@ -119,21 +119,8 @@ def pcmdi_diags(config, script_dir, existing_bundles, job_ids_file):
if c["current_set"] != "synthetic_plots":
for yr in range(c["year1"], c["year2"], c["ts_num_years"]):
add_ts_dependencies(c, dependencies, script_dir, yr)
set_value_of_parameter_if_undefined(
c,
"e3sm_to_cmip_atm_subsection",
"atm_monthly_180x360_aave",
ParameterInferenceType.SECTION_INFERENCE,
)
add_dependencies(
dependencies,
script_dir,
"e3sm_to_cmip",
c["e3sm_to_cmip_atm_subsection"],
c["year1"],
c["year2"],
c["ts_num_years"],
)
for yr in range(c["year1"], c["year2"], c["ts_num_years"]):
add_e3sm_to_cmip_dependencies(c, dependencies, script_dir, yr)
else:
if i < len(year_sets) - 1:
continue
Expand Down Expand Up @@ -345,22 +332,79 @@ def define_relevant_years_for_synthetic_plots(c: Dict[str, Any]) -> None:
c["enso_years"] = year_str


def _as_subsection_list(subsection: str) -> List[str]:
return [item.strip() for item in subsection.split(",") if item.strip()]


def add_ts_dependencies(
c: Dict[str, Any], dependencies: List[str], script_dir: str, yr: int
):
start_yr = yr
end_yr = yr + c["ts_num_years"] - 1

if c["current_set"] in BASE_PCMDI_SETS:
add_dependencies(
dependencies,
script_dir,
"ts",
# Ensure the key exists because set_value_of_parameter_if_undefined()
# only fills values for existing keys with an empty string.
if "ts_subsection" not in c:
c["ts_subsection"] = ""

set_value_of_parameter_if_undefined(
c,
"ts_subsection",
"atm_monthly_180x360_aave",
ParameterInferenceType.SECTION_INFERENCE,
)

ts_subsections = [
item.strip() for item in c["ts_subsection"].split(",") if item.strip()
]

for ts_subsection in ts_subsections:
add_dependencies(
dependencies,
script_dir,
"ts",
ts_subsection,
start_yr,
end_yr,
c["ts_num_years"],
)


def add_e3sm_to_cmip_dependencies(
c: Dict[str, Any], dependencies: List[str], script_dir: str, yr: int
):
Comment on lines +374 to +376

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From Claude:


_as_subsection_list() was defined earlier in this file but doesn't appear to be used here — the subsection splitting is re-implemented inline with a list comprehension. Consider using the helper for consistency, or remove it if it isn't used elsewhere.

start_yr = yr
end_yr = yr + c["ts_num_years"] - 1

if c["current_set"] in BASE_PCMDI_SETS:
if "e3sm_to_cmip_atm_subsection" not in c:
c["e3sm_to_cmip_atm_subsection"] = ""

set_value_of_parameter_if_undefined(
c,
"e3sm_to_cmip_atm_subsection",
"atm_monthly_180x360_aave",
start_yr,
end_yr,
c["ts_num_years"],
ParameterInferenceType.SECTION_INFERENCE,
)

e3sm_to_cmip_atm_subsections = [
item.strip()
for item in c["e3sm_to_cmip_atm_subsection"].split(",")
if item.strip()
]

for e3sm_to_cmip_atm_subsection in e3sm_to_cmip_atm_subsections:
add_dependencies(
dependencies,
script_dir,
"e3sm_to_cmip",
e3sm_to_cmip_atm_subsection,
start_yr,
end_yr,
c["ts_num_years"],
)


def add_pcmdi_dependencies(
c: Dict[str, Any], dependencies: List[str], script_dir: str
Expand All @@ -370,6 +414,8 @@ def add_pcmdi_dependencies(
status_suffix = f"_{c['year1']:04d}-{c['year2']:04d}"
elif c["run_type"] == "model_vs_model":
status_suffix = f"_{c['year1']:04d}-{c['year2']:04d}_vs_{c['ref_year1']:04d}-{c['ref_year2']:04d}"
else:
raise ValueError(f"Invalid run_type={c['run_type']}")

if c["clim_viewer"]:
status_file = os.path.join(
Expand Down
Loading
Loading