MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProcAggregate.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef PROCAGGREGATE_H
19 #define PROCAGGREGATE_H
20 
22 #include <vector>
23 #include <string>
24 
25 namespace mio {
26 
52 class ProcAggregate : public WindowedFilter {
53  public:
54  ProcAggregate(const std::vector<std::string>& vec_args, const std::string& name);
55 
56  virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
57  std::vector<MeteoData>& ovec);
58 
59  private:
60  typedef enum AGGREGATE_TYPE {
61  min_agg,
62  max_agg,
63  mean_agg,
64  median_agg,
65  wind_avg_agg
66  } aggregate_type;
67 
68  void parse_args(std::vector<std::string> vec_args);
69  double calc_min(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end) const;
70  double calc_max(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end) const;
71  double calc_mean(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end) const;
72  double calc_median(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end) const;
73  double calc_wind_avg(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end) const;
74 
75  aggregate_type type;
76 };
77 
78 } //end namespace
79 
80 #endif
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
Definition: ProcAggregate.cc:38
Data aggregation. This aggregates the input data over the defined window with the defined aggregation...
Definition: ProcAggregate.h:52
ProcAggregate(const std::vector< std::string > &vec_args, const std::string &name)
Definition: ProcAggregate.cc:26
Definition: WindowedFilter.h:34