MeteoIODoc 2.11.0
MeteoProcessor.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 METEOPROCESSOR_H
20#define METEOPROCESSOR_H
21
23#include <meteoio/Config.h>
26
27#include <vector>
28#include <set>
29
30namespace mio {
31
40 public:
49 MeteoProcessor(const Config& cfg, const char& rank=1, const IOUtils::OperationMode &mode=IOUtils::STD);
50
56
64 void process(std::vector< std::vector<MeteoData> >& ivec,
65 std::vector< std::vector<MeteoData> >& ovec, const bool& second_pass=false);
66
67 bool resample(const Date& date, const std::string& stationHash, const std::vector<MeteoData>& ivec, MeteoData& md) {return mi1d.resampleData(date, stationHash, ivec, md);}
68
70
71 void getWindowSize(ProcessingProperties& o_properties) const;
72
73 const std::string toString() const;
74
81 static std::set<std::string> initStationSet(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& keyword);
82
91 static std::vector<DateRange> initTimeRestrictions(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& keyword, const std::string& where, const double& TZ);
92
93 private:
94 static std::set<std::string> getParameters(const Config& cfg);
95 static void compareProperties(const ProcessingProperties& newprop, ProcessingProperties& current);
96
98 std::map<std::string, ProcessingStack*> processing_stack;
99 bool enable_meteo_filtering;
100};
101
112 public:
113 RestrictionsIdx() : start(), end(), index(IOUtils::npos) {}
114 RestrictionsIdx(const METEO_SET& vecMeteo, const std::vector<DateRange>& time_restrictions);
115
116 bool isValid() const {return (index != IOUtils::npos);}
117 size_t getStart() const;
118 size_t getEnd() const;
120 const std::string toString() const;
121
122 private:
123 std::vector<size_t> start, end;
124 size_t index;
125};
126
127} //end namespace
128
129#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 handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
A class that can resample MeteoData objects.
Definition: Meteo1DInterpolator.h:103
bool resampleData(const Date &date, const std::string &stationHash, const std::vector< MeteoData > &vecM, MeteoData &md)
A function that executes all the resampling algorithms that have been setup in the constructor.
Definition: Meteo1DInterpolator.cc:112
void resetResampling()
Call each ResamplingAlgorithms to reset its cached data (as might be needed after a rebuffer)
Definition: Meteo1DInterpolator.cc:182
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:107
A facade class that invokes the processing of the filters and the resampling.
Definition: MeteoProcessor.h:39
static std::set< std::string > initStationSet(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword)
built the set of station IDs that a filter should be applied to or excluded from
Definition: MeteoProcessor.cc:108
void getWindowSize(ProcessingProperties &o_properties) const
Definition: MeteoProcessor.cc:70
void process(std::vector< std::vector< MeteoData > > &ivec, std::vector< std::vector< MeteoData > > &ovec, const bool &second_pass=false)
A function that executes all the filters for all meteo parameters configuered by the user.
Definition: MeteoProcessor.cc:96
static std::vector< DateRange > initTimeRestrictions(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword, const std::string &where, const double &TZ)
built the set of time ranges to apply a certain processing to
Definition: MeteoProcessor.cc:124
const std::string toString() const
Definition: MeteoProcessor.cc:170
void resetResampling()
Definition: MeteoProcessor.h:69
MeteoProcessor(const Config &cfg, const char &rank=1, const IOUtils::OperationMode &mode=IOUtils::STD)
The default constructor - Set up a processing stack for each parameter The different stacks are creat...
Definition: MeteoProcessor.cc:27
bool resample(const Date &date, const std::string &stationHash, const std::vector< MeteoData > &ivec, MeteoData &md)
Definition: MeteoProcessor.h:67
~MeteoProcessor()
The destructor - It is necessary because the ProcessingStack objects referenced in the map<string,...
Definition: MeteoProcessor.cc:41
Definition: ProcessingBlock.h:36
Convenience class for processing data with time restriction periods.
Definition: MeteoProcessor.h:111
bool isValid() const
Definition: MeteoProcessor.h:116
size_t getStart() const
Definition: MeteoProcessor.cc:220
RestrictionsIdx()
Definition: MeteoProcessor.h:113
size_t getEnd() const
Definition: MeteoProcessor.cc:226
const std::string toString() const
Definition: MeteoProcessor.cc:242
RestrictionsIdx & operator++()
Definition: MeteoProcessor.cc:232
const size_t npos
npos is the out-of-range value
Definition: IOUtils.h:80
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:31
std::vector< MeteoData > METEO_SET
Definition: MeteoData.h:32