cmip7: skip fill/type checks on CF flag-valued geophysical variables#60
Merged
Ayoubnac1 merged 1 commit intoJul 15, 2026
Merged
Conversation
Closes ESGF#59. CMIP7 region-selector variables (basin, siline, similar) are CF flag- valued integers. The default geophysical_variable.toml rules describe a canonical continuous float field (data_type = float, _FillValue = 1e20, missing_value = 1e20), which cannot express the flag case and cannot be conditionalised in TOML. After ESGF#49 taught the plugin to recognise flag-valued variables as the file's geo var, five HIGH findings still fire on basin fx files: ATTR001 (missing) or ATTR002/ATTR004 (wrong type/constant) for both _FillValue and missing_value, plus VAR005 (int vs float type check). Adds _is_flag_variable(ds, var_name) helper and threads a single is_flag gate through check_Geophysical_Variable: - [variable.type] check skipped for flag variables. - Attribute rules whose attribute_name is _FillValue or missing_value skipped for flag variables. Existence, dimensions, shape, and all other attribute rules still apply. Non-flag variables unchanged. Verified against synthetic reproducer from ESGF#59 (5 -> 0 findings for _FillValue / missing_value / VAR005) and against real AWI-ESM3-4-2-veg- HR piControl 1851 basin fx file.
JanStreffing
marked this pull request as ready for review
July 6, 2026 20:18
Contributor
Author
|
Thanks @Ayoubnac1 for the merge! I confirmed on real data that the 5 basin HIGH we had on cli101 all clear with this change in. Only checker-side blocker left on our side is #62 (@sol1105). Our filename tokens now follow Appendix 1 (midpoint stamps for sub-daily tavg, e.g. 185101010030-185112312330), which the pre-#62 TIME001/TIME003 read as errors because they pull coverage from bnds[-1, 0]. 68 findings clear once #62 lands, and only two mon tpt seaice files remain, waiting on #63. |
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.
Closes #59.
Draft. #59 sketched two directions (TOML side and Python side). This PR implements the Python side. Keeping it draft in case you (as with #56) prefer to handle it TOML side; stand down if so.
Adds
_is_flag_variable(ds, var_name)and threads a singleis_flaggate throughcheck_Geophysical_Variable:[variable.type]check skipped for flag variables.attribute_nameis_FillValueormissing_valueskipped for flag variables.All other checks (existence, dimensions, shape, other attribute rules) still apply. Non-flag variables are unaffected.
Verification
Synthetic reproducer from #59: 5 relevant HIGH → 0.
Before (pre-patch):
After (post-patch): none of these three checks fire on
basin.Also verified against real AWI-ESM3-4-2-veg-HR piControl 1851
basinfx file (same shape).Scope
One file (
plugins/cmip7/cmip7.py). Helper (10 lines) +is_flaglocal + one condition edit + onecontinue. No TOML changes. CMIP6 path untouched.