13 #include "eckit/exception/Exceptions.h"
75 throw eckit::BadParameter(
"Missing export::variables section in configuration.");
81 if (conf.keys().size() == 0)
83 std::stringstream errStr;
84 errStr <<
"bufr::exports::variables must contain a dictionary of variables!";
85 throw eckit::BadParameter(errStr.str());
88 for (
const auto&
key : conf.keys())
92 auto subConf = conf.getSubConfiguration(
key);
96 variable = std::make_shared<DatetimeVariable>(dtconf);
101 variable = std::make_shared<MnemonicVariable>(
106 std::ostringstream errMsg;
107 errMsg <<
"Unknown bufr::exports::variable of type " <<
key;
108 throw eckit::BadParameter(errMsg.str());
117 if (conf.keys().size() == 0)
119 std::stringstream errStr;
120 errStr <<
"bufr::exports::splits must contain a dictionary of splits!";
121 throw eckit::BadParameter(errStr.str());
124 for (
const auto&
key : conf.keys())
126 std::shared_ptr<Split> split;
128 auto subConf = conf.getSubConfiguration(
key);
138 for (
const std::string& mapKey : mapConf.keys())
140 auto intKey = mapKey.substr(1, mapKey.size());
141 nameMap.insert({std::stoi(intKey), mapConf.getString(mapKey)});
145 split = std::make_shared<CategorySplit>(
151 std::ostringstream errMsg;
152 errMsg <<
"Unknown bufr::exports::splits of type " <<
key;
153 throw eckit::BadParameter(errMsg.str());
162 auto subConfs = conf.getSubConfigurations();
163 if (subConfs.size() == 0)
165 std::stringstream errStr;
166 errStr <<
"bufr::exports::filters must contain a list of filters!";
167 throw eckit::BadParameter(errStr.str());
170 for (
const auto& subConf : subConfs)
172 std::shared_ptr<Filter> filter;
178 std::shared_ptr<float> lowerBound =
nullptr;
181 lowerBound = std::make_shared<float>(
185 std::shared_ptr<float> upperBound =
nullptr;
188 upperBound = std::make_shared<float>(
192 filter = std::make_shared<BoundingFilter>(
199 std::ostringstream errMsg;
200 errMsg <<
"bufr::exports::filters Unknown filter of type ";
201 errMsg << subConf.keys()[0] <<
".";
202 throw eckit::BadParameter(errMsg.str());
std::map< int, std::string > NameMap
Map of integers to strings where the key represents the split mnemonics integer value and the value i...
void addVariables(const eckit::Configuration &conf)
Create Variables exports from config.
void addSplits(const eckit::Configuration &conf)
Create Splits exports from config.
Export(const eckit::Configuration &conf)
Constructor.
void addFilters(const eckit::Configuration &conf)
Create Filters exports from config.
std::vector< std::shared_ptr< Transform > > Transforms
character(maxvarlen) function variable(this, jj)