Skip to content

cmip7: restore flag-variable handling dropped by d82d1cf - #70

Closed
JanStreffing wants to merge 1 commit into
ESGF:developfrom
JanStreffing:fix/restore-cmip7-flag-variable-handling
Closed

cmip7: restore flag-variable handling dropped by d82d1cf#70
JanStreffing wants to merge 1 commit into
ESGF:developfrom
JanStreffing:fix/restore-cmip7-flag-variable-handling

Conversation

@JanStreffing

Copy link
Copy Markdown
Contributor

Fixes #66. This is the single restoring PR I offered there; going ahead with it since it is mechanical and only re-applies previously reviewed code. Happy to convert it to a revert of the relevant hunks instead if you prefer that shape.

d82d1cf ("Improve and Fix Checks", 19 Jul) rewrote plugins/cmip7/cmip7.py from a base predating #49 and #60, so both merged fixes were removed rather than rebased. v2.3.3 was cut two days later and its release notes credit both by name, but neither is actually in the tag:

ref _is_flag_variable
v2.3.2 absent
v2.3.3 absent (release notes claim it)
v2.3.4 absent
develop absent
master absent

What this restores

Both hunks are byte-identical to what was reviewed and merged.

#49variable_id fallback in the len(geo_vars) == 0 branch of _get_geo_var. compliance-checker's is_geophysical excludes anything carrying flag_meanings, which is right for QC flags but wrong for CMIP7 region selectors (basin, siline), whose standard_name is region and which are the file's data variable by design. Without the fallback those files report No geophysical variable detected in the file. at HIGH, which is #48 exactly as originally filed.

#60 — the _is_flag_variable helper and the is_flag gate on the [variable.type] check and the _FillValue / missing_value attribute rules. Without it flag-valued variables are checked against data_type = "float" and constant = 1.0e20, which no integer variable can satisfy.

Existence, dimensions, shape and every other attribute rule still apply. Non-flag variables are unchanged.

Verification

Against a real CMIP7 basin fx file (AWI-ESM3-4-2-veg-HR piControl, int32 with flag_values / flag_meanings, variable_id = "basin"):

develop            geo var = None      1 HIGH: "No geophysical variable detected in the file."
this branch        geo var = 'basin'   0 findings

The synthetic reproducer in #59 still covers both paths.

Note

It is worth checking whether anything else merged between 5a327f0 and d82d1cf went the same way. I only looked at the two changes that affect our files.

Re-applies the two hunks from ESGF#49 and ESGF#60, both merged and both absent
from develop, master and every release since v2.3.2.

d82d1cf ("Improve and Fix Checks", 19 Jul) rewrote plugins/cmip7/cmip7.py
from a base predating both PRs, so the changes were removed rather than
rebased. v2.3.3 was cut two days later and its release notes credit both
fixes, but neither is in the tag:

    v2.3.2  _is_flag_variable  absent
    v2.3.3  _is_flag_variable  absent   <- release notes claim it
    v2.3.4  _is_flag_variable  absent
    develop / master           absent

Restored, byte-identical to what was reviewed and merged:

  ESGF#49  variable_id fallback in the len(geo_vars) == 0 branch of
       _get_geo_var. Without it any file whose data variable is CF
       flag-valued reports "No geophysical variable detected in the
       file." at HIGH, which is issue ESGF#48 as originally filed.

  ESGF#60  _is_flag_variable helper plus the is_flag gate on the
       [variable.type] check and the _FillValue / missing_value
       attribute rules. Without it flag-valued variables are checked
       against data_type = "float" and constant = 1.0e20, which no
       integer variable can satisfy.

Verified on a real CMIP7 basin fx file (AWI-ESM3-4-2-veg-HR piControl):

  develop   geo var = None    1 HIGH  "No geophysical variable detected"
  this      geo var = 'basin' 0 findings

Existence, dimensions, shape and all other attribute rules still apply.
Non-flag variables are unchanged.

Closes ESGF#66.
@JanStreffing

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate of #67, which I missed before opening this. #67 does everything here and more: it also restores 8bd1699 (TIME001 subdaily) and adds dec. Sorry for the noise.

Moving my verification over to #67 so it is not lost.

@JanStreffing
JanStreffing deleted the fix/restore-cmip7-flag-variable-handling branch August 13, 2026 14:55
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.

1 participant