117 typedef struct ACDD_ATTR {
118 ACDD_ATTR() : name(), value(), cfg_key(), default_value(), Default(true) {}
119 ACDD_ATTR(
const std::string& i_name,
const std::string& i_cfg_key,
const std::string& i_default_value=
"") : name(i_name), value(), cfg_key(i_cfg_key), default_value(i_default_value), Default(i_name.empty()) {}
120 ACDD_ATTR(
const std::string& i_name,
const std::string& i_value,
const std::string& i_cfg_key,
const std::string& i_default_value) : name(i_name), value(i_value), cfg_key(i_cfg_key), default_value(i_default_value), Default(false) {}
129 static void readFromFile(std::string& value,
const mio::Config& cfg,
const std::string& cfg_key,
const std::string& section,
const bool& allow_multi_line);
131 std::string name, value, cfg_key, default_value;
139 ACDD(
const bool& set_enable) : attributes(), linked_attributes(), enabled(set_enable) {}
154 void addAttribute(
const std::string& att_name,
const std::string& att_value,
const Mode& mode=
MERGE);
165 void setGeometry(
const std::vector< std::vector<mio::MeteoData> >& vecMeteo,
const bool& isLatLon);
167 void setGeometry(
const std::vector< mio::Coords >& vecLocation,
const bool& isLatLon);
169 void setTimeCoverage(
const std::vector< std::vector<mio::MeteoData> >& vecMeteo);
171 void setTimeCoverage(
const std::vector<std::string>& vec_timestamp,
const double& TZ);
176 static std::map<std::string, acdd_attrs> initAttributes();
177 static std::set< std::pair< std::string, std::set<std::string> > > initLinks();
178 static size_t countCommas(
const std::string& str);
179 void checkLinkedAttributes();
181 std::map<std::string, acdd_attrs> attributes;
182 std::set< std::pair< std::string, std::set<std::string> > > linked_attributes;
This class contains and handles NetCDF Attribute Conventions Dataset Discovery attributes (see ACDD).
Definition: libacdd.h:113
void setUserConfig(const mio::Config &cfg, const std::string §ion, const bool &allow_multi_line=true)
Read all config keys from the selected section and apply some special processing for some keys.
Definition: libacdd.cc:185
ACDD(const bool &set_enable)
Constructor, the argument allows the object to know if the acdd metadata should be written out or not...
Definition: libacdd.h:139
std::string toString() const
Definition: libacdd.cc:250
void setTimeCoverage(const std::vector< std::vector< mio::MeteoData > > &vecMeteo)
Definition: libacdd.cc:499
std::map< std::string, acdd_attrs >::const_iterator const_iterator
Definition: libacdd.h:142
void setEnabled(const bool &i_enable)
Set an internal boolean as a helper for the caller to know if ACDD support should be enabled or not....
Definition: libacdd.cc:198
Mode
Definition: libacdd.h:115
@ APPEND
Definition: libacdd.h:115
@ REPLACE
Definition: libacdd.h:115
@ MERGE
Definition: libacdd.h:115
const_iterator cend() const noexcept
Definition: libacdd.h:144
void addAttribute(const std::string &att_name, const std::string &att_value, const Mode &mode=MERGE)
Add an attribute and its content to the internal list.
Definition: libacdd.cc:270
std::string getAttribute(std::string &att_name) const
Given an attribute name, return its associated value (or an empty string if it does not exists)
Definition: libacdd.cc:298
const_iterator cbegin() const noexcept
Definition: libacdd.h:143
bool isEnabled() const
Get an internal boolean as a helper for the caller to know if ACDD support should be enabled or not.
Definition: libacdd.h:161
void setGeometry(const mio::Grid2DObject &grid, const bool &isLatLon)
Definition: libacdd.cc:306
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:83
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
Definition: libacdd.h:117
ACDD_ATTR()
Definition: libacdd.h:118
std::string getName() const
Definition: libacdd.h:123
void setUserConfig(const mio::Config &cfg, const std::string §ion, const bool &allow_multi_line)
std::string getValue() const
Definition: libacdd.h:122
bool isDefault() const
Definition: libacdd.h:126
void setValue(const std::string &i_value, const Mode &mode=MERGE)
ACDD_ATTR(const std::string &i_name, const std::string &i_value, const std::string &i_cfg_key, const std::string &i_default_value)
Definition: libacdd.h:120
ACDD_ATTR(const std::string &i_name, const std::string &i_cfg_key, const std::string &i_default_value="")
Definition: libacdd.h:119