WSL/SLF GitLab Repository

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

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

6
//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
7
//provide date as ISO formatted, for example 2008-12-01T15:35:00 and
8
//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

	//initializing the io handlers according to the config file
13
	Config cfg("io.ini");
14
	IOManager io(cfg);
15
16
17

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

20
	//we assume that the time given on the command line is in TZ=+1
21
	IOUtils::convertString(d1,argv[1], 1.);
22
23

	//performing spatial interpolations
24
	Grid2DObject param;
25
	io.interpolate(d1, dem, MeteoData::TA, param);
26
	io.write2DGrid(param, MeteoGrids::TA, d1);
27
28
	io.interpolate(d1, dem, MeteoData::HNW, param);
	io.write2DGrid(param, MeteoGrids::HNW, d1);
29
	io.interpolate(d1, dem, MeteoData::RH, param);
30
	io.write2DGrid(param, MeteoGrids::RH, d1);
31
32
33

	return 0;
}