Skip to content

Make cmip7 variable compatible in moppy ilamb mechanism - #646

Draft
rhaegar325 wants to merge 3 commits into
mainfrom
make_CMIP7_variable_compatible_in_moppy_ilamb_machenism
Draft

Make cmip7 variable compatible in moppy ilamb mechanism#646
rhaegar325 wants to merge 3 commits into
mainfrom
make_CMIP7_variable_compatible_in_moppy_ilamb_machenism

Conversation

@rhaegar325

Copy link
Copy Markdown
Collaborator

Draft

rhaegar325 and others added 2 commits August 24, 2026 16:39
A parametric vertical coordinate's bounds variable needs its own
formula_terms, referencing the bounds of each term. For hybrid-height
variables (cl, cli, clw) lev_bnds carried none, failing the CF-1.11 check:

    §4.3.2: lev_bnds's formula_terms is a required attribute
            and must be a non-empty string

lev itself gets formula_terms by inheritance from the UM source coordinate
(theta_level_height), retargeted to the post-rename names. Its bounds
variable has no attributes in the source, and the CF §7.1 loop in
update_attributes() replaces bounds attrs wholesale from an INHERIT_KEYS
subset that never included formula_terms.

The correct value was already in the coordinate table as z_bounds_factors
("a: lev_bnds b: b_bnds orog: orog"), until now read only to decide which
bounds variables to create. Apply it after the §7.1 loop, which would
otherwise wipe it. Adding formula_terms to INHERIT_KEYS would instead copy
the parent's "a: lev b: b orog: orog", which points at the coordinates
rather than their bounds and is equally non-compliant.

Skipped when z_bounds_factors is empty (hybrid_height_half) or when any
referenced variable is absent, so no dangling reference is written.

Verified end to end on cl: §4.3 Vertical Coordinate goes from [5, 6] with
the message above to [10, 10] clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rhaegar325
rhaegar325 marked this pull request as draft August 24, 2026 12:49
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.07042% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.6%. Comparing base (3ccc6ca) to head (96ab68f).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/access_moppy/utilities.py 96.2% 2 Missing and 3 partials ⚠️
src/access_moppy/batch_cmoriser.py 33.3% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main    #646     +/-   ##
=======================================
+ Coverage   77.2%   77.6%   +0.3%     
=======================================
  Files         40      40             
  Lines       8514    8632    +118     
  Branches    1590    1624     +34     
=======================================
+ Hits        6575    6695    +120     
+ Misses      1610    1602      -8     
- Partials     329     335      +6     
Flag Coverage Δ
unit 77.6% <95.1%> (+0.3%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rbeucher rbeucher changed the title Make cmip7 variable compatible in moppy ilamb machenism Make cmip7 variable compatible in moppy ilamb mechanism Aug 24, 2026
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