WSL/SLF GitLab Repository

2D_interpolations.cc 1.18 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 a basic example of spatial interpolations. 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 and interpolate 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
15
	std::vector<MeteoData> vecMeteo;
	std::vector<StationData> vecStation;

	//initializing the io handlers according to the config file
	ConfigReader cfg("io.ini");
16
17
	IOHandler raw_io(cfg);
	BufferedIOHandler io(raw_io, cfg);
18
19
20

	//reading the dem (necessary for several spatial interpolations algoritms)
	DEMObject dem;
21
	io.readDEM(dem);
22

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

	//performing spatial interpolations
	Meteo2DInterpolator mi(cfg, dem, vecMeteo, vecStation);
30
31
	Grid2DObject param;
	mi.interpolate(MeteoData::RH, param);
32
33

	//writing out the spatial interpolation
34
	io.write2DGrid(param,"rh.asc");
35
36
37

	return 0;
}