41 PSQLIO(
const std::string& configfile);
49 std::vector< std::vector<MeteoData> >& vecMeteo);
51 virtual void writeMeteoData(
const std::vector< std::vector<MeteoData> >& vecMeteo,
52 const std::string& name=
"");
55 void getParameters(
const Config& cfg);
56 void open_connection(
const bool& input=
true);
57 PGresult* sql_exec(
const std::string& sqlcommand,
const bool& input=
true);
58 static bool replace(std::string& str,
const std::string& from,
const std::string& to);
59 void readData(
const Date& dateStart,
const Date& dateEnd, std::vector<MeteoData>& vecMeteo,
const size_t& stationindex);
60 void readMetaData(
const std::string& query, std::vector<StationData>& vecStation,
const bool& input=
true);
61 void add_meta_data(
const unsigned int& index,
const StationData& sd);
62 static void map_parameters(
const PGresult* result,
MeteoData& md, std::vector<size_t>& index);
63 void parse_row(
const PGresult* result,
const int& row,
const int& cols,
64 MeteoData& md,
const std::vector<size_t>& index, std::vector<mio::MeteoData>& vecMeteo)
const;
65 void close_connection(PGconn *conn);
66 static bool checkConsistency(
const std::vector<MeteoData>& vecMeteo,
StationData& sd);
67 static size_t checkExistence(
const std::vector<StationData>& vec_stations,
const StationData& sd);
68 static void convertUnits(
MeteoData& meteo);
69 static void convertUnitsBack(
MeteoData& meteo);
70 static void checkForUsedParameters(
const std::vector<MeteoData>& vecMeteo, std::vector<bool>& vecParamInUse, std::vector<std::string>& vecColumnName);
71 void add_sensors(
const unsigned int& index,
const std::vector<std::string>& vecColumnName, std::map<size_t, std::string>& map_sensor_id);
72 int get_sensor_index();
73 int get_measurement_index();
74 void get_sensors(
const std::string& index,
const std::vector<std::string>& vecColumnName, std::map<size_t, std::string>& map_sensor_id);
76 std::string coordin, coordinparam, coordout, coordoutparam;
77 std::string in_endpoint, in_port, in_dbname, in_userid, in_passwd;
78 std::string out_endpoint, out_port, out_dbname, out_userid, out_passwd;
79 bool input_configured, output_configured;
82 double default_timezone;
83 std::vector<StationData> vecMeta;
84 std::vector<std::string> vecFixedStationID, vecMobileStationID;
85 std::string sql_meta, sql_data;
87 static const std::string sqlInsertMetadata, sqlInsertSensor, sqlInsertMeasurement;
88 static const double plugin_nodata;
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 timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
A class representing the IO Layer of the software Alpine3D. For each type of IO (File,...
Definition: IOInterface.h:98
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:107
This plugin connects to a generic PostgreSQL server to retrieve its meteorological data.
Definition: PSQLIO.h:39
virtual void readMeteoData(const Date &dateStart, const Date &dateEnd, std::vector< std::vector< MeteoData > > &vecMeteo)
Fill vecMeteo with a time series of objects corresponding to the interval indicated by dateStart and ...
Definition: PSQLIO.cc:263
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: PSQLIO.cc:227
PSQLIO & operator=(const PSQLIO &in)
Definition: PSQLIO.cc:118
PSQLIO(const std::string &configfile)
Definition: PSQLIO.cc:88
virtual void writeMeteoData(const std::vector< std::vector< MeteoData > > &vecMeteo, const std::string &name="")
Write vecMeteo time series to a certain destination.
Definition: PSQLIO.cc:600
A class to represent meteo stations with attributes like longitude, latitude, etc.
Definition: StationData.h:41