WSL/SLF GitLab Repository

meteo_reading.cc 1.05 KB
Newer Older
1
#include <iostream>
2
#include <meteoio/MeteoIO.h>
3

4
5
using namespace mio; //The MeteoIO namespace is called mio

6
7
8
//This is the most basic example. It does not check any exceptions, it only tries to be as c-like as possible
//provide date as ISO formatted, for example 2008-12-01T15:35:00 and 
//it will retrieve the data for this date according to the io.ini configuration file
9
int main(int /*argc*/, char** argv) {
10
	Date d1;
11
12
13
14
	std::vector<MeteoData> vecMeteo;
	std::vector<StationData> vecStation;

	ConfigReader cfg("io.ini");
15
16
17
	IOHandler raw_io(cfg);
	BufferedIOHandler io(raw_io, cfg);

18
19
	//we assume that the time given on the command line is in TZ=+1
	d1.setTimeZone(1.);
20
	IOUtils::convertString(d1,argv[1]);
21
	io.readMeteoData(d1, vecMeteo, vecStation);
22
23
24
25

	//writing some data out in order to prove that it really worked!
	for (unsigned int ii=0; ii < vecMeteo.size(); ii++) {
		std::cout << "---------- Station: " << (ii+1) << " / " << vecStation.size() << std::endl;
26
27
		std::cout << vecStation[ii] << std::endl;
		std::cout << vecMeteo[ii] << std::endl;
28
29
	}

30
	return 0;
31
}