Skip to content

Fix two unmasked bugs in oceanBgchem derivations - #729

Merged
rhaegar325 merged 3 commits into
mainfrom
fix/bgc-derivation-ops
Sep 22, 2026
Merged

rhaegar325 merged 3 commits into
mainfrom
fix/bgc-derivation-ops

Conversation

@rhaegar325

Copy link
Copy Markdown
Collaborator

Bugs

1. ph — KeyError: 'log10'

The ph mapping uses {"operation": "log10", "args": ["htotal"]}, but log10
was never registered in custom_functions.

2. intdic / intppnitrate — KeyError: 'st_ocean'

evaluate_expression evaluates kwargs values recursively, and a bare string
is a variable lookup (context[expr]). So "kwargs": {"dim": "st_ocean"} looks
for a model variable named st_ocean instead of passing the dimension name.
Constants must be wrapped as {"literal": "..."} — the convention already used
by ocontempmint, somint, mrso and mrfso.

Four entries were written with the bare form before that convention existed:
ocean.hfsifrazil2d, intdic, intpoc, intppnitrate (in both ESM1-5 and
ESM1-6).

Changes

  • Register log10 in custom_functions.
  • Wrap all 8 bare-string dim kwargs as {"literal": "st_ocean"}.
  • Raise a KeyError that names the available model variables and suggests the
    {"literal": ...} form, instead of the bare 'st_ocean'.
  • Add TestMappingKwargsAreResolvable: every string-valued kwarg in every
    mapping file must name a model variable or a registered function.

@codecov

codecov Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.7%. Comparing base (becf94e) to head (05842fa).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #729   +/-   ##
=====================================
  Coverage   79.7%   79.7%           
=====================================
  Files         41      41           
  Lines       9162    9167    +5     
  Branches    1707    1707           
=====================================
+ Hits        7301    7306    +5     
  Misses      1526    1526           
  Partials     335     335           
Flag Coverage Δ
unit 79.7% <100.0%> (+<0.1%) ⬆️

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.

@rhaegar325
rhaegar325 merged commit c8293ff into main Sep 22, 2026
4 checks passed
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