MeteoIODoc 2.11.0
ProcQuantileMapping.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2018 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 PROCQUANTILEMAPPING_H
20#define PROCQUANTILEMAPPING_H
21
23#include <vector>
24#include <string>
25
26namespace mio {
27
69 public:
70 ProcQuantileMapping(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg);
71
72 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
73 std::vector<MeteoData>& ovec);
74
75 protected:
76 void correctPeriod(const unsigned int& param, const size_t& idx_start, const size_t& idx_end, const std::vector<MeteoData>& ivec, std::vector<MeteoData>& ovec) const;
77 void writeQuantiles(const std::vector<double>& thresholds, const std::vector<double>& vecX, const std::string& parameter, const std::string& station) const;
78 double getCorrection(const std::vector<double>& thresholds, const double& value) const;
79 static size_t getQuantile(const std::vector<double>& thresholds, const double& value);
80 std::vector< std::pair<size_t, size_t> > getStarts(const std::vector<MeteoData>& ivec) const;
81 void parse_args(const std::vector< std::pair<std::string, std::string> >& vecArgs);
82
83 std::vector<double> quantiles, corrections;
84 std::string root_path;
86 char type;
88};
89
90} //end namespace
91
92#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
Quantile Mapping correction.
Definition: ProcQuantileMapping.h:68
double getCorrection(const std::vector< double > &thresholds, const double &value) const
Definition: ProcQuantileMapping.cc:101
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
Definition: ProcQuantileMapping.cc:37
void writeQuantiles(const std::vector< double > &thresholds, const std::vector< double > &vecX, const std::string &parameter, const std::string &station) const
Definition: ProcQuantileMapping.cc:52
void parse_args(const std::vector< std::pair< std::string, std::string > > &vecArgs)
Definition: ProcQuantileMapping.cc:158
static size_t getQuantile(const std::vector< double > &thresholds, const double &value)
Definition: ProcQuantileMapping.cc:109
void correctPeriod(const unsigned int &param, const size_t &idx_start, const size_t &idx_end, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec) const
Definition: ProcQuantileMapping.cc:75
double period_duration
Definition: ProcQuantileMapping.h:85
ProcQuantileMapping(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
Definition: ProcQuantileMapping.cc:30
std::vector< double > quantiles
Definition: ProcQuantileMapping.h:83
std::vector< double > corrections
Definition: ProcQuantileMapping.h:83
bool write_quantiles
Definition: ProcQuantileMapping.h:87
std::string root_path
Definition: ProcQuantileMapping.h:84
char type
Definition: ProcQuantileMapping.h:86
std::vector< std::pair< size_t, size_t > > getStarts(const std::vector< MeteoData > &ivec) const
Definition: ProcQuantileMapping.cc:123
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
Definition: Config.cc:31