Skip to content

Fix WCRP Geophysical Variable Detection + time bounds for sea-ice (SImon/SIday)#404

Merged
rbeucher merged 2 commits into
mainfrom
fix_sea_ice_format_issue
May 28, 2026
Merged

Fix WCRP Geophysical Variable Detection + time bounds for sea-ice (SImon/SIday)#404
rbeucher merged 2 commits into
mainfrom
fix_sea_ice_format_issue

Conversation

@rhaegar325
Copy link
Copy Markdown
Collaborator

Summary

Sea-ice CMORisation applied only half of its curvilinear-grid transformation:
the data variable stayed on the model (nj, ni) dimensions while the supergrid
coordinates were built on (j, i), leaving orphaned lat/lon variables that
the WCRP wcrp_cmip6:1.0 Geophysical Variable Detection check counted as
data variables. The CICE time-bounds variable was also dropped, leaving a
dangling time:bounds reference.

Problem

Expected exactly 1 geophysical variable, found 3: ['lat', 'lon', 'siconc']

Three coupled causes:

  1. Dimension rename dropped. seaice_dim_rename = {ni:i, nj:j, ...}, but the
    filter if k in self.ds keeps only variables. ni/nj are pure
    dimensions (no coordinate variable), so the rename was discarded and siconc
    stayed on (time, nj, ni).
  2. Orphaned model lat/lon. The mapping renames TLAT/TLON -> lat/lon; these
    2-D variables have no standard_name and were left behind on (nj, ni),
    redundant with the supergrid latitude/longitude on (j, i).
  3. Stale / missing time bounds. CICE writes time:bounds = "time_bounds"
    (variable time_bounds on dim d2), but the bounds machinery expects
    time_bnds, so time_bounds was never loaded and the reference dangled.

Fix (sea_ice.py)

  • Rename pure dimensions too: if k in self.ds or k in self.ds.dims, so
    ni->i / nj->j apply and siconc becomes (time, j, i), aligned with the
    supergrid.
  • Drop the redundant model lat/lon in update_attributes and set the
    data variable's coordinates = "latitude longitude" (clearing the stale
    "TLON TLAT time").
  • Normalise the time bounds (_normalise_time_bounds): follow time:bounds
    to the real variable, rename it to time_bnds and its non-time dim to bnds,
    and add time_bounds to the load set so it is not discarded.

Files changed

File Change
src/access_moppy/sea_ice.py dim-rename filter, drop model lat/lon, set coordinates, _normalise_time_bounds (+52/-2)
tests/unit/test_sea_ice.py 5 new tests (+165)

@codecov
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.0%. Comparing base (85df727) to head (95d4dd2).

Additional details and impacted files
@@           Coverage Diff           @@
##            main    #404     +/-   ##
=======================================
+ Coverage   74.9%   75.0%   +0.1%     
=======================================
  Files         28      28             
  Lines       5246    5265     +19     
  Branches     963     968      +5     
=======================================
+ Hits        3929    3950     +21     
+ Misses      1092    1091      -1     
+ Partials     225     224      -1     
Flag Coverage Δ
unit 75.0% <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 Sentry.
📢 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 requested a review from rbeucher May 28, 2026 00:49
@rbeucher rbeucher merged commit 5fa3b37 into main May 28, 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.

2 participants