Skip to content

Increase flexibility for multi-model ensembles, add REFS config file#38

Draft
mkavulich wants to merge 43 commits into
developfrom
feature/increase_flexibility
Draft

Increase flexibility for multi-model ensembles, add REFS config file#38
mkavulich wants to merge 43 commits into
developfrom
feature/increase_flexibility

Conversation

@mkavulich

Copy link
Copy Markdown
Collaborator

DESCRIPTION OF CHANGES:

NOTE: This PR is in draft mode because it contains the changes from #33, and should not be merged until after that one is merged.
You can view the changes for only this PR here: feature/pythonize_remaining_bash...feature/increase_flexibility

This PR represents the first round of changes needed for REFS ensemble experiments. The major changes are:

  1. The forecast filename variable FCST_FN_TEMPLATE is now a list of files rather than a string. A string is still accepted in the config file for simplicity and back-compatibility.
  • To simplify this change, all ensemble indices are now 0-indexed, and the FCST_SUBDIR_TEMPLATE variable is deprecated (any subdirectories needed here can be specified as part of FCST_FN_TEMPLATE).
  1. The verify_pre.yaml taskgroup is split into two
    • get_obs.yaml, which contains all of the obs-pulling tasks
    • preprocessing.yaml, which contains the remainder of the preprocessing tasks
      This allows users to easily just pull the observations they need without running any more tasks
  2. pb2nc, as well as "Ensemble" GridStat and PointStat tasks now have their own dedicated config section, and can be parallelized
  3. A new section conf: is added to the GenEnsProd task; this allows the user to specify exact lines to add to a METplus conf file
  • An example of its use can be found in the new
  • This should eventually be added for all tasks
  1. A new ush/configs subdirectory is created, which should be used to stage config files used for DTC experiments. I included a "first attempt" REFS config file as ush/configs/SFE_2026_ensembles/config.firsttest.yaml, that is not perfect but serves as a proof of concept

Some other minor improvements are also included:

  1. The maxtries variable is now configurable for tasks that have their own config section. The default is changed to 1 for all of these tasks as well
  2. OpenMP threading can now be set in the config file for MODE, GenEnsProd, and EnsembleStat. We should eventually do an inventory of which METplus tasks support threading and add this functionality for all of them.
  3. To avoid file conflict errors, parallelized tasks such as GenEnsProd are now given a dedicated "staging" directory for each task
  4. select_validtime_obs.py no longer raises an exception when a missing file is encountered; this should be handed in get_obs.py according to the NUM_MISSING_OBS_FILES_MAX setting.
  5. The default delay between calls to rocotorun is reduced from 5 seconds to 1 second (except for Derecho which still requires an extended delay due to cacheing of job statuses)
  6. Some deprecated settings (RUN_CMD_FCST, RUN_CMD_POST, RUN_CMD_PRDGEN, RUN_CMD_SERIAL, RUN_CMD_UTILS, and PRE_TASK_CMDS ) are removed from config_defaults.yaml and the machine files, and one missing one from the machine files (SCHED_NATIVE_CMD_HPSS) is added to config_defaults.yaml
  7. VERBOSE is now false by default
  8. NUM_ENS_MEMBERS must now always be a positive integer (1 for deterministic runs, default)
  9. Unnecessary and deprecated Python functions uppercase() and lowercase() are removed

Type of change

  • Bug fix
  • New feature
  • Breaking change (all config changes have a descriptive error check in setup.py)
    • Any config files that specify the taskgroups must update verify_pre.yaml to get_obs.yaml and preprocessing.yaml
    • Any config files that previously used FCST_SUBDIR_TEMPLATE must instead prepend that value to FCST_FN_TEMPLATE.

TESTS CONDUCTED:

Regression testing using #33 as a baseline showed no changes in WE2E tests.

  • derecho
  • hera
  • hercules
  • orion
  • ursa
  • other (describe)

DEPENDENCIES:

DOCUMENTATION:

Will be handled later, tracked in #4

ISSUE:

mkavulich and others added 30 commits July 17, 2026 17:36
Converts all four remaining shell scripts in scripts/ to Python,
completing the bash-to-Python migration:

- check_post_output.py: calls set_leadhrs() to verify post-processed
  forecast output files exist within the allowed missing-file threshold
- gridstat_or_pointstat_ensmean.py: GridStat/PointStat on ensemble mean
  output from GenEnsProd
- gridstat_or_pointstat_ensprob.py: GridStat/PointStat on ensemble
  probability output from GenEnsProd
- genensprod_or_ensemblestat.py: GenEnsProd or EnsembleStat with
  per-member forecast template list; GenEnsProd skips obs file check
- pcpcombine.py: PcpCombine for FCST or OBS with double set_leadhrs
  call pattern; includes PM2.5/PM10 USER_DEFINED combine logic for AIRNOW

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
grep -q exits immediately on first match, closing the pipe before
conda env list finishes writing. Conda's Python runtime catches the
resulting SIGPIPE and prints a noisy error report to stderr. Adding
2>/dev/null suppresses it without affecting the grep result or exit code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s requires a string-subst dictionary

in check_post_output.py; should be able to get rid of this logic in all scripts by the end.
 - Convert ENS_TIME_LAG_HRS to a true Python list. This removes need for strange "literal_eval" logic in gridstat_or_pointstat.py
…e an ensemble member index and some don't,

so we need to add this as another optional variable to set_job_env.sh
…tion: section with tasks_per_node, walltime, and memory, as well as a TASKS: variable. Update some WE2E tests to use more parallelism
…execution: section with tasks_per_node, walltime, and memory, as well as a TASKS: variable, and apply memory and task settings to workflow definition file'
…_dir_file(), check_var_valid_value(), get_elem_inds(), is_element_of(), print_input_args(), and process_args()
…ENSMEM_NAMES which it turns out is deprecated!
…l simplify a lot of logic with the use of a list of filenames

This commit also prepares to deprecate FCST_SUBDIR_TEMPLATE; this will also simplify logic
mkavulich added 13 commits July 19, 2026 22:26
…s to add lines directly to that task's conf file.

This is only for genensprod for now, but should be expanded to all tasks once every task has its own config section

Additionally, more QOL improvements for REFS experiment:

 - Make OMP_NUM_THREADS configurable for MODE, GenEnsProd, and EnsembleStat
 - New task-specific section for pb2nc, make tasks and memory configurable; PB2NC now parallelized
 - Add VX_TASKS parallelism for gridstat_or_pointstat_ensmean.py and gridstat_or_pointstat_ensprob.py;
   need to add task-specific sections for these scripts in the future!
 - Split out all "get_obs" tasks into their own taskgroup file. verify_pre.yaml is now split into get_obs.yaml and preprocessing.yaml
 - Remove taskgroups: definition from WE2E tests (except for MET_verification_only_vx, just to catch any future changes)
 - Create new sections for ensemble gridstat and pointstat tasks
 - Remove premature KeyError from config checks
…he "NUM_MISSING_OBS_FILES_MAX" functionality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant