MeteoIODoc  MeteoIODoc-2.6.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Meteo2DInterpolator.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2014 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3 /***********************************************************************************/
4 /* This file is part of MeteoIO.
5  MeteoIO is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  MeteoIO is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef METEO2DINTERPOLATOR_H
20 #define METEO2DINTERPOLATOR_H
21 
23 #include <meteoio/Config.h>
28 
29 #include <vector>
30 #include <map>
31 
32 namespace mio {
33 
34 class InterpolationAlgorithm;
35 
100  public:
104  Meteo2DInterpolator(const Config& i_cfg, TimeSeriesManager& i_tsmanager, GridsManager& i_gridsmanager);
107 
109 
111  typedef enum VSTATIONS_POLICY {
116 
126  void interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
127  Grid2DObject& result);
128 
139  void interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
140  Grid2DObject& result, std::string& InfoString);
141 
142  void interpolate(const Date& date, const DEMObject& dem, const MeteoData::Parameters& meteoparam,
143  const std::vector<Coords>& in_coords, std::vector<double>& result, std::string& info_string);
144 
151  size_t getArgumentsForAlgorithm(const std::string& param,
152  const std::string& algorithm,
153  std::vector<std::string>& vecArgs) const;
154 
160  size_t getVirtualStationsMeta(const Date& date, STATIONS_SET& vecStation);
161 
168  size_t getVirtualMeteoData(const vstations_policy& strategy, const Date& i_date, METEO_SET& vecMeteo);
169 
170  const std::string toString() const;
171 
172  private:
173  static Config stripVirtualConfig(const Config& cfg);
174  static void checkMinMax(const double& minval, const double& maxval, Grid2DObject& gridobj);
175  static void check_projections(const DEMObject& dem, const std::vector<MeteoData>& vec_meteo);
176  static size_t get_parameters(const Config& cfg, std::set<std::string>& set_parameters);
177  static size_t getAlgorithmsForParameter(const Config& cfg, const std::string& parname, std::vector<std::string>& vecAlgorithms);
178 
179  size_t getVirtualStationsData(const Date& i_date, METEO_SET& vecMeteo);
180  size_t getVirtualStationsFromGrid(const Date& i_date, METEO_SET& vecMeteo);
181  void setAlgorithms();
182  void initVirtualStations(const bool& adjust_coordinates);
183 
184  const Config& cfg;
185  TimeSeriesManager *tsmanager;
186  GridsManager *gridsmanager;
187  GridBuffer grid_buffer;
188 
189  std::map< std::string, std::vector<InterpolationAlgorithm*> > mapAlgorithms; //per parameter interpolation algorithms
190 
191  std::vector<size_t> v_params;
192  std::vector<Coords> v_coords;
193  std::vector<StationData> v_stations;
194 
195  bool algorithms_ready;
196  bool use_full_dem;
197  bool use_internal_managers;
198 };
199 
200 } //end namespace
201 
202 #endif
size_t getVirtualStationsMeta(const Date &date, STATIONS_SET &vecStation)
Returns the metadata associated with the configured virtual stations.
Definition: Meteo2DInterpolator.cc:449
extract all relevant grid points from a provided grid
Definition: Meteo2DInterpolator.h:114
std::vector< MeteoData > METEO_SET
Definition: MeteoData.h:29
size_t getVirtualMeteoData(const vstations_policy &strategy, const Date &i_date, METEO_SET &vecMeteo)
Compute point measurements from grids following a given computing strategy.
Definition: Meteo2DInterpolator.cc:370
~Meteo2DInterpolator()
Definition: Meteo2DInterpolator.cc:142
vstations_policy
Keywords for virtual stations strategy.
Definition: Meteo2DInterpolator.h:111
Meteo2DInterpolator(const Config &i_cfg, TimeSeriesManager &i_tsmanager, GridsManager &i_gridsmanager)
Constructor.
Definition: Meteo2DInterpolator.cc:87
Definition: GridsManager.h:28
size_t getArgumentsForAlgorithm(const std::string &param, const std::string &algorithm, std::vector< std::string > &vecArgs) const
Retrieve the arguments vector for a given interpolation algorithm.
Definition: Meteo2DInterpolator.cc:327
void interpolate(const Date &date, const DEMObject &dem, const MeteoData::Parameters &meteoparam, Grid2DObject &result)
A generic function that can interpolate for any given MeteoData member variable.
Definition: Meteo2DInterpolator.cc:203
const std::string toString() const
Definition: Meteo2DInterpolator.cc:541
Parameters
Definition: MeteoData.h:119
A class to buffer gridded data. This class buffers Grid2D objects. It implements a proper ring buffer...
Definition: Buffer.h:136
extract virtual stations as specified in the ini file
Definition: Meteo2DInterpolator.h:112
std::vector< StationData > STATIONS_SET
Definition: StationData.h:129
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:58
A class to represent DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:39
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:37
A class to spatially interpolate meteo parameters. For more, see Spatial interpolations.
Definition: Meteo2DInterpolator.h:99
A class to handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:79
Definition: TimeSeriesManager.h:31
extract all grid points from a provided grid
Definition: Meteo2DInterpolator.h:113
Meteo2DInterpolator & operator=(const Meteo2DInterpolator &)
Assignement operator.
Definition: Meteo2DInterpolator.cc:125