MeteoIODoc  2.10.0
ALPUG.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 /***********************************************************************************/
3 /* Copyright 2015 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
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 ALPUG_H
20 #define ALPUG_H
21 
22 #include <meteoio/IOInterface.h>
23 
24 #include <string>
25 #include <deque>
26 
27 namespace mio {
28 
37 class ALPUG : public IOInterface {
38  public:
39  ALPUG(const std::string& configfile);
40  ALPUG(const ALPUG&);
41  ALPUG(const Config& cfgreader);
42 
43  virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
44  virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
45  std::vector< std::vector<MeteoData> >& vecMeteo);
46 
47  private:
48  void parseInputOutputSection();
49  void readMetaData();
50  bool isDuplicate(const std::string& line) ;
51  Date parseDINDate(const std::string& datum) const;
52  bool parseLine(const std::string& filename, const size_t& nr_of_data_fields, const Date& dateStart, const Date& dateEnd, const std::string& line, MeteoData &md, bool &isValid) const;
53  void readMeteoFile(const size_t& station_index, const Date& dateStart, const Date& dateEnd,
54  std::vector<MeteoData>& vecM);
55 
56  const Config cfg;
57  std::vector<StationData> vecMeta;
58  std::deque<std::string> LinesBuffer;
59  std::vector<std::string> vecIDs, vecFields;
60  std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
61  std::string inpath, outpath;
62  double in_dflt_TZ, out_dflt_TZ;
63  int wrap_month;
64 
65  static const double plugin_nodata; //plugin specific nodata value, e.g. -999
66  static const size_t max_buffered_lines; //how many lines to keep in buffer to check for duplicates?
67  static const char* dflt_extension;
68 };
69 
70 } //namespace
71 #endif
This plugin reads data as they come out of ALPUG stations, in ASCII.
Definition: ALPUG.h:37
ALPUG(const ALPUG &)
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: ALPUG.cc:212
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: ALPUG.cc:356
ALPUG(const std::string &configfile)
Definition: ALPUG.cc:84
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
Definition: Config.cc:30