Skip to content

Basic infrastructure#195

Draft
MircoValentiniECMWF wants to merge 2 commits intodevelopfrom
feature/mars2grib-handle-mars-iteration
Draft

Basic infrastructure#195
MircoValentiniECMWF wants to merge 2 commits intodevelopfrom
feature/mars2grib-handle-mars-iteration

Conversation

@MircoValentiniECMWF
Copy link
Copy Markdown
Contributor

Description

Add support for mars.iteration and localSectionNumber=[20,38]

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
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.06061% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.84%. Comparing base (480f612) to head (533ea9a).

Files with missing lines Patch % Lines
...rib/backend/concepts/iteration/iterationEncoding.h 0.00% 11 Missing ⚠️
...2grib/backend/deductions/totalNumberOfIterations.h 0.00% 10 Missing ⚠️
...kit/mars2grib/backend/deductions/iterationNumber.h 0.00% 7 Missing ⚠️
...2grib/backend/concepts/analysis/analysisEncoding.h 0.00% 1 Missing ⚠️
...rs2grib/backend/concepts/iteration/iterationEnum.h 0.00% 1 Missing ⚠️
...grib/backend/concepts/iteration/iterationMatcher.h 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #195      +/-   ##
===========================================
- Coverage    61.99%   61.84%   -0.16%     
===========================================
  Files          303      308       +5     
  Lines        11663    11695      +32     
  Branches      1048     1050       +2     
===========================================
+ Hits          7231     7233       +2     
- Misses        4432     4462      +30     

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds backend/frontend wiring to support mars.iteration and Local Use Section templates with local definition numbers 20 and 38 in the mars2grib encoder.

Changes:

  • Added a new backend iteration concept (matcher, enum, concept descriptor, encoding op) and supporting deductions.
  • Extended Section 2 template recipes to include new templates 20 and 38 and select the new concept accordingly.
  • Updated analysis concept validation to also allow local definition number 38.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/metkit/mars2grib/frontend/resolution/section-recipes/impl/section2Recipes.h Adds Section 2 recipes for templates 20 and 38, enabling IterationConcept selection.
src/metkit/mars2grib/backend/deductions/totalNumberOfIterations.h New deduction for totalNumberOfIterations (currently has a confirmed hours→seconds conversion bug + log formatting issue).
src/metkit/mars2grib/backend/deductions/iterationNumber.h New deduction for iterationNumber (Doxygen description currently mismatched).
src/metkit/mars2grib/backend/concepts/iteration/iterationMatcher.h Activates the iteration concept when mars["iteration"] is present.
src/metkit/mars2grib/backend/concepts/iteration/iterationEnum.h Defines iteration concept variant metadata.
src/metkit/mars2grib/backend/concepts/iteration/iterationEncoding.h Implements IterationOp to set iterationNumber / totalNumberOfIterations for LDN 20/38 (Doxygen description currently mismatched).
src/metkit/mars2grib/backend/concepts/iteration/iterationConceptDescriptor.h Registers the new iteration concept into the compile-time registry.
src/metkit/mars2grib/backend/concepts/analysis/analysisEncoding.h Allows analysis concept to run for LDN 38 in addition to 36.
src/metkit/mars2grib/backend/concepts/AllConcepts.h Registers IterationConcept in the global concept list.

Documentation sync (per mars2grib doc locations):

  • Impacted files under src/metkit/mars2grib/**: the 9 files listed above.
  • src/metkit/mars2grib/docs/**: ✅ in sync (no existing doc sections found that enumerate these specific templates/keys).
  • In-code Doxygen docs for the new iteration pieces: ❌ outdated (see PR comments on iterationEncoding.h, iterationNumber.h, totalNumberOfIterations.h).

// Emit RESOLVE log entry
MARS2GRIB_LOG_RESOLVE([&]() {
std::string logMsg = "`totalNumberOfIterations` resolved from input dictionaries: value='";
logMsg += std::to_string(totalNumberOfIterationsVal);
Comment on lines +136 to +146
long totalNumberOfIterationsVal = get_or_throw<long>(par, "totalNumberOfIterations");

// Emit RESOLVE log entry
MARS2GRIB_LOG_RESOLVE([&]() {
std::string logMsg = "`totalNumberOfIterations` resolved from input dictionaries: value='";
logMsg += std::to_string(totalNumberOfIterationsVal);
return logMsg;
}());

// Success exit point
return {totalNumberOfIterationsVal}; // Convert hours to seconds
Comment on lines +12 to +17
/// @file iterationNumber.h
/// @brief Deduction of the offset to the end of the 4D-Var analysis window.
///
/// This header defines deduction utilities used by the mars2grib backend
/// to resolve the **offset to the end of the 4D-Var assimilation window**
/// from input dictionaries.
Comment on lines +18 to +23
/// The iteration concept is responsible for encoding GRIB keys associated with
/// *long-range forecast metadata* stored in the Local Use Section, specifically:
///
/// - `methodNumber`
/// - `systemNumber`
///
/// @param[in] par Parameter dictionary
/// @param[in] opt Options dictionary (unused)
///
/// @return The length of time window in seconds. If `par::totalNumberOfIterations` is missing,
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.

3 participants