Skip to content

add landfrac for icon xpp#3169

Merged
schlunma merged 21 commits into
mainfrom
xpp-landfrac
Jul 17, 2026
Merged

add landfrac for icon xpp#3169
schlunma merged 21 commits into
mainfrom
xpp-landfrac

Conversation

@bettina-gier

@bettina-gier bettina-gier commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Adding land fraction variables to ICON-XPP native reader

Adresses #2695


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.30%. Comparing base (3172e92) to head (a4e992c).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3169      +/-   ##
==========================================
+ Coverage   96.26%   96.30%   +0.03%     
==========================================
  Files         280      280              
  Lines       16258    16252       -6     
==========================================
  Hits        15651    15651              
+ Misses        607      601       -6     

☔ 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@schlunma

Copy link
Copy Markdown
Contributor

I would recommend extending the list of automatically added scalar variables here:

def fix_scalar_coords(self, cube: Cube) -> None:
"""Add missing scalar coordinate to cube (in-place).
Parameters
----------
cube:
Input cube for which missing scalar coordinates will be added
(in-place).
"""
if "height2m" in self.vardef.dimensions:
add_scalar_height_coord(cube, 2.0)
if "height10m" in self.vardef.dimensions:
add_scalar_height_coord(cube, 10.0)
if "lambda550nm" in self.vardef.dimensions:
add_scalar_lambda550nm_coord(cube)
if "typesi" in self.vardef.dimensions:
add_scalar_typesi_coord(cube, "sea_ice")

This way, all variables from all models that use NativeDatasetFix benefit from this fix.

It also looks to me like the metadata you use is slightly different to the CMOR tables. For example, grassFrac expects the dimension typenatgr, which has the following metadata:

"typenatgr": {
"standard_name": "area_type",
"units": "",
"axis": "",
"long_name": "Natural grass area type",
"climatology": "",
"formula": "",
"must_have_bounds": "no",
"out_name": "type",
"positive": "",
"requested": "",
"requested_bounds": "",
"stored_direction": "",
"tolerance": "",
"type": "character",
"valid_max": "",
"valid_min": "",
"value": "natural_grasses",
"z_bounds_factors": "",
"z_factors": "",
"bounds_values": "",
"generic_level_name": ""
},

@schlunma schlunma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tina, looks great! I think we can actually remove lots of code here (see comments). I also think you can re-add the tests you removed, they should work fine!

Comment thread esmvalcore/cmor/_fixes/shared.py Outdated
Comment thread esmvalcore/cmor/_fixes/shared.py Outdated
@bettina-gier

Copy link
Copy Markdown
Contributor Author

Thanks Tina, looks great! I think we can actually remove lots of code here (see comments). I also think you can re-add the tests you removed, they should work fine!

I don't think those tests are necessary anymore since I'm not needing any fixes in ICON-XPP when moving these to the native dataset fixes. So they would just bloat?

@schlunma

Copy link
Copy Markdown
Contributor

I would keep them because otherwise we don't test if the scalar coordinates are actually added (and I'm pretty sure the diff coverage won't be 100%). Having too many tests (if they are cheap!) can't hurt 😉

Comment thread tests/integration/cmor/_fixes/cmip6/test_cesm2.py Outdated
Comment thread tests/integration/cmor/_fixes/cmip6/test_cesm2.py Outdated
bettina-gier and others added 5 commits July 15, 2026 16:58
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
Co-authored-by: Manuel Schlund <32543114+schlunma@users.noreply.github.com>
@schlunma schlunma added this to the v2.16.0 milestone Jul 16, 2026
@schlunma schlunma added the fix for dataset Related to dataset-specific fix files label Jul 16, 2026

@schlunma schlunma left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tina, looks great now! Tested with ICON-XPP data, everything works as expected. 🚀

@schlunma
schlunma merged commit 8da5d56 into main Jul 17, 2026
5 checks passed
@schlunma
schlunma deleted the xpp-landfrac branch July 17, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix for dataset Related to dataset-specific fix files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants