58 ss <<
"x: " <<
x <<
" y: " <<
y <<
" z: " <<
z
116 srid =
"EPSG:" + std::to_string(in_epsg);
139 std::map<std::string, std::string> dict;
156 std::map<std::string, std::string> dict;
167 dict[
"nodata"] = std::to_string(
nodata);
170 dict[
"timezone"] = std::to_string(
timezone);
202 std::vector<std::string>
units = {};
209 for (
size_t id = 0;
id <
fields.size();
id++) {
210 if (fieldname ==
fields[
id])
223 std::map<std::string, std::vector<std::string>>
toMap()
const {
224 std::map<std::string, std::vector<std::string>> dict;
227 if (!
units.empty()) {
228 dict[
"units"] =
units;
241 [](
double d) { return std::to_string(d); });
242 dict[
"units_multipliers"] = str_units_multipliers;
246 std::vector<std::string> str_units_offsets(
units_offsets.size());
248 [](
double d) { return std::to_string(d); });
249 dict[
"units_offsets"] = str_units_offsets;
273std::vector<double>
convertVector(
const std::vector<std::string> &vec);
274std::vector<Coords>
convertVector(
const std::vector<geoLocation> &vec,
const int& epsg);
318 std::vector<Date> dates_in_file;
319 std::vector<std::vector<double>> row_data;
320 std::vector<geoLocation> locations_in_data;
327 iCSVFile(
const std::string &infile,
const bool& read_sequential);
330 void readFile(
const std::string &infile,
const bool& sequentially);
341 const std::vector<std::vector<double>>&
getRowData()
const {
return row_data; }
345 if (index >= locations_in_data.size()) {
346 throw std::out_of_range(
"Index out of range for locations");
348 return locations_in_data[index];
351 std::vector<Date> dates;
352 for (
const Date &date : dates_in_file) {
353 if (date >= start_date && date <= end_date) {
354 dates.push_back(date);
361 return std::vector<geoLocation>();
363 std::vector<geoLocation> locations;
364 for (
size_t i = 0; i < dates_in_file.size(); i++) {
365 if (dates_in_file[i] >= start_date && dates_in_file[i] <= end_date) {
366 locations.push_back(locations_in_data[i]);
372 bool processLine(
const std::string& line, std::string& section,
const bool& sequentially);
373 void processContent(
const std::string& content,
const std::string& section);
381 std::vector<std::string>
columnsToAppend(
const std::vector<MeteoData> &vecMeteo)
const;
384 double readData(
const Date &r_date,
const std::string &fieldname);
387 void populateFields(
const std::string &key,
const std::string &value);
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:83
void setPoint(const double in_x_or_lat, const double in_y_or_lon, const double in_altitude)
Set coordinates based on the previously defined EPSG code If the EPSG code is 4326 (which represents ...
Definition: Coords.cc:551
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
This class is responsible for handling and storing iCSV files.
Definition: iCSVHelper.h:297
std::vector< std::string > columnsToAppend(const std::vector< MeteoData > &vecMeteo) const
Definition: iCSVHelper.cc:549
void aggregateData(const std::vector< MeteoData > &vecMeteo)
Definition: iCSVHelper.cc:424
const std::vector< Date > & getAllDatesInFile() const
Definition: iCSVHelper.h:342
bool timezone_in_data
Definition: iCSVHelper.h:310
std::string firstline
Definition: iCSVHelper.h:302
geoLocation station_location
Definition: iCSVHelper.h:303
std::vector< geoLocation > getLocationsInData(const Date &start_date, const Date &end_date) const
Definition: iCSVHelper.h:359
double getNoData() const
Definition: iCSVHelper.h:336
size_t time_id
Definition: iCSVHelper.h:313
void processContent(const std::string &content, const std::string §ion)
Definition: iCSVHelper.cc:303
iCSVFile()
Definition: iCSVHelper.cc:192
double getTimeZone() const
Definition: iCSVHelper.h:340
fieldsSection FIELDS
Definition: iCSVHelper.h:306
size_t skip_lines_to_data
Definition: iCSVHelper.h:300
bool checkFormatValidity()
Checks the validity of the format for the iCSVFile.
Definition: iCSVHelper.cc:460
bool isValidLocation(const geoLocation &location)
Definition: iCSVHelper.cc:536
void findTime()
Definition: iCSVHelper.cc:605
void populateMetaData(const std::string &key, const std::string &value)
Definition: iCSVHelper.cc:348
bool location_in_header
Definition: iCSVHelper.h:309
bool timestamp_present
Definition: iCSVHelper.h:311
void findLocation()
Definition: iCSVHelper.cc:622
bool isColumnName(const std::string &geometry)
Definition: iCSVHelper.cc:538
std::vector< Date > getDatesInFile(const Date &start_date, const Date &end_date) const
Definition: iCSVHelper.h:350
bool checkMeteoIOCompatibility() const
Definition: iCSVHelper.cc:523
std::string filename
Definition: iCSVHelper.h:301
geoLocation getLocationAt(size_t index) const
Definition: iCSVHelper.h:344
void readFile(const std::string &infile, const bool &sequentially)
Definition: iCSVHelper.cc:236
void populateFields(const std::string &key, const std::string &value)
Definition: iCSVHelper.cc:376
const std::vector< geoLocation > & getAllLocationsInData() const
Definition: iCSVHelper.h:343
size_t location_id
Definition: iCSVHelper.h:314
void processData(const std::string &content)
Definition: iCSVHelper.cc:327
void parseGeometry()
Parses the geometry information of the iCSV file.
Definition: iCSVHelper.cc:584
MetaDataSection METADATA
Definition: iCSVHelper.h:305
const std::vector< std::vector< double > > & getRowData() const
Definition: iCSVHelper.h:341
bool processLine(const std::string &line, std::string §ion, const bool &sequentially)
Definition: iCSVHelper.cc:266
double readData(const Date &r_date, const std::string &fieldname)
Definition: iCSVHelper.cc:403
bool julian_present
Definition: iCSVHelper.h:312
static const double default_nodata
Definition: iCSVHelper.h:30
const size_t npos
npos is the out-of-range value
Definition: IOUtils.h:80
const double nodata
This is the internal nodata value.
Definition: IOUtils.h:75
std::vector< double > convertVector(const std::vector< std::string > &vec)
Definition: iCSVHelper.cc:130
bool roughlyEqual(const MetaDataSection &lhs, const MetaDataSection &rhs)
Checks if two MetaDataSection objects are roughly equal.
Definition: iCSVHelper.cc:691
MetaDataSection & operator+=(MetaDataSection &lhs, const MetaDataSection &rhs)
Definition: iCSVHelper.cc:731
bool operator!=(const geoLocation &lhs, const geoLocation &rhs)
Definition: iCSVHelper.cc:634
bool operator==(const geoLocation &lhs, const geoLocation &rhs)
Definition: iCSVHelper.cc:633
geoLocation toiCSVLocation(Coords loc, const int &epsg)
Definition: iCSVHelper.cc:157
geoLocation extractCoordinates(const std::string &geometry)
extracts a geoLocation object out of a WKT geometry string.
Definition: iCSVHelper.cc:173
Stores Information on the FIELDS section of a iCSV file.
Definition: iCSVHelper.h:198
size_t getFieldIndex(const std::string &fieldname) const
Definition: iCSVHelper.h:208
std::vector< double > units_offsets
Definition: iCSVHelper.h:201
std::map< std::string, std::vector< std::string > > other_fields
Definition: iCSVHelper.h:206
std::vector< std::string > units
Definition: iCSVHelper.h:202
std::vector< double > units_multipliers
Definition: iCSVHelper.h:200
std::vector< std::string > long_name
Definition: iCSVHelper.h:203
std::vector< std::string > fields
Definition: iCSVHelper.h:199
std::map< std::string, std::vector< std::string > > toMap() const
Definition: iCSVHelper.h:223
std::vector< std::string > standard_name
Definition: iCSVHelper.h:204
std::vector< std::string > getOtherFields(const std::string &key)
Definition: iCSVHelper.h:216
Represents a geographic location extracted from iCSV files. (POINT(X Y)...)
Definition: iCSVHelper.h:39
bool isEmpty() const
Checks if the geoLocation is empty.
Definition: iCSVHelper.h:50
geoLocation & operator=(const geoLocation &rhs)
Definition: iCSVHelper.cc:636
void standardizeNodata()
Definition: iCSVHelper.h:64
double x
Definition: iCSVHelper.h:40
std::string toString() const
Converts the geoLocation to a string representation.
Definition: iCSVHelper.h:56
Coords toCoords(const int &epsg) const
Definition: iCSVHelper.h:76
double slope_angle
Definition: iCSVHelper.h:43
double slope_azi
Definition: iCSVHelper.h:44
double z
Definition: iCSVHelper.h:42
double y
Definition: iCSVHelper.h:41