10 #include <boost/algorithm/string.hpp>
12 #include "eckit/exception/Exceptions.h"
67 throw eckit::BadParameter(
"Forgot to specify the ioda::backend.");
82 throw eckit::BadParameter(
"Filename is required with the configured backend.");
87 if (dimConfs.size() == 0)
89 std::stringstream errStr;
90 errStr <<
"ioda::dimensions must contain a list of dimensions!";
91 throw eckit::BadParameter(errStr.str());
94 for (
const auto& dimConf : dimConfs)
104 if (varConfs.size() == 0)
106 std::stringstream errStr;
107 errStr <<
"ioda::variables must contain a list of variables!";
108 throw eckit::BadParameter(errStr.str());
111 for (
const auto& varConf : varConfs)
133 auto range = std::make_shared<Range>();
142 auto chunks = std::vector<ioda::Dimensions_t>();
146 chunks.push_back(std::stoi(chunkStr));
156 if (compressionLevel < 0 || compressionLevel > 9)
158 throw eckit::BadParameter(
"GZip compression level must be a number 0-9");
170 for (
const auto& globalConf : globalConfs)
175 auto global = std::make_shared<GlobalDescription<std::string>>();
183 auto global = std::make_shared<GlobalDescription<float>>();
191 auto global = std::make_shared<GlobalDescription<std::vector<float>>>();
199 auto global = std::make_shared<GlobalDescription<int>>();
207 auto global = std::make_shared<GlobalDescription<std::vector<int>>>();
214 throw eckit::BadParameter(
"Unsupported global attribute type");
237 auto backend_lowercase = boost::algorithm::to_lower_copy(backend);
238 if (backend_lowercase ==
"netcdf")
242 else if (backend_lowercase ==
"inmemory" || backend_lowercase ==
"in-memory")
248 throw eckit::BadParameter(
"Unknown ioda::backend specified.");
std::string filepath_
The relative path of the output file to create.
void addDimension(const DimensionDescription &scale)
Add Dimension defenition.
VariableDescriptions variables_
Collection of defined variables.
void addVariable(const VariableDescription &variable)
Add Variable defenition.
void setBackend(const ioda::Engines::BackendNames &backend)
void addGlobal(const std::shared_ptr< GlobalDescriptionBase > &global)
Add Globals defenition.
ioda::Engines::BackendNames backend_
The backend type to use.
IodaDescription()=default
GlobalDescriptions globals_
Collection of defined globals.
DimDescriptions dimensions_
Collection of defined dimensions.
@ Hdf5File
HDF5 file access.
@ ObsStore
ObsStore in-memory.
const char * FloatVectorType
const char * IntVectorType
const char * CompressionLevel
character(maxvarlen) function variable(this, jj)