MeteoIODoc 20260620.13b5b0a5
Environmental timeseries pre-processing
Loading...
Searching...
No Matches
ResamplingStack.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2026 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 RESAMPLINGSTACK_H
20#define RESAMPLINGSTACK_H
21
24#include <meteoio/Config.h>
25
26#include <string>
27#include <vector>
28#include <memory>
29
30namespace mio {
31
33 public:
34 ResamplingStack(const Config& cfg, const std::string& i_gap_size_key, const std::string& parname, const IOUtils::OperationMode &mode=IOUtils::STD, const char& rank=1, const bool& isDefault=false);
35
36 void addAlgorithm(std::shared_ptr<ResamplingAlgorithms> algo, const double& max_gap_size);
37 std::vector<std::shared_ptr<ResamplingAlgorithms>> buildStack(const ResamplingAlgorithms::gap_info& gap) const;
38
39 void resetResampling();
40 void resample(const std::string &stationHash, const size_t &index, const ResamplingAlgorithms::ResamplingPosition elementpos, const size_t &par_idx, const std::vector<MeteoData> &vecM, MeteoData &md, const double& max_gap_size) const;
41 std::string getStackStr() const;
42 //double getMaxGapSize() const;
43 bool empty() const;
44
45 private:
46 // Helper methods for stack construction
47 double getDefaultMaxGapSize(const Config& cfg);
48 void processAlgorithm(const Config& cfg, const std::string& parname,
49 const std::pair<std::string, std::string>& key_algo,
50 const IOUtils::OperationMode &mode,
51 const char& rank);
52 size_t extractAlgorithmIndex(const std::string& key);
53 void checkDeprecatedSyntax(const Config& cfg, const std::string& parname,
54 const std::string& algo_name);
55 void handleAccumulateAlgorithm(std::vector<std::pair<std::string, std::string>>& vecArgs,
56 const std::string& algo_name,
57 const Config& cfg,
58 const IOUtils::OperationMode &mode,
59 const char& rank);
60
61 private:
62 std::vector<std::shared_ptr<ResamplingAlgorithms>> stack;
63 static const std::string interpol_section, interpol_pattern, arguments_ini_key;
64 std::string gap_size_key;
65 double max_gap_size_dflt_sec;
66};
67
68} //end namespace
69
70#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition Config.h:79
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition MeteoData.h:108
ResamplingPosition
Definition ResamplingAlgorithms.h:57
Definition ResamplingStack.h:32
std::string getStackStr() const
Definition ResamplingStack.cc:184
void resample(const std::string &stationHash, const size_t &index, const ResamplingAlgorithms::ResamplingPosition elementpos, const size_t &par_idx, const std::vector< MeteoData > &vecM, MeteoData &md, const double &max_gap_size) const
Definition ResamplingStack.cc:154
std::vector< std::shared_ptr< ResamplingAlgorithms > > buildStack(const ResamplingAlgorithms::gap_info &gap) const
bool empty() const
Definition ResamplingStack.cc:182
void resetResampling()
Definition ResamplingStack.cc:149
void addAlgorithm(std::shared_ptr< ResamplingAlgorithms > algo, const double &max_gap_size)
OperationMode
Keywords for mode of operation. Please keep all the GRID_xxx last!
Definition IOUtils.h:63
@ STD
default: extract timeseries from timeseries or grids from grids or spatially interpolate timeseries
Definition IOUtils.h:64
Definition Config.cc:34