Coordinate validation against the CMOR tables - #64
Draft
swarnaleem wants to merge 6 commits into
Draft
Conversation
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.
Coordinate validation against the CMOR tables
This PR adds coordinate validation based on the CMOR tables. The checker already downloads the coordinate, grids and formula_terms tables but never uses them to validate coordinates. This new coordinate engine classifies each coordinate in a file, finds the matching table entry, and reports any differences (missing bounds, wrong units, wrong values, and so on).
What's included
plugins/coordinate_standard/: the engine as a small package (model,rules,classify,providers,matching,report). Key mechanism: a standard_name only gives the role (air_pressureis plev8/plev19/plev39 at once), so the exact table entry is pinned by comparing file values against each entry'srequestedlist within the tabletolerance.checks/coordinate_checks/check_coordinates.py: the compliance-checker (COORD001). Soft findings (e.g. convertible but non-identical units) pass the check but are reported as LOW-severity advisories, and an error while checking one coordinate fails only that coordinate instead of crashing the whole run.checks/coordinate_checks/classify_file.pyandbuild_standard.py: standalone CLIs (exit code = FAIL count), plus table snapshots for CMIP6/CMIP7/CORDEX-CMIP6 so they run self-contained.tests/test_cf_vocab.py: guards the cf-xarray vocabulary keys and spellings the classifier relies on, so a dependency bump that changes them fails in CI.Design principles
stored_direction); coordinates that already have a TOML monotonicity rule are skipped viaskip_direction_for, so nothing is checked twice. Missing coordinate variables are reported through the existing [VAR001]. Bounds shape and values remain with [VAR004]/[VAR012]. What the engine itself checks is: which table entry a coordinate is, and whether itsattributes and values agree with that entry (units, positive, bounds presence, rank, valid range, prescribed values).
CmorTableProvidertoday;EsgvocProvideris a stub until esgvoc releases value-level coordinate metadata.Try it