Add mpas_analysis_subsection parameter to global_time_series#788
Conversation
|
I think this is not quite the right solution to the problem, but it's not far off. Please see my comment here #634 (reply in thread). |
forsyth2
left a comment
There was a problem hiding this comment.
I've added a second commit to address Xylar's comment in #634:
instead of adding a new original section, I would just pass global_time_series a list of subsections. It should be given both reference and test. Then, it should be able to find the data it needs in both.
However, Jill's comment #634 noted:
It looks like the files (claimed being vanished) are actually being synced okay. We can keep an eye on this during next weekly test.
That was in the context of the bundles test, but the global_time_series test also had file has vanished:. So, I think it makes sense to try the weekly tests again today without this second commit and see if the same error appears.
| dependencies.append( | ||
| os.path.join( | ||
| script_dir, | ||
| f"mpas_analysis{mpas_sub_str}_ts_{c['ts_year1']:04d}-{c['ts_year2']:04d}_climo_{c['climo_year1']:04d}-{c['climo_year2']:04d}.status", |
There was a problem hiding this comment.
The years will have to be adjusted based on the subsection though...
|
@forsyth2, what's the status here? Any help I can give you to help this along? |
|
Since this PR's origin is a little complicated, here's a recap:
So, I think we have these two choices:
What do you think? Or should we choose a different path entirely? |
|
I remain unhappy with the first solution here. So I will try to implement the second one. |
We need to use the climatology and time series bounds from that analysis, rather than from global time series, to construct their filenames. To make this easier and better share code, the bulk of this work happens in the mpas_analysis module, not in global_time_series.
|
@forsyth2, I don't have permission to push to this branch. Can you hard-reset to my equivalent? https://github.com/xylar/zppy/tree/fix-integration-tests Then, we should be able to re-test to see if this works out. |
|
Thanks @xylar. I've reset this branch to match yours. I also gave you write permissions to the repo, so you should be able to push changes yourself in the future. I'll test this out today. |
|
Thanks so much @forsyth2! |
forsyth2
left a comment
There was a problem hiding this comment.
@xylar Based on our conversation here, I've added this new commit. Let me know what you think.
I've also tested it:
Set up environments
# e3sm_diags, livvkit: don't need to set up env
# mpas_analysis: use existing test-mpas-analysis-develop-20260327
# zi (global_time_series): use existing test-zi-main-20260327zppy run
# zppy itself #################################################################
cd ~/ez/zppy
git status
# On branch fix-integration-tests
# nothing to commit, working tree clean
git log --oneline | head -n 6
# 2857766f Add comparison_type subdir
# 2964b0f5 Add unit tests to ensure correct status filenames
# 91d39e72 Fix mpas_analysis status file names.
# 3f3cadc8 Allow multiple mpas_analysis subsections
# 4f466ab0 Add mpas_analysis_subsection parameter to global_time_series
# c9bd1817 Merge pull request #772 from xylar/add-mpas-analysis-model-vs-model
rm -rf build
conda clean --all --y
conda env create -f conda/dev.yml -n test-zppy-pr788-20260330
conda activate test-zppy-pr788-20260330
pre-commit run --all-files
python -m pip install .
pytest tests/test_*.py # 36 passed in 0.47s
# Edit tests/integration/utils.py.TEST_SPECIFICS: Dict[str, Any] = {
# These are custom environment_commands for specific tasks.
# Never set these to "", because they will print the line
# `environment_commands = ""` for the corresponding task,
# thus overriding the value set higher up in the cfg.
# That is, there will be no environment set.
# (`environment_commands = ""` only redirects to Unified
# if specified under the [default] task)
"diags_environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
"mpas_analysis_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-mpas-analysis-develop-20260327",
"global_time_series_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-zi-main-20260327",
"pcmdi_diags_environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
# This is the environment setup for other tasks.
# Leave as "" to use the latest Unified environment.
"environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
# For a complete test, run the set of latest cfgs and at least one set of legacy cfgs
"cfgs_to_run": [
# "weekly_bundles",
# "weekly_comprehensive_v2",
"weekly_comprehensive_v3",
# "weekly_legacy_3.1.0_bundles",
# "weekly_legacy_3.1.0_comprehensive_v2",
# "weekly_legacy_3.1.0_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_pr788_20260330",
}git diff # Diff looks good
python tests/integration/utils.py
# CFG FILES HAVE BEEN GENERATED FROM TEMPLATES WITH THESE SETTINGS:
# UNIQUE_ID=test_pr788_20260330
# diags_environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# mpas_analysis_environment_commands=source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-mpas-analysis-develop-20260327
# global_time_series_environment_commands=source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-zi-main-20260327
# pcmdi_diags_environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# Reminder: `environment_commands=''` => the latest E3SM Unified environment will be used
# For reference:
alias sq
# alias sq='sqa -u ac.forsyth2'
alias sqa
# alias sqa='squeue -o "%8u %.7a %.4D %.9P %7i %.2t %.10r %.10M %.10l %j" --sort=P,-t,-p'
sq
# No jobs currently queued
zppy -c tests/integration/generated/test_weekly_comprehensive_v3_chrysalis.cfg
sq | wc -l # Mon 3/30 17:26 => 32 - header row = 31 jobsReview finished runs
### v3 ###
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v3_output/test_pr788_20260330/v3.LR.historical_0051/post/scripts
grep -v "OK" *status # Good, no errorspost/scripts directory status: No failures
Python tests
cd ~/ez/zppy
git status
# On branch fix-integration-tests
# Good, correct branch
# Env: test-zppy-pr788-20260330
# Good, correct env
ls tests/integration/test_*.py
salloc --nodes=1 --partition=debug --time=02:00:00 --account=e3sm
# We need to reactivate conda now that we're on a compute node
lcrc_conda # Activate conda
conda activate test-zppy-pr788-20260330
pytest tests/integration/test_images.py # 1 failed in 76.11s (0:01:16)
cat test_images_summary.mdOutput:
------------------------------------------------ Captured stdout call ------------------------------------------------
Preparing weekly cfg tests
Preparing legacy 3.1.0 cfg tests
Preparing legacy 3.0.0 cfg tests
Running 1 tests in parallel
Individual test logs will be written to test_<name>.log files
✓ Completed: comprehensive_v3 (2 tasks) (log: test_comprehensive_v3.log)
Copy the output of test_images_summary.md to a Pull Request comment
Test Summary:
Test Total Correct Status
----------------------------------------------------------------------------------
comprehensive_v3_mpas_analysis 856 0 ✗ FAIL
comprehensive_v3_global_time_series 1404 1404 ✓ PASS
----------------------------------------------------------------------------------
⚠ Some tests had mismatched or missing images. Check individual log files for details.
============================================== short test summary info ===============================================
FAILED tests/integration/test_images.py::test_images - assert 856 == 0
============================================ 1 failed in 76.11s (0:01:16) ============================================
Complete summary table:
| Test name | Total images | Correct images | Missing images | Mismatched images |
|---|---|---|---|---|
| comprehensive_v3_mpas_analysis | 856 | 0 | 856 (list) | 0 |
| comprehensive_v3_global_time_series | 1404 | 1404 | 0 | 0 |
Summary table -- only failing tests:
| Test name | Total images | Correct images | Missing images | Mismatched images |
|---|---|---|---|---|
| comprehensive_v3_mpas_analysis | 856 | 0 | 856 (list) | 0 |
Results analysis: the list link is showing missing images because the expected results don't yet have the comparison subdir in their paths. We can check to make sure the paths are what we now expect them to be:
cd /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pr788_20260330/v3.LR.historical_0051/mpas_analysis/
ls
# mvm mvo
ls mvm
# ts_1985-1995_climo_1990-1995_vs_ts_1985-1989_climo_1985-1989
ls mvo
# ts_1985-1989_climo_1985-1989 ts_1985-1995_climo_1990-1995Good, as expected.
| if not is_mvm: | ||
| c["analysis_subdir"] = "mpas_analysis" | ||
| c["analysis_task_name"] = "mpas_analysis" | ||
| c["comparison_type"] = "mvo" |
There was a problem hiding this comment.
I did mvo and mvm for model-vs-obs and model-vs-model respectively, but we can choose different labels.
| ref_identifier: str, | ||
| ) -> None: | ||
| is_mvm = bool(reference_data_path) | ||
| c["analysis_subdir"] = "mpas_analysis" |
There was a problem hiding this comment.
An alternative to having a comparison subdirectory explicitly referenced (as ${www}/${case}/{{ analysis_subdir }}/{{ comparison_type }}) would be to set c["analysis_subdir"] = f"mpas_analysis/{comparison_type}", so it's just one string to pass around.
Yet another alternative would be to forgo the the comparison subdirectory altogether and have both mvo and mvm all together in one directory. That's how e3sm_diags does it. In this case ls /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pr788_20260330/v3.LR.historical_0051/mpas_analysis/ would give something like:
ts_1985-1995_climo_1990-1995_vs_ts_1985-1989_climo_1985-1989
ts_1985-1989_climo_1985-1989
ts_1985-1995_climo_1990-1995
There was a problem hiding this comment.
Yet another alternative would be to forgo the the comparison subdirectory altogether and have both mvo and mvm all together in one directory.
This would not work because typically we are not comparing the same run over different time periods, we are comparing different runs over the same time periods.
There was a problem hiding this comment.
An alternative to having a comparison subdirectory explicitly...
I prefer the more verbose way you have it now.
xylar
left a comment
There was a problem hiding this comment.
In principle, I like your solution. I need to see in practice how it works with comparisons between two different runs covering the same time period. But it looks promising.
| ref_identifier: str, | ||
| ) -> None: | ||
| is_mvm = bool(reference_data_path) | ||
| c["analysis_subdir"] = "mpas_analysis" |
There was a problem hiding this comment.
Yet another alternative would be to forgo the the comparison subdirectory altogether and have both mvo and mvm all together in one directory.
This would not work because typically we are not comparing the same run over different time periods, we are comparing different runs over the same time periods.
| ref_identifier: str, | ||
| ) -> None: | ||
| is_mvm = bool(reference_data_path) | ||
| c["analysis_subdir"] = "mpas_analysis" |
There was a problem hiding this comment.
An alternative to having a comparison subdirectory explicitly...
I prefer the more verbose way you have it now.
There was a problem hiding this comment.
I think /{{ comparison_type }} also needs to be added earlier in this file:
workdir="../analysis/{{ analysis_subdir }}/{{ comparison_type }}"
Without this, the same analysis run once as mvo and once as mvm could clash.
There was a problem hiding this comment.
However, this change causes other problems:
Traceback (most recent call last):
File "/gpfs/fs1/home/ac.xylar/chrysalis/miniforge3/envs/mpas_analysis_dev/bin/mpas_analysis", line 6, in <module>
sys.exit(main())
~~~~^^
File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/develop/mpas_analysis/__main__.py", line 1138, in main
control_config = build_config(control_config_file, shared_configs,
machine_info)
File "/gpfs/fs1/home/ac.xylar/mpas_work/MPAS-Analysis/develop/mpas_analysis/__main__.py", line 870, in build_config
raise OSError(f'A config file {user_config_file} was specified but '
f'the file does not exist')
OSError: A config file /lcrc/group/e3sm/ac.xylar/zppy/mpas_analysis_model_vs_model/v3.LR.historical_0051/post/analysis/mpas_analysis/cfg/mpas_analysis_ts_1985-1995_climo_1990-1995.cfg was specified but the file does not exist
I'm trying to find a solution.
There was a problem hiding this comment.
I have a solution I'm testing now. It involves adding a new config option reference_comparison_type (in most cases left as the default value).
I'm testing now...
This requires having a way for a user to specify whether an external reference run (not defined in a given config file as a subsection) was `mvo` or `mvm` via a new `reference_comparison_type` config option.
|
@forsyth2, I made changes to make sure there are |
|
Great, thanks @xylar I'll try it out now. |
|
@xylar Thanks, this is passing my initial testing (same as above test; expected results will need to be updated of course to use the new dir structure). Unless you want to make more changes, I'll do a visual inspection review and merge if no issues come up. Testing process (just for reference): Set up environments# e3sm_diags, livvkit: don't need to set up env
# mpas_analysis: use existing test-mpas-analysis-develop-20260327
# zi (global_time_series): use existing test-zi-main-20260327zppy run# zppy itself #################################################################
cd ~/ez/zppy
git status
# On branch fix-integration-tests
# nothing to commit, working tree clean
git checkout -b fix-integration-tests-backup20260331
git checkout fix-integration-tests
git fetch upstream fix-integration-tests
git reset --hard upstream/fix-integration-tests
git log --oneline | head -n 8
# b7ef5d01 Update the docs with reference_comparison_type, etc.
# 6492928b Put mpas_analysis runs in mvo or mvm subdirs
# 2857766f Add comparison_type subdir
# 2964b0f5 Add unit tests to ensure correct status filenames
# 91d39e72 Fix mpas_analysis status file names.
# 3f3cadc8 Allow multiple mpas_analysis subsections
# 4f466ab0 Add mpas_analysis_subsection parameter to global_time_series
# c9bd1817 Merge pull request #772 from xylar/add-mpas-analysis-model-vs-model
# Good, matches https://github.com/E3SM-Project/zppy/pull/788/commits
lcrc_conda
rm -rf build
conda clean --all --y
conda env create -f conda/dev.yml -n test-zppy-pr788-20260331
conda activate test-zppy-pr788-20260331
pre-commit run --all-files
python -m pip install .
pytest tests/test_*.py # 42 passed in 0.44s
# Edit tests/integration/utils.py.TEST_SPECIFICS: Dict[str, Any] = {
# These are custom environment_commands for specific tasks.
# Never set these to "", because they will print the line
# `environment_commands = ""` for the corresponding task,
# thus overriding the value set higher up in the cfg.
# That is, there will be no environment set.
# (`environment_commands = ""` only redirects to Unified
# if specified under the [default] task)
"diags_environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
"mpas_analysis_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-mpas-analysis-develop-20260327",
"global_time_series_environment_commands": "source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-zi-main-20260327",
"pcmdi_diags_environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
# This is the environment setup for other tasks.
# Leave as "" to use the latest Unified environment.
"environment_commands": "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh",
# For a complete test, run the set of latest cfgs and at least one set of legacy cfgs
"cfgs_to_run": [
# "weekly_bundles",
# "weekly_comprehensive_v2",
"weekly_comprehensive_v3",
# "weekly_legacy_3.1.0_bundles",
# "weekly_legacy_3.1.0_comprehensive_v2",
# "weekly_legacy_3.1.0_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_pr788_20260331",
}git diff # Diff looks good
python tests/integration/utils.py
# CFG FILES HAVE BEEN GENERATED FROM TEMPLATES WITH THESE SETTINGS:
# UNIQUE_ID=test_pr788_20260331
# diags_environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# mpas_analysis_environment_commands=source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-mpas-analysis-develop-20260327
# global_time_series_environment_commands=source /gpfs/fs1/home/ac.forsyth2/miniforge3/etc/profile.d/conda.sh; conda activate test-zi-main-20260327
# pcmdi_diags_environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# environment_commands=source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh
# Reminder: `environment_commands=''` => the latest E3SM Unified environment will be used
# For reference:
alias sq
# alias sq='sqa -u ac.forsyth2'
alias sqa
# alias sqa='squeue -o "%8u %.7a %.4D %.9P %7i %.2t %.10r %.10M %.10l %j" --sort=P,-t,-p'
sq
# No jobs currently queued
zppy -c tests/integration/generated/test_weekly_comprehensive_v3_chrysalis.cfgReview finished runs### v3 ###
cd /lcrc/group/e3sm/ac.forsyth2/zppy_weekly_comprehensive_v3_output/test_pr788_20260331/v3.LR.historical_0051/post/scripts
grep -v "OK" *status # Good, no errors
Python testscd ~/ez/zppy
git status
# On branch fix-integration-tests
# Good, correct branch
# Env: test-zppy-pr788-20260331
# Good, correct env
ls tests/integration/test_*.py
salloc --nodes=1 --partition=debug --time=02:00:00 --account=e3sm
# We need to reactivate conda now that we're on a compute node
lcrc_conda # Activate conda
conda activate test-zppy-pr788-20260331
pytest tests/integration/test_images.py # 1 failed in 72.66s (0:01:12)
cat test_images_summary.mdOutput: Complete summary table:
Results analysisSummary table -- only failing tests:
The list link is showing missing images because the expected results don't have the comparison subdir in their paths. We can check to make sure the paths are what we now expect them to be: cd /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_weekly_comprehensive_v3_www/test_pr788_20260331/v3.LR.historical_0051/mpas_analysis/
ls
# mvm mvo
ls mvm
# ts_1985-1995_climo_1990-1995_vs_ts_1985-1989_climo_1985-1989
ls mvo
# ts_1985-1989_climo_1985-1989 ts_1985-1995_climo_1990-1995Good, as expected. |
|
I'm good if you are. I'll approve. |
|
|
||
|
|
||
| def _get_identifier( | ||
| def get_mpas_analysis_prefixes(config: ConfigObj) -> Dict[str, List[str]]: |
There was a problem hiding this comment.
This is actually only ever used in global_time_series (and in fact test_get_mpas_analysis_prefixes is in the global_time_series test file). However, I see this requires a lot of functions also used by mpas_analysis itself, so I suppose it's fine to keep this function defined here.
|
I just added one more commit that simply updates the auto-generated file (no other code changes). That will avoid conflicts appearing in #801 (#800, if/when we get to it, would remove any need to worry about conflicts in the auto-generated files). I'm going to go ahead and merge this PR. |

Summary
Objectives:
mainbranch.Select one: This pull request is...
Small Change