MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SASEIO.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2014 Snow and Avalanche Study Establishment SASE-CHANDIGARH */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef SASEIO_H
19 #define SASEIO_H
20 
21 #include <meteoio/IOInterface.h>
22 
23 #include <string>
24 
25 namespace mio {
26 
35 class SASEIO : public IOInterface {
36  public:
37  SASEIO(const std::string& configfile);
38  SASEIO(const SASEIO&);
39  SASEIO(const Config& cfgreader);
40 
41  virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
42  virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
43  std::vector< std::vector<MeteoData> >& vecMeteo);
44 
45  private:
46  void readConfig();
47  void readStationIDs(std::vector<std::string>& vecStationID) const;
48  static void parseStationID(const std::string& stationID, std::string& stnAbbrev, std::string& stnNumber);
49  void getStationMetaData(const std::string& stat_abk, const std::string& stao_nr,const std::string& sqlQuery,
50  std::vector<std::string>& vecMetaData);
51  void readStationMetaData();
52  void readData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo,
53  const size_t& stationindex, const std::vector<StationData>& vecMeta) const;
54  static void convertUnits(MeteoData& meteo);
55  void parseDataSet(const std::vector<std::string>& i_meteo, MeteoData& md) const;
56  bool getStationData(const std::string& stat_abk, const std::string& stao_nr,const Date& dateS,
57  const Date& dateE,const std::vector<std::string>& vecHTS1,
58  std::vector< std::vector<std::string> >& vecMeteoData) const;
59 
60  const Config cfg;
61  std::vector<std::string> vecStationIDs;
62  std::vector<StationData> vecStationMetaData;
63  std::string mysqlhost, mysqldb, mysqluser, mysqlpass;
64  std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
65  double in_dflt_TZ, out_dflt_TZ;
66 
67  static const double plugin_nodata; //plugin specific nodata value, e.g. -999
68  static const std::string MySQLQueryStationMetaData;
69  static const std::string MySQLQueryMeteoData;
70 };
71 
72 } //namespace
73 #endif
74 
SASEIO(const std::string &configfile)
Definition: SASEIO.cc:63
A class representing the IO Layer of the software Alpine3D. For each type of IO (File, DB, Webservice, etc) a derived class is to be created that holds the specific implementation of the appropriate virtual methods. The IOHandler class is a wrapper class that is able to deal with all above implementations of the IOInterface abstract base class.
Definition: IOInterface.h:43
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:195
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:58
This is the plugin required to get meteorological data from the SASE database.
Definition: SASEIO.h:35
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:101
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: SASEIO.cc:188