WSL/SLF GitLab Repository

ImisIO.h 4.26 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/***********************************************************************************/
/*  Copyright 2009, 2010 WSL Institute for Snow and Avalanche Research   SLF-DAVOS */
/***********************************************************************************/
/* This file is part of MeteoIO.
    MeteoIO is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    MeteoIO is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with MeteoIO.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __IMISIO_H__
#define __IMISIO_H__

21
#include <meteoio/Config.h>
22
23
24
25
26
#include <meteoio/IOInterface.h>
#include <meteoio/IOUtils.h>
#include <meteoio/Coords.h>
#include <meteoio/IOExceptions.h>
#include <meteoio/DynamicLibrary.h>
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include <string>
#include <sstream>
#include <iostream>
#include <vector>
#include <ctime>
#include <occi.h>

namespace mio {

/**
 * @class ImisIO
 * @brief The class with-in the data from the database are treated. The MeteoData and the StationData will be set in.
 * This class also herited to IOInterface class which is abstract.
 * @author Moustapha Mbengue and Thomas Egger
 * @date 2009-05-12
 */
class ImisIO : public IOInterface {
	public:
46
		ImisIO(void (*delObj)(void*), const Config& i_cfg);
47
48
49

		ImisIO(const std::string& configfile);
		ImisIO(const ImisIO&);
50
		ImisIO(const Config&);
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
		~ImisIO() throw();

		virtual void read2DGrid(Grid2DObject& dem_out, const std::string& parameter="");

		virtual void readDEM(DEMObject& dem_out);
		virtual void readLanduse(Grid2DObject& landuse_out);

		virtual void readStationData(const Date& date, std::vector<StationData>& vecStation);
		virtual void readMeteoData(const Date& dateStart, const Date& dateEnd,
		                           std::vector< std::vector<MeteoData> >& vecMeteo,
		                           std::vector< std::vector<StationData> >& vecStation,
		                           const unsigned int& stationindex=IOUtils::npos);

		virtual void writeMeteoData(const std::vector< std::vector<MeteoData> >& vecMeteo,
		                            const std::vector< std::vector<StationData> >& vecStation,
		                            const std::string& name="");

		virtual void readAssimilationData(const Date&, Grid2DObject& da_out);
		virtual void readSpecialPoints(std::vector<Coords>& pts);

		virtual void write2DGrid(const Grid2DObject& grid_in, const std::string& name);

	private:
		void cleanup() throw();
		void getDBParameters();
		void getStationData(const std::string& stat_abk, const std::string& stao_nr, std::vector<std::string>& data2S);
		void getImisData(const std::string& stat_abk, const std::string& stao_nr,
		                 const std::vector<int>& datestart, const std::vector<int>& dateend,
		                 std::vector< std::vector<std::string> >& dataImis);
		void parseDataSet(const std::vector<std::string>& meteo_in, MeteoData& md);
		void readData(const Date& dateStart, const Date& dateEnd, std::vector< std::vector<MeteoData> >& vecMeteo,
		              std::vector< std::vector<StationData> >& vecStation, const unsigned int& stationindex);
		void readStationNames(std::vector<std::string>& vecStationName);
		void parseStationName(const std::string& stationName, std::string& stName, std::string& stNumber);
		void readStationMetaData();
		void convertUnits(MeteoData& meteo);

88
		static const double in_tz; //timezone
89
		Config cfg;
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
		std::string coordin, coordinparam, coordout, coordoutparam; //projection parameters
		std::vector<StationData> vecMyStation;
		static const double plugin_nodata; //plugin specific nodata value, e.g. -999
		static const std::string sqlQueryMeteoData;
		static const std::string sqlQueryStationData;
		std::string oracleUserName_in;
		std::string oraclePassword_in;
		std::string oracleDBName_in;
		/*std::string oracleUserName_out;
		std::string oraclePassword_out;
		std::string oracleDBName_out;*/
};

} //end namespace mio

#endif