Constituent- and index-dimensioned fields for read and check physics data#521
Open
jimmielin wants to merge 5 commits into
Open
Constituent- and index-dimensioned fields for read and check physics data#521jimmielin wants to merge 5 commits into
jimmielin wants to merge 5 commits into
Conversation
jimmielin
had a problem deploying
to
CI-tests-on-CIRRUS
July 13, 2026 17:45 — with
GitHub Actions
Error
write_init_files already emits the generic read_constituent_dimensioned_field call with a vertical coordinate for (horizontal, vertical, constituent) registry variables, but the interface only carried the (horizontal, constituent) specific, so such a variable generated a call with no matching specific and could not compile. Add read_constituent_dimensioned_field_3d as a sibling of the 2-D specific. Each constituent row is read from its own <base_name>_<constituent> file variable (e.g. aerochem_vmr_bc_a1); rows with no matching file variable are left at their initial value, since a capture only writes the species the source model carries. Standard names are case-insensitive, so the registry lookup compares them with to_lower: a constituent declared with authored case (e.g. 'CO2') is normalized to lowercase by capgen on the scheme side, and a case-sensitive compare would miss the registry row and silently read nothing.
… fields. Constituent-dimensioned registry variables were skipped entirely by physics_check_data, so they were silently absent from the check output. Add check_constituent_dimensioned_field (the (horizontal, vertical, constituent) specific) and emit the call for such variables, mirroring the read_constituent_dimensioned_field path; the registry lookup is case-insensitive for the same reason. Each constituent row is checked against its own <base_name>_<constituent> file variable; rows with no matching file variable are skipped. The (horizontal, constituent) case is not implemented yet and is still skipped. const_props is hoisted above the suite loop, since the check calls inside the loop now need it. The test registry gains a vertically-resolved constituent-dimensioned variable (cool_cat_3d_for_each_const) exercising both the read and the check path.
…les. A (horizontal, fixed-size extra dimension) registry variable cannot be captured as a single snapshot/history variable, so such fields are written out as numbered per-slice variables (e.g. <base>1 ... <base>N). Add read_indexed_dimensioned_field, a sibling of read_constituent_dimensioned_field keyed by slice index instead of constituent name, and teach write_init_files to emit it for 2-D variables whose second dimension is neither vertical nor the constituent dimension. The ic_file_input_names of such variables are therefore name PREFIXES; the slice index is appended by the reader. physics_check_data skips these variables (read-only inputs), mirroring the 2-D constituent skip. The (horizontal, band_number) variable in the bad-vertical-dimension test is now a supported shape and generates a read call.
…ical dimension. physics_check_data skipped registry variables with a constituent dimension but no vertical dimension, because check_constituent_dimensioned_field only implemented the vertically-resolved case; constituent surface fluxes (cam_in%cflx) were therefore silently absent from the check output. Add the (horizontal, constituent) specific, mirroring the vertically-resolved one the same way the read_constituent_dimensioned_field pair does, and emit the check call for such variables. Each constituent row is checked against <base_name>_<constituent> file variables (e.g. cam_in_cflx_dst_a1); rows without a matching file variable are skipped, since a capture only writes the species the source model carries.
The routines added by this branch were written before sima0_16_001 and built a single '<base>_<cname>' candidate per lookup. netCDF variable names are case-sensitive, while a constituent not enumerated in the registry derives its name from its standard name and arrives lowercased from capgen, so an uppercase snapshot field (e.g. aerochem_vmr_CO2) was never matched: - read_constituent_dimensioned_field_3d: the field fell back to its default silently, the failure mode sima0_16_001 fixed for the 2-D analog. - check_constituent_dimensioned_field_2d/3d: worse - the row is skipped as 'not on the check file', so a suite can report b4b without ever having compared those constituents. All lookups now go through constituent_dim_file_var_names. file_var_name is dropped from the two check routines, which report under found_name and so had no remaining use for it; the read routines still build it for reporting. read_indexed_dimensioned_field is unaffected: it names slices by integer index.
jimmielin
force-pushed
the
hplin/snapshot_dimensioned_fields
branch
from
July 22, 2026 15:50
832125a to
6012e9e
Compare
jimmielin
had a problem deploying
to
CI-tests-on-CIRRUS
July 22, 2026 15:51 — with
GitHub Actions
Error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tag name (required for release branches):
Originator(s): @jimmielin
AI tools used (if applicable; please also add the "AI-generated code" label to the PR):
What: claude-fable:5, claude-opus:4.8
How: drafted the fix
Description (include the issue title, and the keyword ['closes', 'fixes', 'resolves'] followed by the issue number):
Describe any changes made to build system: autogen changes
Describe any changes made to the namelist:
List any changes to the defaults for the input datasets (e.g. boundary datasets):
List all files eliminated and why:
List all files added and what they do:
List all existing files that have been modified, and describe the changes:
(Helpful git command:
git diff --name-status development...<your_branch_name>)If there are new failures (compared to the
test/existing-test-failures.txtfile),have them OK'd by the gatekeeper, note them here, and add them to the file.
If there are baseline differences, include the test and the reason for the
diff. What is the nature of the change? Roundoff?
derecho/intel/aux_sima:
derecho/gnu/aux_sima:
derecho/nvhpc/aux_sima (test is run via Github workflow. Only run the test manually if we need to save new baselines):
If this changes climate describe any run(s) done to evaluate the new
climate in enough detail that it(they) could be reproduced:
CAM-SIMA date used for the baseline comparison tests if different than latest: