WSL/SLF GitLab Repository

MeteoProcessor.h 3.02 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/***********************************************************************************/
/*  Copyright 2009 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 __METEOPROCESSOR_H__
#define __METEOPROCESSOR_H__

#include <meteoio/MeteoData.h>
#include <meteoio/StationData.h>
23
#include <meteoio/Config.h>
24
#include <meteoio/Meteo1DInterpolator.h>
25
#include <meteoio/meteofilters/ProcessingStack.h>
26
27

#include <vector>
28
#include <set>
29
30
31
32
33
34
35
36
37
38
39
40

namespace mio {

/**
 * @class MeteoProcessor
 * @brief A facade class that invokes the processing of the filters and the resampling
 * @author Thomas Egger
 * @date   2010-06-25
 */

class MeteoProcessor {
	public:
41
42
43
44
45
46
		/**
		 * @brief The default constructor - Set up a processing stack for each parameter
		 *        The different stacks are created on the heap and pointers to the objects
		 *        are stored in the map<string,ProcessingStack*> object processing_stack
		 * @param[in] cfg Config object that holds the config of the filters in the [Filters] section
		 */
47
		MeteoProcessor(const Config& cfg);
48
49
50
51
52

		/**
		 * @brief The destructor - It is necessary because the ProcessingStack objects referenced in
		 *        the map<string, ProcessingStack*> processing_stack have to be freed from the heap
		 */
53
54
		~MeteoProcessor();

55
		/**
56
		 * @brief A function that executes all the filters for all meteo parameters
57
		 *        configuered by the user
58
59
		 * @param[in] ivec The raw sequence of MeteoData objects for all stations
		 * @param[in] ovec The filtered output of MeteoData object for all stations
60
61
		 * @param[in] second_pass Whether this is the second pass (check only filters)
		 */
62
		void process(const std::vector< std::vector<MeteoData> >& ivec,
63
		             std::vector< std::vector<MeteoData> >& ovec, const bool& second_pass=false);
64

65
		bool resample(const Date& date, const std::vector<MeteoData>& ivec, MeteoData& md);
66

67
		void getWindowSize(ProcessingProperties& o_properties) const;
68

69
		const std::string toString() const;
70

71
 	private:
72
73
		static void getParameters(const Config& cfg, std::set<std::string>& set_parameters);
		static void compareProperties(const ProcessingProperties& newprop, ProcessingProperties& current);
74

75
		Meteo1DInterpolator mi1d;
76
		std::map<std::string, ProcessingStack*> processing_stack;
77
78
79
80
};
} //end namespace

#endif