MeteoIODoc  2.10.0
Meteo2DInterpolator.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 /***********************************************************************************/
3 /* Copyright 2014 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 
20 #ifndef METEO2DINTERPOLATOR_H
21 #define METEO2DINTERPOLATOR_H
22 
24 #include <meteoio/Config.h>
29 
30 #include <vector>
31 #include <map>
32 
33 namespace mio {
34 
35 class InterpolationAlgorithm;
36 
98  public:
102  Meteo2DInterpolator(const Config& i_cfg, TimeSeriesManager& i_tsmanager, GridsManager& i_gridsmanager);
105 
107 
119  std::string interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
120  Grid2DObject& result, const bool& quiet=false);
121 
122  std::string interpolate(const Date& date, const DEMObject& dem, const std::string& param_name,
123  Grid2DObject& result, const bool& quiet=false);
124 
125  std::string interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
126  std::vector<Coords> vec_coords, std::vector<double>& result, const bool& quiet=false);
127 
128  std::string interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
129  std::vector<StationData> vec_stations, std::vector<double>& result, const bool& quiet=false);
130 
138  std::vector< std::pair<std::string, std::string> > getArgumentsForAlgorithm(const std::string& parname,
139  const std::string& algorithm, const std::string& section) const;
140 
141  const std::string toString() const;
142 
143  private:
144  static void checkMinMax(const double& minval, const double& maxval, Grid2DObject& gridobj);
145  static void check_projections(const DEMObject& dem, const std::vector<MeteoData>& vec_meteo);
146  static std::set<std::string> getParameters(const Config& i_cfg);
147  static std::vector<std::string> getAlgorithmsForParameter(const Config& i_cfg, const std::string& parname);
148 
149  void setAlgorithms();
150 
151  const Config& cfg;
152  TimeSeriesManager *tsmanager;
153  GridsManager *gridsmanager;
154  GridBuffer grid_buffer;
155 
156  std::map< std::string, std::vector<InterpolationAlgorithm*> > mapAlgorithms; //per parameter interpolation algorithms
157 
158  bool algorithms_ready;
159  bool use_full_dem;
160 };
161 
162 } //end namespace
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 represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:40
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
A class to buffer gridded data. This class buffers Grid2D objects. It implements a proper ring buffer...
Definition: Buffer.h:157
Definition: GridsManager.h:33
A class to spatially interpolate meteo parameters. For more, see Spatial interpolations.
Definition: Meteo2DInterpolator.h:97
const std::string toString() const
Definition: Meteo2DInterpolator.cc:334
~Meteo2DInterpolator()
Definition: Meteo2DInterpolator.cc:58
std::vector< std::pair< std::string, std::string > > getArgumentsForAlgorithm(const std::string &parname, const std::string &algorithm, const std::string &section) const
Retrieve the arguments vector for a given interpolation algorithm.
Definition: Meteo2DInterpolator.cc:135
Meteo2DInterpolator & operator=(const Meteo2DInterpolator &)
Assignement operator.
Definition: Meteo2DInterpolator.cc:45
std::string interpolate(const Date &date, const DEMObject &dem, const MeteoData::Parameters &meteoparam, Grid2DObject &result, const bool &quiet=false)
A generic function that can interpolate for any given MeteoData member variable.
Definition: Meteo2DInterpolator.cc:152
Meteo2DInterpolator(const Config &i_cfg, TimeSeriesManager &i_tsmanager, GridsManager &i_gridsmanager)
Constructor.
Definition: Meteo2DInterpolator.cc:27
Parameters
this enum provides indexed access to meteorological fields
Definition: MeteoData.h:144
Definition: TimeSeriesManager.h:31
Definition: Config.cc:30