MeteoIODoc 20240428.aefd3c94
GeotopIO.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2009 EPFL */
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 GEOTOPIO_H
20#define GEOTOPIO_H
21
22#include <meteoio/IOInterface.h>
23
24#include <string>
25
26namespace mio {
27
36class GeotopIO : public IOInterface {
37 public:
38 GeotopIO(const std::string& configfile);
40 GeotopIO(const Config&);
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 virtual void writeMeteoData(const std::vector< std::vector<MeteoData> >& vecMeteo, const std::string& name="");
47
48 private:
49 std::string getValueForKey(const std::string& line);
50 void initParamNames(std::map<std::string, size_t>& mapParam);
51 void readMetaData(const std::string& metafile);
52 void identify_fields(const std::vector<std::string>& tmpvec, const std::string& filename,
53 std::vector<size_t>& indices, MeteoData& md);
54 void convertUnits(MeteoData& meteo);
55 void convertUnitsBack(MeteoData& meteo);
56 void parseDate(const std::string& datestring, const std::string& fileandline, Date& date);
57 void parseMetaData(const std::string& head, const std::string& datastr, std::vector<std::string>& tmpvec);
58
59 const Config cfg;
60 double in_tz, out_tz;
61 size_t nr_of_stations;
62 std::vector< std::map <Date, std::streampos> > vec_streampos; //in order to save file pointers
63 std::vector<mio::StationData> vecStation;
64 std::map<std::string, size_t> mapColumnNames;
65 static const double plugin_nodata; //plugin specific nodata value, e.g. -999
66 std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
67 static const size_t sw_direct, sw_diffuse, cloud_factor;
68};
69
70} //end namespace
71
72#endif
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
This class enables the access meteo data in legacy Geotop format.
Definition: GeotopIO.h:36
GeotopIO(const std::string &configfile)
Definition: GeotopIO.cc:70
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: GeotopIO.cc:209
virtual void readStationData(const Date &date, std::vector< StationData > &vecStation)
Fill vecStation with StationData objects for a certain date of interest.
Definition: GeotopIO.cc:196
virtual void writeMeteoData(const std::vector< std::vector< MeteoData > > &vecMeteo, const std::string &name="")
Write vecMeteo time series to a certain destination.
Definition: GeotopIO.cc:101
GeotopIO(const GeotopIO &)
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:31