MeteoIODoc 20241221.207bde49
GridResamplingAlgorithms.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2021 MobyGIS Srl, Trento, Italy */
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
20#ifndef GRIDRESAMPLINGALGORITHM_H
21#define GRIDRESAMPLINGALGORITHM_H
22
25#include <meteoio/IOUtils.h>
26
27#include <string>
28#include <vector>
29
30namespace mio {
31
39
40 public:
41 GridResamplingAlgorithm(const std::string& algorithm, const std::string& i_parname, const double& dflt_window_size, const std::vector< std::pair<std::string, std::string> >& /*vecArgs*/);
42 virtual ~GridResamplingAlgorithm() = default;
43
44 void setWindowSize(const double& window_size);
45 virtual void resample(const Date& date, const std::map<Date, Grid2DObject>& all_grids, Grid2DObject& resampled_grid) = 0;
46 virtual std::string toString() const = 0;
47
48 protected:
49 const std::string algo, parname;
51};
52
58 public:
59 static GridResamplingAlgorithm* getAlgorithm(const std::string& i_algorithm, const std::string& parname,
60 const double& grid_window_size, const std::vector< std::pair<std::string, std::string> >& vecArgs, const Config& cfg);
61};
62
63} //end namespace
64
65#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 to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
Interface class for grid resampling algorithms.
Definition: GridResamplingAlgorithms.h:38
virtual ~GridResamplingAlgorithm()=default
const std::string algo
Definition: GridResamplingAlgorithms.h:49
virtual void resample(const Date &date, const std::map< Date, Grid2DObject > &all_grids, Grid2DObject &resampled_grid)=0
const std::string parname
Definition: GridResamplingAlgorithms.h:49
virtual std::string toString() const =0
void setWindowSize(const double &window_size)
Set this algorithm's window size to something other than the default value.
Definition: GridResamplingAlgorithms.cc:75
double grid_window_size
Definition: GridResamplingAlgorithms.h:50
GridResamplingAlgorithm(const std::string &algorithm, const std::string &i_parname, const double &dflt_window_size, const std::vector< std::pair< std::string, std::string > > &)
Facade constructor for a generic grid resampling algorithm.
Definition: GridResamplingAlgorithms.cc:63
Object factory for temporal grid resampling algorithms.
Definition: GridResamplingAlgorithms.h:57
static GridResamplingAlgorithm * getAlgorithm(const std::string &i_algorithm, const std::string &parname, const double &grid_window_size, const std::vector< std::pair< std::string, std::string > > &vecArgs, const Config &cfg)
Object factory for temporal grid resampling algorithms.
Definition: GridResamplingAlgorithms.cc:91
Definition: Config.cc:31