Skip to content

cmip7: skip fill/type checks on CF flag-valued geophysical variables#60

Merged
Ayoubnac1 merged 1 commit into
ESGF:developfrom
JanStreffing:fix/flag-vars-skip-fill-checks
Jul 15, 2026
Merged

cmip7: skip fill/type checks on CF flag-valued geophysical variables#60
Ayoubnac1 merged 1 commit into
ESGF:developfrom
JanStreffing:fix/flag-vars-skip-fill-checks

Conversation

@JanStreffing

Copy link
Copy Markdown
Contributor

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 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.

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):

[ATTR001] Variable 'basin' attribute '_FillValue' existence
* Required variable 'basin' attribute '_FillValue' is missing.
[ATTR001] Variable 'basin' attribute 'missing_value' existence
* Required variable 'basin' attribute 'missing_value' is missing.
[VAR005] Variable Type Check: 'basin'

After (post-patch): none of these three checks fire on basin.

Also verified against real AWI-ESM3-4-2-veg-HR piControl 1851 basin fx file (same shape).

Scope

One file (plugins/cmip7/cmip7.py). Helper (10 lines) + is_flag local + one condition edit + one continue. No TOML changes. CMIP6 path untouched.

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
JanStreffing marked this pull request as ready for review July 6, 2026 20:18
@Ayoubnac1
Ayoubnac1 merged commit cecbe5f into ESGF:develop Jul 15, 2026
@JanStreffing

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants