Update ENSO summary plot color scale and improve robustness#1372
Conversation
|
@lee1043 : Hi Jiwoo, the pull request here includes the changes to the color scale used for the enso sythentic metrics plot following our discussion during the E3SMv3 coupled large ensemble overview paper. The tests were performed along with CLIVAR-PRP/ENSO_metrics#95, and the sample figure can be found at https://compy-dtn.pnl.gov/zhan391/zppy_weekly_comprehensive_v3_www/zppy_main_branch_plus_unified_1_13rc7_refactor2/v3.LR.historical_0051/pcmdi_diags/model_vs_obs/ERROR_metric/enso_metric/enso_metric_skill_portrait.png. |
b20f588 to
5dd4598
Compare
This commit introduce modifications on parallel coordinate plots: - Replace deprecated scale/scale_hue seaborn arguments - Use density_norm="count" and common_norm=True - Add bw_adjust and gridsize to smooth violin shading - Keep cut=0 so shading remains bounded by sampled values
Adjust the split violin plot parameters to make group shading smoother and more visible. Use width normalization with a common reference, apply a small positive KDE cut to reduce abrupt clipping, and increase the KDE bandwidth and grid resolution for smoother violin boundaries.
|
Hi @lee1043 and @zhangshixuan1987 I tested the change to dev.yml which allows for a higher version of python and confirmed the Demo notebooks ran successfully with python v3.14.5. I was not able to run Demo 6 as the enso_driver script encounters this error: ModuleNotFoundError: No module named 'EnsoMetrics' . I am not sure if that is expected as the ENSO code is still undergoing changes, but otherwise this PR looks good to me! |
@kristinchang3 : I think that enso metrics is currently deactivated by @lee1043 in pcmdi, so you will not have the library installed from .yml file. |
|
@zhangshixuan1987 sounds good! thank you for confirming. |
|
@kristinchang3 thank you for the testing, good to know PMP runs okay with Python 3.14.x. As @zhangshixuan1987 pointed out, we are yet to bring ENSO back to default library. At the beginning of the demo 6 ENSO notebook, therefore it is noted that you will need the following to run ENSO, until we bring it back. |
| # NOTE: If versions are updated, also `additional_dependencies` list for mypy in `.pre-commit-config.yaml` | ||
| - python >=3.10,<3.14 | ||
| - python >=3.10,<3.15 | ||
| - pip |
There was a problem hiding this comment.
@zhangshixuan1987 is there any specific reason for this python version coverage change? I think this will need comprehensive test.
@kristinchang3 I think there were some conflict when we were testing with python 3.14 but I cannot recall the details. Do you recall what it was about?
There was a problem hiding this comment.
@lee1043 When we tested previously, python 3.14 was still in the pre-release stage so I actually was not able to install it at all. But today, I was able to! The official release date for 3.14.5 that I tested is May 10th 2026.
There was a problem hiding this comment.
my apologies @lee1043 for some reason I only received the notification for this comment after you approved and merged.
Summary
This PR updates the color scheme used in the ENSO summary portrait plot and refactors the color-selection logic to improve maintainability, consistency, and visual clarity.
Changes
Replaced hard-coded named colors (yellowgreen, plum, gold, turquoise) with a centralized _METRIC_TYPE_COLORS constant using ColorBrewer qualitative colors (#66c2a5, #8da0cb, #fc8d62, #e78ac3) and a consistent alpha of 0.45. This provides a more cohesive and accessible palette for distinguishing the four metric groups: background biases, ENSO characteristics, teleconnections, and processes/feedbacks.Simplified the color-selection logic by replacing the cascading if/elif chain with a concise next(..., default) expression, improving readability and making it easier to extend or reorder metric groups.dev.yml / pyproject.toml
Updated the supported Python version range to include Python 3.14, aligning with the latest e3sm_unified environment.