MeteoIODoc 20240426.aefd3c94
ProcAggregate.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2009 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef PROCAGGREGATE_H
20#define PROCAGGREGATE_H
21
23#include <vector>
24#include <string>
25
26namespace mio {
27
61 public:
62 ProcAggregate(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg);
63
64 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
65 std::vector<MeteoData>& ovec);
66
67 private:
68 typedef enum AGGREGATE_TYPE {
69 min_agg,
70 max_agg,
71 mean_agg,
72 median_agg,
73 step_sum,
74 wind_avg_agg
75 } aggregate_type;
76
77 void parse_args(const std::vector< std::pair<std::string, std::string> >& vecArgs);
78 static void sumOverLastStep(std::vector<MeteoData>& ovec, const unsigned int& param);
79 static double calc_min(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end);
80 static double calc_max(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end);
81 static double calc_mean(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end);
82 static double calc_median(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end);
83 static double calc_wind_avg(const std::vector<MeteoData>& ivec, const unsigned int& param, const size_t& start, const size_t& end);
84
85 aggregate_type type;
86};
87
88} //end namespace
89
90#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
Data aggregation.
Definition: ProcAggregate.h:60
ProcAggregate(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
Definition: ProcAggregate.cc:27
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
Definition: ProcAggregate.cc:39
Definition: WindowedFilter.h:35
Definition: Config.cc:31