Skip to content

Support hybrid level coefficients#1016

Merged
sandorkertesz merged 2 commits into
developfrom
feature/hybrid-level-coeff
Jun 11, 2026
Merged

Support hybrid level coefficients#1016
sandorkertesz merged 2 commits into
developfrom
feature/hybrid-level-coeff

Conversation

@sandorkertesz

@sandorkertesz sandorkertesz commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds the following keys/methods to vertical. These keys only have values for parametric level types, to date "hybrid" is the only one.

  • number_of_levels
  • coefficients
  • coefficient_names
  • parametric

Key coefficients can be set (and encoded into GRIB2) the others are read-only.

import earthkit.data as ekd
fl = ekd.from_source("file", "ml_data.grib").to_fieldlist()
f = fl[0]

f.vertical.number_of_levels() # 137
f.vertical.coefficients() # tuple of A and B coeff
f.vertical.coefficient_names() # ("A", "B")
f.vertical.parametric() # True

TODO:

  • documentation
  • examples
  • writing to GRIB1 (if needed)
  • serialisation

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@codecov-commenter

codecov-commenter commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.52941% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.71%. Comparing base (7482120) to head (2367baa).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
tests/grib/test_grib_set_vertical.py 96.82% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1016      +/-   ##
===========================================
+ Coverage    81.57%   81.71%   +0.14%     
===========================================
  Files          236      236              
  Lines        15803    15935     +132     
  Branches       763      768       +5     
===========================================
+ Hits         12892    13022     +130     
- Misses        2686     2687       +1     
- Partials       225      226       +1     

☔ 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.

@sandorkertesz sandorkertesz merged commit 8def593 into develop Jun 11, 2026
115 of 116 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