Catch UNSET required file params in EAMxx buildnml at build time#8545
Catch UNSET required file params in EAMxx buildnml at build time#8545ndkeen wants to merge 1 commit into
Conversation
Summary
MotivationSome grid + Details
|
|
|
That's a good idea but I think it's adding to the spaghetti nature of this file, which may need a deeper rework ... |
|
Yes it might be. Should we defer cleanup and add this as-is, or try to clean up now? Note when I try with |
|
Yeah, exactly, and we likely will run into more of these things. Problem is, we have varying conventions and a thorough sweep through the code will be needed to deal with this |
There was a problem hiding this comment.
Pull request overview
This PR improves EAMxx/CIME namelist generation by failing fast during case.build
when a required type="file" (or type="array(file)") parameter remains UNSET
after selector evaluation, which previously could surface later as a confusing PIO
runtime error.
Changes:
- Add a build-time consistency check in
eamxx_buildnml.pythat detects required
file parameters left asUNSETwith no matched selector attributes, and emits
a clear error includingATM_GRIDandnlev. - Introduce an
optional="true"metadata attribute for file parameters where
UNSETis intentional/valid, and treat it as metadata (not a selector). - Mark
iop_fileasoptional="true"innamelist_defaults_eamxx.xml.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| components/eamxx/cime_config/namelist_defaults_eamxx.xml | Marks iop_file as optional so it can remain UNSET without triggering the new required-file check. |
| components/eamxx/cime_config/eamxx_buildnml.py | Adds optional metadata and a post-processing consistency check to catch unmatched required file defaults at build time. |
Add a build-time check in EAMxx buildnml that detects when a required file-type namelist parameter is left UNSET because no entry in namelist_defaults_eamxx.xml matches the current grid and vertical-level combination (e.g. requesting 72 levels on a grid that only has defaults for a different nlev). Previously this surfaced much later as a confusing PIO "no such file" error at run time; it now fails case.build with a clear message naming the parameter, ATM_GRID, and nlev. A new optional="true" metadata attribute lets legitimately-optional file params, such as iop_file outside of DP/IOP runs, opt out of the check.
Fixes #7873
[bfb]