Skip to content

Conversation

@zhangshixuan1987
Copy link
Collaborator

@zhangshixuan1987 zhangshixuan1987 commented Sep 4, 2025

This pull request attempts to add code changes to zppy to facilitate successful zppy-PCMDI diagnostics.

Objectives:

  • Mean Climate: revise the e3sm_to_cmip to handle the 3-D variable, including U, V, T, and Z3. The "vrt_remap_plev19.nc" was added to "zppy/templates/inclusions/e3sm_to_cmip" directory to facilitate the interpolation from model level to standard pressure level

  • Modes of Variability: correction on the naming convention of the model file template so that it can be identified by the PCMDI diagnostic drivers. Also fix the flag change "plot_model = True" to "plot = True" following the changes made in the PCMDI code base

  • ENSO Diagnostics: revised the yml file to use NumPy < 2.1.0 for the PCMDI conda environment so that the “CLIVAR-PRP/ENSO_metrics” package can be called correctly for successful diagnostics of ENSO

Issue resolution:

This pull request is

  • a bug fix: increment the patch version
  • a small improvement: increment the minor version

Small Change

  • Logic: I have visually inspected the entire pull request myself.
  • Pre-commit checks: All the pre-commits checks have passed.

@forsyth2 forsyth2 mentioned this pull request Sep 17, 2025
17 tasks
@forsyth2 forsyth2 added semver: new feature New feature (will increment minor version) priority: high High priority task (for next release) labels Sep 17, 2025
@forsyth2 forsyth2 mentioned this pull request Sep 18, 2025
14 tasks
@forsyth2 forsyth2 force-pushed the zppy_pcmdi_202505_rev branch 2 times, most recently from f9944a9 to 3c39f69 Compare September 23, 2025 00:57
ref_final_yr = 1986
ref_start_yr = 1985
ref_years = "1985-1986",
vars = "psl"
Copy link
Collaborator

Choose a reason for hiding this comment

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

@zhangshixuan1987 I'm almost done with my additions; I just need to get the integration test added. This subtask seems to be failing on the output from /lcrc/group/e3sm2/ac.wlin//E3SMv3/v3.LR.historical_0051 though. As far as I can tell, that's because psl presumably wasn't captured for that. E.g., /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v3_output/unique_id_pcmdi_diags_20250924_try5/v3.LR.historical_0051/post/atm/180x360_aave/cmip_ts/monthly doesn't have any psl nc files in it.

So a couple questions:

  1. Do some simulation outputs just not have the variables needed for atm variability modes? I try to integration testing for all the zppy tasks on the same simulation output. Alternatively, have I simply entered bad parameters?
  2. It looks like synthetic_plots only allows variability_modes in totality -- that is, even if variability_modes_cpl works, if atm fails, then synthetic_plots can't complete either. Is that correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi Ryan, below is my response to the two questions:

  1. This is unlikely to be the case. PSL is a standard output variable in E3SM, and I am confident it is included in the output from v3.LR.historical_0051. For reference, see my PCMDI run for v3.LR.historical_0051 at
    /lcrc/group/e3sm/ac.szhang/acme_scratch/e3sm_project/test_zppy_pmp/v3.LR.historical_0051/post/atm/180x360_aave/cmip_ts/monthly. To my understanding, if the file psl.nc is missing in the cmip_ts/monthly directory, it most likely indicates that the e3sm_to_cmip conversion did not run successfully.

  2. This is correct. In PCMDI, variability_modes is not subdivided into variability_modes_cpl and variability_modes_atm. I introduced this split in zppy-pcmdi to enable parallel processing, since the coupled modes (variability_modes_cpl) rely on surface temperature (ts), whereas the atmospheric modes (variability_modes_atm) rely on sea level pressure (psl). The synthetic plots, however, require data from both variability_modes_cpl and variability_modes_atm to be combined.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it most likely indicates that the e3sm_to_cmip conversion did not run successfully.

Ah yes, psl isn't included by default in vars for e3sm_to_cmip. Re-testing now.

@forsyth2
Copy link
Collaborator

forsyth2 commented Sep 26, 2025

@zhangshixuan1987 @chengzhuzhang I added quite a few updates to the code. I haven't had a chance to do a visual inspection of the pull requests myself, but in the interest of time, I think it would be best for us all to review the code concurrently.

I'm a little concerned some of the code is hard-coded to expect specific things. For example:

  • figure_sets_period must be of length 3, expecting a year set for clim, emov, and enso.
  • vars in synthetic_plots must match vars in mean_climate.
  • The viewer page will list variables even if plots aren't available (i.e., grayed out links)

But again, in the interest of time, I think it would be best to try to get this merged ASAP and then add more flexibility in the following Unified release.

Here are links to specific commit blocks to review:

Repo ALL CHANGES My latest updates Shixuan's latest updates My initial updates Initial work (Shixuan)
zppy 28 commits 19 commits 6 commits 2 commits 1 commit
zppy-interfaces 19 commits 6 commits 7 commits 6 commits N/A

@chengzhuzhang For awareness, I have a bit of an ambitious to-do list for the Unified deadline of October 1 (not necessarily in this order):

@zhangshixuan1987
Copy link
Collaborator Author

zhangshixuan1987 commented Sep 26, 2025

Hi @forsyth2 and @chengzhuzhang : I quickly put some comments here as background information for the three questions you raised here:

  • figure_sets_period must be of length 3, expecting a year set for clim, emov, and enso.

**This design choice reflects the differing requirements across the three sets of diagnostics. For example, climatological means can often be estimated with 30 years—or even shorter periods—while still yielding a reasonable comparison. By contrast, robust ENSO analysis generally requires at least 30 years, and preferably longer. For modes of variability, a minimum of 50–100 years of data is often necessary to obtain reliable results. Therefore, applying a unified period across all three diagnostic sets would not be appropriate. This is the primary motivation for defining three separate sets: so that users are explicitly aware of the intended analysis timescales.

However, the current implementation of figure_sets_period could be improved. A more flexible approach would be to reference the diagnostic section itself and automatically collect the period lengths specified for each category, ensuring consistency while preserving the tailored requirements of each diagnostic.**

  • vars in synthetic_plots must match vars in mean_climate.
    **This design also ensures consistency between the mean_climate metrics and the corresponding visualizations. Without this constraint, users could easily encounter failures—for example, if a variable was not processed in mean_climate but was later selected for plotting in the synthetic metrics. By enforcing alignment between the diagnostic calculation and visualization stages, I think we can reduce the risk of mismatches and associated failure. However, I agree that some improvements to enhance code robustness are always beneficial and needed. **

  • The viewer page will list variables even if plots aren't available (i.e., grayed out links)

This part is a weakness at this moment, but can be improved. One solution was to adapt the e3sm_diag function to come up a more robust viewer page for pcmdi

Comment on lines 3 to 4
output = /lcrc/group/e3sm/ac.forsyth2/zppy_pr719_output/unique_id_51/v3.LR.amip_0101
www = /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_pr719_output/unique_id_51
Copy link
Collaborator

Choose a reason for hiding this comment

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

@zhangshixuan1987 If you're running the example cfg yourself, you need to change output and www accordingly.

It looks like my /lcrc/group/e3sm/ac.forsyth2/zppy_pr719_output/unique_id_51/v3.LR.amip_0101/post/scripts directory got some of your output:

cd /lcrc/group/e3sm/ac.forsyth2/zppy_pr719_output/unique_id_51/v3.LR.amip_0101/post/scripts
ls -lt pcmdi_diags_*.o*

gives:

-rw-rw----+ 1 ac.szhang   E3SM  944692 Sep 26 01:43 pcmdi_diags_mean_climate_model_vs_obs_2005-2006.o920507
-rw-rw----+ 1 ac.szhang   E3SM   68823 Sep 26 01:43 pcmdi_diags_variability_modes_atm_model_vs_obs_2005-2006.o920514
-rw-rw----+ 1 ac.szhang   E3SM   49895 Sep 26 01:42 pcmdi_diags_variability_modes_cpl_model_vs_obs_2005-2006.o920513
-rw-rw----+ 1 ac.szhang   E3SM   68822 Sep 26 01:40 pcmdi_diags_variability_modes_atm_model_vs_obs_2005-2006.o920509
-rw-rw----+ 1 ac.szhang   E3SM   49894 Sep 26 01:40 pcmdi_diags_variability_modes_cpl_model_vs_obs_2005-2006.o920508
-rw-rw----+ 1 ac.forsyth2 E3SM 4141187 Sep 25 20:51 pcmdi_diags_mean_climate_model_vs_obs_2005-2014.o920008
-rw-rw----+ 1 ac.forsyth2 E3SM   77567 Sep 25 20:36 pcmdi_diags_variability_modes_atm_model_vs_obs_2005-2014.o920010
-rw-rw----+ 1 ac.forsyth2 E3SM  143686 Sep 25 20:17 pcmdi_diags_variability_modes_cpl_model_vs_obs_2005-2014.o920009

Compared to an earlier run of mine:

cd /lcrc/group/e3sm/ac.forsyth2/zppy_pr719_output/unique_id_49/v3.LR.amip_0101/post/scripts
ls -lt pcmdi_diags_*.o*

gives:

ls -lt pcmdi_diags_*.o*
-rw-rw----+ 1 ac.forsyth2 E3SM  262329 Sep 25 19:45 pcmdi_diags_synthetic_plots_model_vs_obs.o919961
-rw-rw----+ 1 ac.forsyth2 E3SM 4880393 Sep 25 19:43 pcmdi_diags_mean_climate_model_vs_obs_2005-2014.o919958
-rw-rw----+ 1 ac.forsyth2 E3SM  527229 Sep 25 19:29 pcmdi_diags_variability_modes_atm_model_vs_obs_2005-2014.o919960
-rw-rw----+ 1 ac.forsyth2 E3SM  593071 Sep 25 19:10 pcmdi_diags_variability_modes_cpl_model_vs_obs_2005-2014.o919959

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@forsyth2: Thanks for catching that! I had set up the test incorrectly at first, but I’ve since corrected it. I was not trying to delete the files, as I was unsure if I would delete yours.

@forsyth2
Copy link
Collaborator

forsyth2 commented Oct 1, 2025

Running full test suite

  • Assuming zppy tests pass on main, run the pcmdi_diags PR code to really confirm it doesn't break anything.

Testing process

Expand
lcrc_conda

# e3sm_diags
# We're just going to reuse the conda environment used on the latest test:
# https://github.com/E3SM-Project/zppy/discussions/634#discussioncomment-14556194
# e3sm-diags-main-20250926-rerun 

cd ~/ez/zppy-interfaces
git status
# Check for uncommitted changes
git checkout add-pcmdi
git log
# Good, matches https://github.com/E3SM-Project/zppy-interfaces/pull/25/commits
# Good, based on top of: Add missing packages to dependencies (#32)
# Which is the latest commit on https://github.com/E3SM-Project/zppy-interfaces/commits/main
rm -rf build
conda clean --all --y # ~10 min to run
conda env create -f conda/dev.yml -n zi-pcmdi-diags-20250930
conda activate zi-pcmdi-diags-20250930
pre-commit run --all-files
python -m pip install .
pytest tests/unit/global_time_series/test_*.py
# 10 passed in 27.49s
pytest tests/unit/pcmdi_diags/test_*.py
# 7 passed, 2 warnings in 26.82s
# Comment on warnings: https://github.com/E3SM-Project/zppy-interfaces/pull/25#issuecomment-3353645549

cd ~/ez/zppy
git status
# Check for uncommitted changes
git checkout zppy_pcmdi_202505_rev
git log
# Bad, missing the latest commit from https://github.com/E3SM-Project/zppy/pull/732/commits
# Bad, based on top of: Latest NCO removes 3D vars (#717)
# Which doesn't match the latest commit on https://github.com/E3SM-Project/zppy/commits/main
#
# So, we want to get the newer commit + rebase off the latest `main`
git checkout -b zppy_pcmdi_202505_rev-backup20250930 # Make a backup
git checkout zppy_pcmdi_202505_rev
git fetch zhangshixuan1987 zppy_pcmdi_202505_rev
git reset --hard zhangshixuan1987/zppy_pcmdi_202505_rev
git log
# Good, has the new commit
# Now, to rebase off the latest `main`:
git fetch upstream
git rebase upstream/main
git log
# Good, 29 commits on top of: Integration test fixes (#737)
rm -rf build
conda clean --all --y # ~7 min to run
conda env create -f conda/dev.yml -n zppy-pcmdi-diags-20250930 
conda activate zppy-pcmdi-diags-20250930
pytest tests/test_*.py
# 32 passed in 1.08s

# Edit tests/integration/utils.py:
# TEST_SPECIFICS: Dict[str, Any] = {
#     "diags_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate e3sm-diags-main-20250926-rerun",
#     "global_time_series_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate zi-pcmdi-diags-20250930",
#     "pcmdi_diags_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate zi-pcmdi-diags-20250930",
#     "cfgs_to_run": [
#         "weekly_bundles",
#         "weekly_comprehensive_v2",
#         "weekly_comprehensive_v3",
#         "weekly_legacy_3.0.0_bundles",
#         "weekly_legacy_3.0.0_comprehensive_v2",
#         "weekly_legacy_3.0.0_comprehensive_v3",
#     ],
#     "tasks_to_run": [
#         "e3sm_diags",
#         "mpas_analysis",
#         "global_time_series",
#         "ilamb",
#         "pcmdi_diags",
#     ],
#     "unique_id": "test_pcmdi_diags_20250930",
# }
python tests/integration/utils.py
pre-commit run --all-files
python -m pip install .
zppy -c tests/integration/generated/test_weekly_bundles_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_comprehensive_v2_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_comprehensive_v3_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_legacy_3.0.0_bundles_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_legacy_3.0.0_comprehensive_v2_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_legacy_3.0.0_comprehensive_v3_chrysalis.cfg

# Picking up Oct. 1 ###########################################################
# Check on bundles status
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_bundles_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_legacy_3.0.0_bundles_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors
# Now, run bundles part 2
cd ~/ez/zppy 
# Realized later we were on branch zppy_pcmdi_zi_standalone
# But... that should be ok since we activate the correct environment:
# zppy-pcmdi-diags-20250930
# without doing a `pip install` of the current branch.
# AND the generated files should be the same since that branch didn't reset the files.
lcrc_conda
conda activate zppy-pcmdi-diags-20250930
zppy -c tests/integration/generated/test_weekly_bundles_chrysalis.cfg
zppy -c tests/integration/generated/test_weekly_legacy_3.0.0_bundles_chrysalis.cfg

# Review finished runs
### v2  ###
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v2_output/test_pcmdi_diags_20250930/v2.LR.historical_0201/post/scripts
grep -v "OK" *status
# Good, no errors
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v2_output/test_pcmdi_diags_20250930/v2.LR.historical_0201/post/scripts
grep -v "OK" *status
# Good, no errors
### v3 ###
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v3_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v3_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors
### bundles ###
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_bundles_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_legacy_3.0.0_bundles_output/test_pcmdi_diags_20250930/v3.LR.historical_0051/post/scripts
grep -v "OK" *status
# Good, no errors

# Let's proceed with the test suite to see if any more errors exist.
cd ~/ez/zppy
# MAKE SURE WE'RE ON THE RIGHT BRANCH
git status # Branch: zppy_pcmdi_zi_standalone
git add -A
git commit -m "Standalone zi testing" --no-verify
git checkout zppy_pcmdi_202505_rev
ls tests/integration/test_*.py
pytest tests/integration/test_bash_generation.py
# 1 failed in 1.90s
# Diffs expected because we introduced `environment_commands_secondary`, and added "PSL" to `vars`
pytest tests/integration/test_campaign.py
# 6 failed in 4.16s, same note as above
pytest tests/integration/test_defaults.py
# 1 failed in 1.09s, same note as above
pytest tests/integration/test_last_year.py
# 1 passed in 0.45s
pytest tests/integration/test_bundles.py
# 2 passed in 0.26s
pytest tests/integration/test_images.py
# ========================================= short test summary info =========================================
# FAILED tests/integration/test_images.py::test_images - ValueError: No images found for task pcmdi_diags in /lcrc/group/e3sm/public_html/diagnostic_output/ac....
# ====================================== 1 failed in 650.79s (0:10:50) ======================================

# Need to update tests/integration/image_checker.py:
    # for task in task_list:
    #     if task == "pcmdi_diags":
    #         print(f"{task} hs no expected results yet, skipping.")
    #         continue
pytest tests/integration/test_images.py # ~1h to run
# Passed
cat test_images_summary.md
Test name Total images Correct images Missing images Mismatched images Diff subdir
comprehensive_v2_e3sm_diags 3691 3691 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_comprehensive_v2/e3sm_diags
comprehensive_v2_mpas_analysis 854 854 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_comprehensive_v2/mpas_analysis
comprehensive_v2_global_time_series 6 6 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_comprehensive_v2/global_time_series
comprehensive_v2_ilamb 776 776 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_comprehensive_v2/ilamb
comprehensive_v3_e3sm_diags 5210 5210 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_comprehensive_v3/e3sm_diags
comprehensive_v3_mpas_analysis 854 854 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_comprehensive_v3/mpas_analysis
comprehensive_v3_global_time_series 15 15 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_comprehensive_v3/global_time_series
comprehensive_v3_ilamb 837 837 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_comprehensive_v3/ilamb
bundles_e3sm_diags 1692 1692 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_bundles/e3sm_diags
bundles_global_time_series 3 3 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_bundles/global_time_series
bundles_ilamb 388 388 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_bundles/ilamb
legacy_3.0.0_comprehensive_v2_e3sm_diags 3691 3691 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_legacy_3.0.0_comprehensive_v2/e3sm_diags
legacy_3.0.0_comprehensive_v2_mpas_analysis 854 854 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_legacy_3.0.0_comprehensive_v2/mpas_analysis
legacy_3.0.0_comprehensive_v2_global_time_series 6 6 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_legacy_3.0.0_comprehensive_v2/global_time_series
legacy_3.0.0_comprehensive_v2_ilamb 776 776 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v2_www/test_pcmdi_diags_20250930/v2.LR.historical_0201/image_check_failures_legacy_3.0.0_comprehensive_v2/ilamb
legacy_3.0.0_comprehensive_v3_e3sm_diags 5210 5210 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_comprehensive_v3/e3sm_diags
legacy_3.0.0_comprehensive_v3_mpas_analysis 854 854 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_comprehensive_v3/mpas_analysis
legacy_3.0.0_comprehensive_v3_global_time_series 15 15 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_comprehensive_v3/global_time_series
legacy_3.0.0_comprehensive_v3_ilamb 837 837 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_comprehensive_v3_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_comprehensive_v3/ilamb
legacy_3.0.0_bundles_e3sm_diags 1692 1692 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_bundles/e3sm_diags
legacy_3.0.0_bundles_global_time_series 3 3 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_bundles/global_time_series
legacy_3.0.0_bundles_ilamb 388 388 0 0 /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_legacy_3.0.0_bundles_www/test_pcmdi_diags_20250930/v3.LR.historical_0051/image_check_failures_legacy_3.0.0_bundles/ilamb
git diff tests/integration/image_checker.py
# diff --git a/tests/integration/image_checker.py b/tests/integration/image_checker.py
# index 53ce8fdb..f6a8da7b 100644
# --- a/tests/integration/image_checker.py
# +++ b/tests/integration/image_checker.py
# @@ -76,6 +76,9 @@ def set_up_and_run_image_checker(
#          print(f"{key}: {d[key]}")
#      parameters: Parameters = Parameters(d)
#      for task in task_list:
# +        if task == "pcmdi_diags":
# +            print(f"{task} hs no expected results yet, skipping.")
# +            continue
#          test_results = check_images(parameters, task)
#          test_results_dict[f"{cfg_specifier}_{task}"] = test_results

Let's also review the results produced by the pcmdi task even though we don't have expected results set for them.

All integration tests passed, meaning this PR isn't interfereing with the functioning of the other tasks.

It also appears the PCMDI subtasks produced a working viewer.

@forsyth2 forsyth2 force-pushed the zppy_pcmdi_202505_rev branch from a824086 to d2a5982 Compare October 1, 2025 15:46
@zhangshixuan1987
Copy link
Collaborator Author

@forsyth2 : Hi Ryan, I have finished the refactoring of both pcmdi in zppy-interface and zppy to address concerns on hard-coding in synthetic plots and viewer:

  • figure_sets_period must be of length 3, expecting a year set for clim, emov, and enso.
  • vars in synthetic_plots must match vars in mean_climate.
  • The viewer page will list variables even if plots aren't available (i.e., grayed out links)

**The code changes are made in zppy through commit 1dd6157bd49d29 and commit cec3b6af0592c94

Corresponding changes in the zppy-interface are included in commit ab97e870c5a9c570

These PRs refactor the PCMDI diagnostics integration in both zppy and zppy-interface to remove hard-coded dependencies in the synthetic plots and viewer, improving flexibility and modularity. Specifically, the synthetic_plots section in .cfg files related to pcmdi is now largely independent of the other three sections. These changes are made to allow the viewer to have:

  • Customizable content — users can explicitly define lists of variables, regions, and variability modes via clim_vars, clim_regions, and mova_modes.
  • Flexible diagnostic periods — periods for each diagnostic can be set through clim_years, mova_years, movc_years, and enso_years.
  • Selectable diagnostic groups — viewer components are controlled through the flags clim_viewer, mova_viewer, movc_viewer, and enso_viewer.

Using the updated code described above, I have tested the revised implementation with two configuration files:

The generated outputs and diagnostics can be viewed at:

I’ll ask for your review and feedback to ensure these changes align with your expectations and can be considered as a solution to your concerns.

@forsyth2
Copy link
Collaborator

forsyth2 commented Oct 6, 2025

Thanks @zhangshixuan1987! I'll review & test today.

zhangshixuan1987 and others added 13 commits October 6, 2025 11:55
Key changes are described below:

1. Mean Climate: revise the e3sm_to_cmip to handle the 3-D variable
including U, V, T, and Z3. The "vrt_remap_plev19.nc" was added to
"zppy/templates/inclusions/e3sm_to_cmip" directory to facillitate the
interpolation from model level to standard pressure level

2. Modes of Variability: correction on the naming convention of the
model file template so that it can be identified by the PCMDI diagnostic
drivers. Also fix the flag change "plot_model = True" to "plot = True"
following the changes made in the PCMDI code base

3. ENSO Diagnostics: revised the yml file to use NumPy < 2.1.0 for the
PCMDI conda environment so that the “CLIVAR-PRP/ENSO_metrics” package
can be called correctly for sucess diagnostics of ENSO
forsyth2 and others added 18 commits October 6, 2025 12:00
Added input validation to ensure all year variables are integers and within a valid order.

Normalized start/end pairs so reversed inputs (e.g. y1 > y2, ref_start_yr > ref_final_yr) are automatically swapped.

Recorded the original custom reference range (ref_y1, ref_y2) and clamped it to the available reference window for safe fallback.

Refined the adjustment logic so:

If availability fully covers the analysis period, use [y1, y2].

Otherwise, prefer the clamped custom range and trim only if it extends beyond the analysis window.

If custom and analysis don’t overlap, fall back to the overlap of availability ∩ analysis.

If no overlap exists, fall back to the clamped custom, and finally the full available window.

Ensured final ref_y1 ≤ ref_y2 and applied zero-padding formatting once at the end.
and viewer

This comment contains update in the default.ini interms of the
definition of "vars" in pcmdi diagnostic sections. I now explicitly
defined "clim_vars", "mova_vars", "movc_vars" and "enso_vars" to
explicitly pass the needed variables for corresponding diagnostics in
pcmdi. This will be later on used to process the viewer page

The corresponding changes were also made in pcmdi_diags.bash to accept
the new variables defined in .cfg files and default.ini
Refactored the PCMDI diagnostics workflow to strengthen viewer
robustness and configuration handling.

Key updates
------------
- default.ini:
  * Added explicit defaults for viewer-related options.
  * Improved parameter consistency with zppy config interface.

- pcmdi_diags.py:
  * Refactored configuration parsing to ensure safe propagation of
    viewer options.
  * Enhanced logging for viewer setup and diagnostic dispatch.

- templates/pcmdi_diags.bash:
  * Updated environment variable exports for new viewer flags.
  * Improved argument quoting and error handling.
@forsyth2 forsyth2 force-pushed the zppy_pcmdi_202505_rev branch from c38687a to 9e399f4 Compare October 6, 2025 17:51
@forsyth2 forsyth2 merged commit ee11981 into E3SM-Project:main Oct 8, 2025
6 checks passed
@forsyth2 forsyth2 mentioned this pull request Oct 9, 2025
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: high High priority task (for next release) semver: new feature New feature (will increment minor version)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add task for PMP

2 participants