MeteoIODoc  2.10.0
SASEIO.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 /***********************************************************************************/
3 /* Copyright 2014 Snow and Avalanche Study Establishment SASE-CHANDIGARH */
4 /***********************************************************************************/
5 /* This file is part of MeteoIO.
6  MeteoIO is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  MeteoIO is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef SASEIO_H
20 #define SASEIO_H
21 
22 #include <meteoio/IOInterface.h>
23 
24 #include <string>
25 
26 namespace mio {
27 
36 class SASEIO : public IOInterface {
37  public:
38  SASEIO(const std::string& configfile);
39  SASEIO(const SASEIO&);
40  SASEIO(const Config& cfgreader);
41 
42  virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
43  virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
44  std::vector< std::vector<MeteoData> >& vecMeteo);
45 
46  private:
47  void readConfig();
48  void readStationIDs(std::vector<std::string>& vecStationID) const;
49  static void parseStationID(const std::string& stationID, std::string& stnAbbrev, std::string& stnNumber);
50  void getStationMetaData(const std::string& stat_abk, const std::string& stao_nr,const std::string& sqlQuery,
51  std::vector<std::string>& vecMetaData);
52  void readStationMetaData();
53  void readData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo,
54  const size_t& stationindex, const std::vector<StationData>& vecMeta) const;
55  static void convertUnits(MeteoData& meteo);
56  void parseDataSet(const std::vector<std::string>& i_meteo, MeteoData& md) const;
57  bool getStationData(const std::string& stat_abk, const std::string& stao_nr,const Date& dateS,
58  const Date& dateE,const std::vector<std::string>& vecHTS1,
59  std::vector< std::vector<std::string> >& vecMeteoData) const;
60 
61  const Config cfg;
62  std::vector<std::string> vecStationIDs;
63  std::vector<StationData> vecStationMetaData;
64  std::string mysqlhost, mysqldb, mysqluser, mysqlpass;
65  std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
66  double in_dflt_TZ, out_dflt_TZ;
67 
68  static const double plugin_nodata; //plugin specific nodata value, e.g. -999
69  static const std::string MySQLQueryStationMetaData;
70  static const std::string MySQLQueryMeteoData;
71 };
72 
73 } //namespace
74 #endif
75 
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 is the plugin required to get meteorological data from the SASE database.
Definition: SASEIO.h:36
SASEIO(const SASEIO &)
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: SASEIO.cc:196
SASEIO(const std::string &configfile)
Definition: SASEIO.cc:64
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: SASEIO.cc:189
Definition: Config.cc:30