MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BormaIO.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
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 BORMAIO_H
19 #define BORMAIO_H
20 
21 #include <meteoio/IOInterface.h>
22 
23 #include <libxml++/libxml++.h>
24 #include <string>
25 
26 namespace mio {
27 
37 class BormaIO : public IOInterface {
38  public:
39  BormaIO(void (*delObj)(void*), const Config& i_cfg);
40 
41  BormaIO(const std::string& configfile);
42  BormaIO(const Config&);
43 
44  virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
45  std::vector< std::vector<MeteoData> >& vecMeteo);
46 
47  private:
48  void convertUnits(MeteoData& meteo);
49  void checkForMeteoFiles(const std::string& xmlpath, const std::string& stationname, const Date& date_in,
50  std::string& filename_out, Date& date_out);
51  void xmlParseStringToDouble(const std::string& str_in, double& d_out, const std::string& parname);
52  std::string xmlGetNodeContent(xmlpp::Node* pNode, const std::string& nodename);
53  void xmlExtractData(const std::string& filename, const Date& date_in, MeteoData& md, StationData& sd);
54  std::string xmlGetNodeName(xmlpp::Node* pNode);
55  xmlpp::Node* xmlGetNode(xmlpp::Node* parentNode, const std::string& nodename);
56  Date stringToDate(const std::string& tmp) const;
57  bool validFilename(const std::string& tmp) const;
58  void getFiles(const std::string& stationsname, const Date& start_date, const Date& end_date,
59  std::vector<std::string>& vecFiles, std::vector<Date>& vecDate);
60  void readStationNames(void);
61  bool bufferData(const Date& dateStart, const Date& dateEnd,
62  std::vector< std::vector<MeteoData> >& vecMeteo,
63  const size_t& stationnr);
64 
65  std::vector<std::string> vecStationName;
66  const Config cfg;
67  std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
68  double in_tz;
69  size_t nr_stations; //number of stations to read from
70 
71  static const double plugin_nodata; //plugin specific nodata value, e.g. -999
72  static const double default_tz; //default timezone
73  static const double pivot_year; //pivot year for Y2K suppport
74  static const std::string dflt_extension;
75 
76 
77 };
78 
79 } //end namespace mio
80 
81 #endif
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
This class enables the access meteo data in Borma's XML format.
Definition: BormaIO.h:37
BormaIO(void(*delObj)(void *), const Config &i_cfg)
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:58
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
A class to represent meteo stations with attributes like longitude, latitude, etc.
Definition: StationData.h:38
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:101
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: BormaIO.cc:74