Skip to content

Feature/mars2grib era6 reencoding support#207

Open
MircoValentiniECMWF wants to merge 10 commits into
developfrom
feature/mars2grib-era6-reencoding-support
Open

Feature/mars2grib era6 reencoding support#207
MircoValentiniECMWF wants to merge 10 commits into
developfrom
feature/mars2grib-era6-reencoding-support

Conversation

@MircoValentiniECMWF
Copy link
Copy Markdown
Contributor

Description

Add support for new parameters and new concepts needed by ERA6

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.

- Add new iteration concept under backend/concepts/iteration/ following the standard 4-file layout (Enum, Matcher, Encoding, ConceptDescriptor); single Default variant, applicable at (StagePreset, SecLocalUseSection), with LocalDefinitionNumber allow-list {20, 38}; encoder sets iterationNumber and (optionally) totalNumberOfIterations.
- Add the supporting deductions backend/deductions/iterationNumber.h (resolve_IterationNumber_or_throw) and backend/deductions/totalNumberOfIterations.h (resolve_TotalNumberOfIterations_opt) used by IterationOp.
- Register IterationConcept in AllConcepts.h: include added alphabetically between generating-process and level; type appended to the AllConcepts typelist after LongrangeConcept.
- Implement iterationMatcher: returns IterationType::Default when mars has the "iteration" key, MISSING otherwise.
- Extend analysisEncoding.h LocalDefinitionNumber allow-list from {36} to {36, 38} so AnalysisOp accepts the new combined template 38 (4i analysis products).
- Add Section 2 recipes in section2Recipes.h: S2_R20 (Mars + Iteration) and S2_R38 (Mars + Iteration + Analysis); both registered in the Section2Recipes aggregator in numerical order.
- Add new modelError concept under backend/concepts/model-error/ following the standard 4-file layout (Enum, Matcher, Encoding, ConceptDescriptor); single Default variant, applicable at (StagePreset, SecLocalUseSection), with LocalDefinitionNumber allow-list {25, 39}; encoder body left as TODO (deductions / GRIB key writes to be added separately).
- Register ModelErrorConcept in AllConcepts.h: include added alphabetically between mars and nil; type appended at the end of the AllConcepts typelist to preserve existing conceptIds and global variant indices.
- Implement modelErrorMatcher: returns ModelErrorType::Default when mars["type"] == "eme"; throws Mars2GribMatcherException if the mandatory "number" key is missing in that case; returns MISSING otherwise.
- Add Section 2 recipes in section2Recipes.h: S2_R25 (Mars + ModelError) and S2_R39 (Mars + Analysis + ModelError); both registered in the Section2Recipes aggregator in numerical order.
- Extend analysisEncoding.h LocalDefinitionNumber allow-list from {36, 38} to {36, 38, 39} so AnalysisOp accepts the new template 39.
- Update ensembleMatcher.h to return MISSING when mars["type"] == "eme", since in that case the "number" key identifies the model-error realization, not an ensemble member.
…MultipleLevel

- Replace the single LevelType::Hybrid variant with two variants:
  ModelSingleLevel for 2D fields published on the model-level system
  (no vertical column, no PV array) and ModelMultipleLevel for full
  vertical columns of model-level data, which require allocation and
  population of the PV array describing the hybrid coordinate
  transformation. Both variants map to GRIB typeOfLevel "hybrid", so
  encoded output is bit-identical for cases that previously used
  Hybrid; only encoder behaviour (PV allocation) differs between the
  two new variants.

- Update the LevelList typelist to reflect the new variants and keep
  it in sync with the LevelType enumeration.

- Update needPv to fire only on ModelMultipleLevel; update needLevel
  to cover both ModelSingleLevel and ModelMultipleLevel.

- Add a new AbstractLevel variant carrying a numeric level value,
  sitting alongside the existing AbstractSingleLevel and
  AbstractMultipleLevel opaque variants. AbstractLevel is included in
  needLevel.

- Rewrite matchML to dispatch single-level model paramIds (22, 127,
  128, 129, 152) to ModelSingleLevel and the remaining multi-level
  set to ModelMultipleLevel. ERA6 paramIds 127 and 128 on ML, which
  were previously rejected, are now accepted as ModelSingleLevel.

- Refresh Doxygen for the level concept to document the three
  orthogonal predicates needPv, needLevel, needTopBottomLevel and to
  describe the rationale for splitting Hybrid into single-level and
  multi-level model variants.

- Fix typo in the level encoder header comment: "Se of typeOfLevel"
  becomes "Setting of typeOfLevel".
…fc detection, model-error types)

- params.yaml: register ECMWF covariance paramIds 254001..254017 on levtype=sfc.
- levelMatcher: map paramIds 254001..254017 to LevelType::AbstractLevel
  (typeOfFirstFixedSurface=254); extend matchO2D with ocean paramIds
  262146/262147 (DepthBelowSeaLayer) and 262148 (OceanSurfaceToBottom).
- pointInTimeMatcher: add 254001..254017 and 262146..262148 to the default
  point-in-time set so Section 4 recipe selection succeeds for these params.
- significanceOfReferenceTime: recognize MARS type "est" as a forecast type.
- typeOfGeneratingProcess:
  * For type=fc, detect ensemble evidence (numberOfForecastsInEnsemble>1,
    typeOfEnsembleForecast present, or mars.number>0) and resolve to
    EnsembleForecast instead of Forecast; default behavior is preserved
    when no ensemble evidence is present. Adds detail to RESOLVE log.
  * Map type=eme/me (4D-Var model errors) to Analysis, matching the
    existing {4i,4v,me,eme} grouping in significanceOfReferenceTime.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 29, 2026

Codecov Report

❌ Patch coverage is 12.06897% with 102 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.57%. Comparing base (0e5d0f6) to head (dc053bf).
⚠️ Report is 17 commits behind head on develop.

Files with missing lines Patch % Lines
.../backend/concepts/model-error/modelErrorEncoding.h 0.00% 12 Missing ⚠️
...rib/backend/concepts/iteration/iterationEncoding.h 0.00% 11 Missing ⚠️
...tkit/mars2grib/backend/deductions/componentIndex.h 0.00% 11 Missing ⚠️
...2grib/backend/deductions/totalNumberOfIterations.h 0.00% 10 Missing ⚠️
...rib/backend/concepts/satellite/satelliteEncoding.h 0.00% 8 Missing ⚠️
...kit/mars2grib/backend/deductions/iterationNumber.h 0.00% 7 Missing ⚠️
...tkit/mars2grib/backend/deductions/modelErrorType.h 0.00% 7 Missing ⚠️
.../mars2grib/backend/deductions/numberOfComponents.h 0.00% 7 Missing ⚠️
...mars2grib/backend/deductions/numberOfFrequencies.h 0.00% 7 Missing ⚠️
...etkit/mars2grib/backend/concepts/level/levelEnum.h 0.00% 3 Missing ⚠️
... and 10 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #207      +/-   ##
===========================================
- Coverage    62.03%   61.57%   -0.46%     
===========================================
  Files          303      315      +12     
  Lines        11671    11776     +105     
  Branches      1049     1054       +5     
===========================================
+ Hits          7240     7251      +11     
- Misses        4431     4525      +94     

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

@dsarmany dsarmany mentioned this pull request May 11, 2026
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