MeteoIODoc 20261004.b9219c1f
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, const double& i_fallback_gap_size=0.0);
35
36 std::vector<std::shared_ptr<ResamplingAlgorithms>> buildStack(const ResamplingAlgorithms::gap_info& gap) const;
37
38 void resetResampling();
39 void resample(const std::string &stationHash, const size_t &pos, const ResamplingAlgorithms::ResamplingPosition elementpos, const size_t &paramindex, const std::vector<MeteoData> &vecM, MeteoData &md) const;
40 std::string getStackStr() const;
41 bool isEmpty() const {return stack.empty();}
42
43 private:
44 // Helper methods for stack construction
45 double getAlgoMaxGapSize(const Config& cfg, const size_t& algo_index, const std::string& parname) const;
46 double getStackMaxGapSize(const double& fallback) const;
47 void processAlgorithm(const Config& cfg, const std::string& parname,
48 const std::pair<std::string, std::string>& key_algo,
49 const IOUtils::OperationMode &mode,
50 const char& rank);
51 static size_t extractAlgorithmIndex(const std::string& key);
52 static void checkDeprecatedSyntax(const Config& cfg, const std::string& parname,
53 const std::string& algo_name);
54 void handleAccumulateAlgorithm(std::vector<std::pair<std::string, std::string>>& vecArgs,
55 const std::string& algo_name,
56 const Config& cfg,
57 const IOUtils::OperationMode &mode,
58 const char& rank);
59
60 private:
61 std::vector<std::shared_ptr<ResamplingAlgorithms>> stack;
62 static const std::string interpol_section, interpol_pattern, arguments_ini_key;
63 const std::string gap_size_key;
64 const double max_gap_size_dflt, max_stack_gap_size; //both in days
65};
66
67} //end namespace
68
69#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition Config.h:79
Stores information about a data gap in a time series.
Definition ResamplingAlgorithms.h:46
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition MeteoData.h:110
ResamplingPosition
Definition ResamplingAlgorithms.h:146
Definition ResamplingStack.h:32
std::string getStackStr() const
Definition ResamplingStack.cc:200
void resample(const std::string &stationHash, const size_t &pos, const ResamplingAlgorithms::ResamplingPosition elementpos, const size_t &paramindex, const std::vector< MeteoData > &vecM, MeteoData &md) const
Perform the resampling for a specific data point.
Definition ResamplingStack.cc:171
std::vector< std::shared_ptr< ResamplingAlgorithms > > buildStack(const ResamplingAlgorithms::gap_info &gap) const
void resetResampling()
Definition ResamplingStack.cc:153
bool isEmpty() const
Definition ResamplingStack.h:41
OperationMode
Keywords for mode of operation. Please keep all the GRID_xxx last!
Definition IOUtils.h:64
@ STD
default: extract timeseries from timeseries or grids from grids or spatially interpolate timeseries
Definition IOUtils.h:65
Definition Config.cc:34