cmip7: prefer variant variable term over root for ATTR004 long_name#47
Open
JanStreffing wants to merge 1 commit into
Open
cmip7: prefer variant variable term over root for ATTR004 long_name#47JanStreffing wants to merge 1 commit into
JanStreffing wants to merge 1 commit into
Conversation
several CMIP7 variables have tile-specific or operation-specific variants in the WCRP-universe 'variable' data descriptor (cveggrass, cvegshrub, cvegtree; hursmin, hursmax, tasmincrop; gpp/npp/ra/rh × grass/shrub/tree; ...). all variants share the same root variable_id (e.g. variable_id="cVeg" for all four cVeg variants). the current lookup picks the bare root term, so a file with the per-variant long_name fails the ATTR004 registry expected-term check against the root's long_name on every non-matching variant. after the WCRP-universe registry fix (#190 / #191) populates per-variant long_names and generalizes the root long_name, this plugin still needs to pick the right candidate. take the variant whose registered long_name matches the file's long_name, fall back to the root if no variant matches. same single-value comparison semantics for the check, the resolution just picks the right term. no test infra changes; the existing ATTR004 path covers both branches.
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.
Sister fix for WCRP-CMIP/WCRP-universe#191.
Several CMIP7 variables have tile-specific or operation-specific variants in the
variabledata descriptor (cveggrass/cvegshrub/cvegtree,hursmin/hursmax/tasmincrop,gpp/npp/ra/rh×grass/shrub/tree, ...). All variants share the samevariable_idglobal attr (e.g.variable_id = "cVeg"for all four cVeg variants).The current lookup in
plugins/cmip7/cmip7.pypicks the bare root term:After WCRP-universe#191 generalizes the root's
long_nameand populates per-variantlong_names oncveggrass/cvegshrub/cvegtree(etc.), this plugin still needs to pick the right candidate. Picking the root means the ATTR004 long_name check emits a MEDIUM finding on every non-root variant because the file's variant-specific long_name doesn't match the generic root. ATTR004 long_name is advisory per CMIP7 guidance (see WCRP-universe#190 discussion), so this PR is accuracy of the warning rather than a publication unblock.This PR takes the variant whose registered
long_namematches the file'slong_nameattr, and falls back to the root term if no variant matches. Single-value comparison semantics for the check stay the same. The resolution just picks the right term.No test infra changes. The existing ATTR004 path covers both branches.