MeteoIODoc 20240418.14865e3c
GeneratorAlgorithms.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2013 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 GENERATORALGORITHMS_H
20#define GENERATORALGORITHMS_H
21
23#include <meteoio/Config.h>
24
25#include <vector>
26#include <set>
27#include <string>
28
29#ifdef _MSC_VER
30 #pragma warning(disable:4512) //we don't need any = operator!
31#endif
32
33namespace mio {
34
112 public:
114 //fill one MeteoData, for one station. This is used by the dataGenerators
115 virtual bool generate(const size_t& param, MeteoData& md, const std::vector<MeteoData>& vecMeteo) = 0;
116
126 virtual bool create(const size_t& param, const size_t& ii_min, const size_t& ii_max, std::vector<MeteoData>& vecMeteo) = 0;
127
133 bool skipStation(const std::string& station_id) const;
134
140 bool skipTimeStep(const Date& dt) const;
141
142 std::vector<DateRange> getTimeRestrictions() const {return time_restrictions;}
143 std::string getAlgo() const {return algo;}
144 protected:
145 GeneratorAlgorithm(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& i_algo, const std::string& i_section, const double& TZ);
146 virtual void parse_args(const std::vector< std::pair<std::string, std::string> >& /*vecArgs*/) {}
147 static std::set<std::string> initStationSet(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& keyword);
148
149 const std::vector<DateRange> time_restrictions;
150 const std::set<std::string> excluded_stations, kept_stations;
151 const std::string algo, section;
152
153 //These are used by several generators in order work with radiation data by looking at HS and deciding which albedo should be used
154 static const double soil_albedo, snow_albedo, snow_thresh;
155};
156
158 public:
159 static GeneratorAlgorithm* getAlgorithm(const Config& cfg, const std::string& i_algoname, const std::string& i_section, const std::vector< std::pair<std::string, std::string> >& vecArgs);
160};
161
162} //end namespace mio
163
164#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
Definition: GeneratorAlgorithms.h:157
static GeneratorAlgorithm * getAlgorithm(const Config &cfg, const std::string &i_algoname, const std::string &i_section, const std::vector< std::pair< std::string, std::string > > &vecArgs)
Definition: GeneratorAlgorithms.cc:143
Interface class for the generator models.
Definition: GeneratorAlgorithms.h:111
static const double soil_albedo
Definition: GeneratorAlgorithms.h:154
std::string getAlgo() const
Definition: GeneratorAlgorithms.h:143
bool skipTimeStep(const Date &dt) const
Should this timestep be skipped, based on user-provided time restrictions?
Definition: GeneratorAlgorithms.cc:215
virtual bool create(const size_t &param, const size_t &ii_min, const size_t &ii_max, std::vector< MeteoData > &vecMeteo)=0
Fill one time series of MeteoData for one station.
const std::string algo
Definition: GeneratorAlgorithms.h:151
const std::set< std::string > excluded_stations
Definition: GeneratorAlgorithms.h:150
const std::set< std::string > kept_stations
Definition: GeneratorAlgorithms.h:150
static std::set< std::string > initStationSet(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &keyword)
Definition: GeneratorAlgorithms.cc:191
std::vector< DateRange > getTimeRestrictions() const
Definition: GeneratorAlgorithms.h:142
const std::vector< DateRange > time_restrictions
Definition: GeneratorAlgorithms.h:149
GeneratorAlgorithm(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &i_algo, const std::string &i_section, const double &TZ)
protected constructor only to be called by children
Definition: GeneratorAlgorithms.cc:188
virtual ~GeneratorAlgorithm()
Definition: GeneratorAlgorithms.h:113
virtual bool generate(const size_t &param, MeteoData &md, const std::vector< MeteoData > &vecMeteo)=0
static const double snow_thresh
Definition: GeneratorAlgorithms.h:154
const std::string section
Definition: GeneratorAlgorithms.h:151
static const double snow_albedo
Definition: GeneratorAlgorithms.h:154
bool skipStation(const std::string &station_id) const
Should this station be skipped, based on user-provided station ID restrictions?
Definition: GeneratorAlgorithms.cc:207
virtual void parse_args(const std::vector< std::pair< std::string, std::string > > &)
Definition: GeneratorAlgorithms.h:146
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:107
Definition: Config.cc:31