Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
3ec736e
mars2grib: infrastructure for iteration concept
MircoValentiniECMWF Apr 13, 2026
9e3111a
mars2grib: infrastructure for modelError concept
MircoValentiniECMWF Apr 28, 2026
7550624
mars2grib: split level concept Hybrid into ModelSingleLevel and Model…
MircoValentiniECMWF Apr 28, 2026
e96b35c
mars2grib: Register new section2 templates {20,25,38,39}
MircoValentiniECMWF Apr 28, 2026
6f94fb9
mars2grib: add ERA6 re-encoding support (covariance params, ensemble …
MircoValentiniECMWF Apr 29, 2026
e8a6745
Run clang-format
MircoValentiniECMWF Apr 29, 2026
46e02e8
mars2grib: add brightnessTemperature variant to satellite concept
MircoValentiniECMWF May 12, 2026
9d9ba34
mars2grib: improve documentation
MircoValentiniECMWF May 12, 2026
3bb7dbc
mars2grib: fix recipe for LocalSectionNumbe=37
MircoValentiniECMWF May 12, 2026
1f6a8fd
mars2grib: add default for numberOfFrequencies
MircoValentiniECMWF May 14, 2026
97055b9
mars2grib: resolve typeOfGeneratingProcess=4 for ensemble statistics …
dsarmany May 13, 2026
ee28c42
mars2grib: route type=ses to PDT=2 (derived ensemble forecast)
dsarmany May 13, 2026
3d5e8c9
Fix multiple bugs for encoding of BrightnessTemperature
MircoValentiniECMWF May 26, 2026
2713be3
mars2grib: bugfix, fix BrightnessTemperatureEnsembleMean
MircoValentiniECMWF May 27, 2026
b62d228
mars2grib: split brightness temperature into its own concept
MircoValentiniECMWF Jun 1, 2026
73be35c
mars2grib: extend model-error concept handling
MircoValentiniECMWF Jun 1, 2026
60019ff
mars2grib: keep samples valid during packing setup
MircoValentiniECMWF Jun 1, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions share/metkit/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3603,6 +3603,24 @@
- 228240
- 228246
- 228247
- - levtype: sfc
- - 254001
- 254002
- 254003
- 254004
- 254005
- 254006
- 254007
- 254008
- 254009
- 254010
- 254011
- 254012
- 254013
- 254014
- 254015
- 254016
- 254017
- - class: od
levtype: al
stream: elda
Expand Down
13 changes: 8 additions & 5 deletions src/metkit/mars2grib/backend/concepts/AllConcepts.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@
#include "metkit/mars2grib/backend/concepts/destine/destineConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/ensemble/ensembleConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/generating-process/generatingProcessConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/iteration/iterationConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/level/levelConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/longrange/longrangeConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/mars/marsConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/model-error/modelErrorConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/nil/nilConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/origin/originConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/packing/packingConceptDescriptor.h"
Expand All @@ -114,6 +116,7 @@
#include "metkit/mars2grib/backend/concepts/statistics/statisticsConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/tables/tablesConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/wave/waveConceptDescriptor.h"
#include "metkit/mars2grib/backend/concepts/brightness-temperature/brightnessTemperatureConceptDescriptor.h"


namespace metkit::mars2grib::backend::concepts_::detail {
Expand Down Expand Up @@ -168,10 +171,10 @@ using TypeList = metkit::mars2grib::backend::compile_time_registry_engine::TypeL
/// Higher-level code should interact with concepts exclusively through
/// registry APIs, not by iterating this list directly.
///
using AllConcepts =
TypeList<AnalysisConcept, CompositionConcept, DataTypeConcept, DerivedConcept, DestineConcept, EnsembleConcept,
GeneratingProcessConcept, LevelConcept, LongrangeConcept, MarsConcept, NilConcept, OriginConcept,
PackingConcept, ParamConcept, PointInTimeConcept, ReferenceTimeConcept, RepresentationConcept,
SatelliteConcept, ShapeOfTheEarthConcept, StatisticsConcept, TablesConcept, WaveConcept>;
using AllConcepts = TypeList<AnalysisConcept, CompositionConcept, DataTypeConcept, DerivedConcept, DestineConcept,
EnsembleConcept, GeneratingProcessConcept, LevelConcept, LongrangeConcept,
IterationConcept, MarsConcept, NilConcept, OriginConcept, PackingConcept, ParamConcept,
PointInTimeConcept, ReferenceTimeConcept, RepresentationConcept, SatelliteConcept,
ShapeOfTheEarthConcept, StatisticsConcept, TablesConcept, WaveConcept, ModelErrorConcept, BrightnessTemperatureConcept>;

} // namespace metkit::mars2grib::backend::concepts_::detail
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void AnalysisOp(const MarsDict_t& mars, const ParDict_t& par, const OptDict_t& o
MARS2GRIB_LOG_CONCEPT(analysis);

// Structural validation
validation::match_LocalDefinitionNumber_or_throw(opt, out, {36L});
validation::match_LocalDefinitionNumber_or_throw(opt, out, {36L, 37L, 38L, 39L});

// Deductions
long offsetToEndOf4DvarWindowVal = deductions::resolve_offsetToEndOf4DvarWindow_or_throw(mars, par, opt);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* (C) Copyright 2025- ECMWF and individual contributors.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/

/// @file brightnessTemperatureConceptDescriptor.h
/// @brief Compile-time registry entry for the GRIB `brightnessTemperature` concept.
///
/// This header defines `BrightnessTemperatureConcept`, the **compile-time
/// descriptor** that registers the GRIB `brightnessTemperature` concept into
/// the mars2grib compile-time registry engine.
///
/// The descriptor provides:
/// - The concept name
/// - The mapping between variants and their symbolic names
/// - The set of callbacks associated with each encoding phase
/// - The entry-level matcher used to activate the concept
///
/// This file contains **no runtime logic**. All decisions are resolved at
/// compile time through template instantiation.
///
/// @ingroup mars2grib_backend_concepts

#pragma once

// System includes
#include <string_view>

// Registry engine
#include "metkit/mars2grib/backend/compile-time-registry-engine/RegisterEntryDescriptor.h"
#include "metkit/mars2grib/backend/compile-time-registry-engine/common.h"
#include "metkit/mars2grib/utils/generalUtils.h"

// Core concept includes
#include "metkit/mars2grib/backend/concepts/brightness-temperature/brightnessTemperatureEncoding.h"
#include "metkit/mars2grib/backend/concepts/brightness-temperature/brightnessTemperatureEnum.h"
#include "metkit/mars2grib/backend/concepts/brightness-temperature/brightnessTemperatureMatcher.h"

namespace metkit::mars2grib::backend::concepts_ {

// Importing the compile-time registry engine namespace locally to avoid
// excessive verbosity in template-heavy code. This is restricted to an
// internal scope and not exposed through public headers.
using namespace metkit::mars2grib::backend::compile_time_registry_engine;

/// @brief Compile-time descriptor for the `brightnessTemperature` concept.
///
/// `BrightnessTemperatureConcept` registers the GRIB `brightnessTemperature`
/// concept into the compile-time registry engine.
///
/// The descriptor defines:
/// - The canonical concept name
/// - The mapping from variant enum values to symbolic names
/// - The callbacks associated with each encoding phase
/// - The entry-level matcher used to detect applicability
///
/// All functions in this descriptor are `constexpr` and are evaluated
/// entirely at compile time.
struct BrightnessTemperatureConcept
: RegisterEntryDescriptor<BrightnessTemperatureType, BrightnessTemperatureList> {

/// @brief Return the canonical name of the concept.
///
/// This name is used for:
/// - Registry identification
/// - Diagnostics and logging
/// - Debug and introspection facilities
static constexpr std::string_view entryName() {
return brightnessTemperatureName;
}

/// @brief Return the symbolic name of a concept variant.
///
/// @tparam T Variant enumeration value
///
/// @return String view representing the variant name
template <BrightnessTemperatureType T>
static constexpr std::string_view variantName() {
return brightnessTemperatureTypeName<T>();
}

/// @brief Return the callback associated with a specific encoding phase.
///
/// This function is queried by the registry engine to obtain the callback
/// implementing the `brightnessTemperature` concept for a given:
///
/// - Capability
/// - Encoding stage
/// - GRIB section
/// - Concept variant
///
/// The function returns:
/// - A valid function pointer if the concept is applicable
/// - `nullptr` otherwise
///
/// @tparam Capability Encoding capability index
/// @tparam Stage Encoding stage
/// @tparam Sec GRIB section
/// @tparam Variant Concept variant
/// @tparam MarsDict_t Type of MARS dictionary
/// @tparam ParDict_t Type of parameter dictionary
/// @tparam OptDict_t Type of options dictionary
/// @tparam OutDict_t Type of output GRIB dictionary
///
/// @return Function pointer implementing the phase, or `nullptr`
template <std::size_t Capability,
std::size_t Stage,
std::size_t Sec,
BrightnessTemperatureType Variant,
class MarsDict_t,
class ParDict_t,
class OptDict_t,
class OutDict_t>
static constexpr Fn<MarsDict_t, ParDict_t, OptDict_t, OutDict_t> phaseCallbacks() {
if constexpr (Capability == 0) {
if constexpr (brightnessTemperatureApplicable<Stage, Sec, Variant>()) {
return &BrightnessTemperatureOp<Stage, Sec, Variant, MarsDict_t, ParDict_t, OptDict_t, OutDict_t>;
}
else {
return nullptr;
}
}
else {
return nullptr;
}

mars2gribUnreachable();
}

/// @brief Variant-specific callbacks.
///
/// The brightnessTemperature concept does not currently require
/// variant-specific runtime callbacks. All runtime behavior is handled
/// through phase callbacks.
///
/// @return Always `nullptr`
template <std::size_t Capability,
BrightnessTemperatureType Variant,
class MarsDict_t,
class ParDict_t,
class OptDict_t,
class OutDict_t>
static constexpr Fn<MarsDict_t, ParDict_t, OptDict_t, OutDict_t> variantCallbacks() {
return nullptr;
}

/// @brief Entry-level matcher callback.
///
/// This callback is used by the registry engine to decide whether the
/// brightnessTemperature concept is active for a given MARS request.
///
/// @tparam Capability Encoding capability index
/// @tparam MarsDict_t Type of MARS dictionary
/// @tparam OptDict_t Type of options dictionary
///
/// @return Function pointer to the matcher, or `nullptr`
template <std::size_t Capability, class MarsDict_t, class OptDict_t>
static constexpr Fm<MarsDict_t, OptDict_t> entryCallbacks() {
if constexpr (Capability == 0) {
return &brightnessTemperatureMatcher<MarsDict_t, OptDict_t>;
}
else {
return nullptr;
}
}
};

} // namespace metkit::mars2grib::backend::concepts_
Loading