MeteoIODoc  2.10.0
libresampling2D.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: LGPL-3.0-or-later
2 /***********************************************************************************/
3 /* Copyright 2011 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 LIBRESAMPLING2D_H
20 #define LIBRESAMPLING2D_H
21 
22 #include <meteoio/dataClasses/Grid2DObject.h> //this contains Array2D
23 
24 #include <iostream>
25 #include <string>
26 
27 namespace mio {
28 
38  public:
39  //Available algorithms
40  static const Grid2DObject Nearest(const Grid2DObject &i_grid, const double &factor);
41  static const Grid2DObject Bilinear(const Grid2DObject &i_grid, const double &factor);
42  static const Grid2DObject cubicBSpline(const Grid2DObject &i_grid, const double &factor);
43 
44  static const Array2D<double> Nearest(const Array2D<double> &i_grid, const double &factor_x, const double &factor_y);
45  static const Array2D<double> Bilinear(const Array2D<double> &i_grid, const double &factor_x, const double &factor_y);
46  static const Array2D<double> cubicBSpline(const Array2D<double> &i_grid, const double &factor_x, const double &factor_y);
47 
48  private:
49  static void cubicBSpline(Array2D<double> &o_grid, const Array2D<double> &i_grid);
50  static void Bilinear(Array2D<double> &o_grid, const Array2D<double> &i_grid);
51  static void Nearest(Array2D<double> &o_grid, const Array2D<double> &i_grid);
52 
53  static double bilinear_pixel(const Array2D<double> &i_grid, const size_t &org_ii, const size_t &org_jj, const size_t &org_ncols, const size_t &org_nrows, const double &x, const double &y);
54  static double BSpline_weight(const double &x);
55 };
56 } //end namespace
57 
58 #endif
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
Spatial resampling algorithms.
Definition: libresampling2D.h:37
static const Grid2DObject Bilinear(const Grid2DObject &i_grid, const double &factor)
Bilinear spatial data resampling.
Definition: libresampling2D.cc:49
static const Grid2DObject Nearest(const Grid2DObject &i_grid, const double &factor)
Definition: libresampling2D.cc:30
static const Grid2DObject cubicBSpline(const Grid2DObject &i_grid, const double &factor)
Definition: libresampling2D.cc:65
Definition: Config.cc:30