Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The bounded fix matches the stated requirements, includes focused regression coverage, and has no unresolved findings.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes temperature override reporting in the shared unit audit without changing dataset values.
Changes:
- Reports different temperature zero points as
offsetmismatches with reference values. - Updates the schema and documentation while preserving existing sidecar imports.
- Adds core, CLI, and web regression coverage.
| File | Description |
|---|---|
| tests/unit/test_variable_unit_validation.py | Tests offset reporting, scale behavior, and sidecar compatibility. |
| tests/unit/test_variable_unit_interfaces.py | Tests CLI temperature override output. |
| tests/integration/test_inspector_metrics.py | Tests offset reporting through the web route. |
| docs/source/variable_unit_validation.rst | Documents offset mismatches and schema compatibility. |
| docs/source/_static/variable-unit-metadata.schema.json | Allows the offset mismatch kind. |
| aidrin/structured_data_metrics/variable_unit_validation.py | Detects temperature offsets using explicit Pint quantities. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Related Issues / Pull Requests
Closes #275. Follow-up to #258.
Description
Overriding detected units previously treated Celsius-to-Kelvin as a 274.15× scale difference, and the initial offset fix reported only a zero point for Celsius-to-Fahrenheit. The shared audit now reports the complete formula, such as
°F = °C × 1.8 + 32, for any supported Pint scale/offset conversion regardless of the variable name or physical dimension. Multiplicative conversions also show their direction explicitly, such asg/m³ = kg/m³ × 1000.The slope comes from Pint's definitions, avoiding cancellation when an offset is large relative to the scale. Rounded coefficients use
≈; reverse Fahrenheit-to-Celsius reports°C ≈ °F × 0.555556 - 17.7778. Logarithmic/unknown converters, unsupported conversions, and numerically unrepresentable coefficients report that the formula is unavailable instead of claiming a scale or affine relationship.Dataset values and detected observations remain unchanged. Scale mismatches retain their numeric
conversion_factor; offset mismatches and the new genericconversionkind use null. Existing version-1 sidecars remain importable, with unchanged fields and version. Consumers validating against a cached schema must refresh it for the addedoffsetandconversionenum values. Dimension and classification mismatches retain their behavior. The web, CLI, and library share this reporting path.What changes are proposed in this pull request?
Checklist:
Validation
git diff --check: passed.Coverage includes both directions of Celsius/Kelvin and Celsius/Fahrenheit; pressure, speed, density, time, length, and dimensionless scaling; non-temperature offset definitions; small slopes with large offsets; rounding and scientific notation; logarithmic units and their aliases; unavailable conversions and numerical range limits; schema validation, legacy/new sidecar round trips, preserved source values/observations, CLI output, and the web route.