diff --git a/src/metkit/config/LibMetkit.cc b/src/metkit/config/LibMetkit.cc index 7293b34..6af7953 100644 --- a/src/metkit/config/LibMetkit.cc +++ b/src/metkit/config/LibMetkit.cc @@ -76,6 +76,9 @@ eckit::PathName LibMetkit::mars2gribRuleListYamlFile() { eckit::PathName LibMetkit::mars2gribStatParamRuleListYamlFile() { return "~metkit/share/metkit/mars2grib/StatParamRuleList.yaml"; } +eckit::PathName LibMetkit::mars2gribIfsPrefixToLevTypeYamlFile() { + return "~metkit/share/metkit/mars2grib/IfsPrefixToLevTypeRuleList.yaml"; +} //---------------------------------------------------------------------------------------------------------------------- diff --git a/src/metkit/config/LibMetkit.h b/src/metkit/config/LibMetkit.h index 3a1794c..b666b09 100644 --- a/src/metkit/config/LibMetkit.h +++ b/src/metkit/config/LibMetkit.h @@ -36,6 +36,7 @@ class LibMetkit : public eckit::system::Library { static eckit::PathName mars2gribRuleListYamlFile(); static eckit::PathName mars2gribStatParamRuleListYamlFile(); + static eckit::PathName mars2gribIfsPrefixToLevTypeYamlFile(); static const LibMetkit& instance(); diff --git a/src/metkit/mars2grib/Mars2Grib.cc b/src/metkit/mars2grib/Mars2Grib.cc index 269dda4..d1ae5d5 100644 --- a/src/metkit/mars2grib/Mars2Grib.cc +++ b/src/metkit/mars2grib/Mars2Grib.cc @@ -32,12 +32,14 @@ static pthread_once_t once = PTHREAD_ONCE_INIT; static std::unique_ptr mars2GribRuleList_{nullptr}; static std::unique_ptr statParamInfoRuleList_{nullptr}; +static std::unique_ptr ifsPrefixToLevTypeRuleList_{nullptr}; } static void init() { local_mutex = new eckit::Mutex(); mars2GribRuleList_ = std::make_unique(eckit::YAMLConfiguration{LibMetkit::mars2gribRuleListYamlFile()}); statParamInfoRuleList_ = std::make_unique(eckit::YAMLConfiguration{LibMetkit::mars2gribStatParamRuleListYamlFile()}); + ifsPrefixToLevTypeRuleList_ = std::make_unique(eckit::YAMLConfiguration{LibMetkit::mars2gribIfsPrefixToLevTypeYamlFile()}); } namespace metkit::mars2grib { @@ -54,6 +56,10 @@ const RuleList& statParamRuleList() { return *(statParamInfoRuleList_.get()); } +const RuleList& ifsPrefixToLevTypeRuleList() { + pthread_once(&once, init); + return *(ifsPrefixToLevTypeRuleList_.get()); +} void convertMars2Grib(const eckit::ValueMap& initial, KeySetter& out, const RuleList& ruleList) { diff --git a/src/metkit/mars2grib/Mars2Grib.h b/src/metkit/mars2grib/Mars2Grib.h index a65ab77..dc25ddf 100644 --- a/src/metkit/mars2grib/Mars2Grib.h +++ b/src/metkit/mars2grib/Mars2Grib.h @@ -27,6 +27,7 @@ namespace metkit::mars2grib { const RuleList& ruleList(); const RuleList& statParamRuleList(); +const RuleList& ifsPrefixToLevTypeRuleList(); /** * Reads specific mars keys