48 typedef struct GRID_POINT_2D {
53 double&
operator ()(
const size_t& ix,
const size_t& iy);
54 double operator ()(
const size_t& ix,
const size_t& iy)
const;
68 const double&
cellsize,
const Coords& i_llcorner);
71 const double&
cellsize,
const Coords& i_llcorner,
const double& init);
75 Grid2DObject(
const double&
cellsize,
const Coords& i_llcorner,
const Array2D<double>& grid2D_in);
86 const size_t& i_nx,
const size_t& i_ny,
87 const size_t& i_ncols,
const size_t& i_nrows);
97 bool gridify(Coords& point)
const;
109 bool gridify(std::vector<Coords>& vec_points,
const bool& keep_invalid=
false)
const;
110 bool gridify(std::vector<StationData>& vec_points,
const bool& keep_invalid=
false)
const;
119 void set(
const size_t& ncols,
const size_t& nrows,
120 const double&
cellsize,
const Coords& i_llcorner);
128 void set(
const double&
cellsize,
const Coords& i_llcorner,
const Array2D<double>& grid2D_in);
130 void set(
const size_t& ncols,
const size_t& nrows,
131 const double&
cellsize,
const Coords& i_llcorner,
const double& init);
139 void rescale(
const double& i_cellsize);
147 void size(
size_t& o_ncols,
size_t& o_nrows)
const;
149 size_t getNx()
const;
150 size_t getNy()
const;
187 void binning(
const std::vector<double>& thresholds,
const std::vector<double>& ids);
194 std::vector< double >
extractPoints(
const std::vector< std::pair<size_t, size_t> >& Pts)
const;
246 static double calculate_XYcellsize(
const std::vector<double>& vecX,
const std::vector<double>& vecY);
size_t iy
grid index along Y
Definition: Grid2DObject.h:50
size_t ix
grid index along X
Definition: Grid2DObject.h:49
structure to contain the grid coordinates of a point in a 2D grid
Definition: Grid2DObject.h:48
A class to handle geographic coordinate systems. This class offers an easy way to transparently conve...
Definition: Coords.h:83
A class to represent 2D Grids. Typical application as DEM or Landuse Model.
Definition: Grid2DObject.h:42
bool grid_to_WGS84(Coords &point) const
Converts grid coordinates (i,j) into WGS84 coordinates.
Definition: Grid2DObject.cc:236
bool isLatlon() const
Definition: Grid2DObject.h:242
bool operator!=(const Grid2DObject &in) const
Operator that tests for inequality.
Definition: Grid2DObject.cc:144
bool allNodata() const
Definition: Grid2DObject.cc:474
Grid2DObject & operator=(const double &value)
Assignement operator.
Definition: Grid2DObject.cc:31
const Grid2DObject operator+(const double &rhs) const
Definition: Grid2DObject.cc:41
Grid2DObject & operator+=(const double &rhs)
Definition: Grid2DObject.cc:36
const std::string toString() const
Definition: Grid2DObject.cc:583
double ur_lat
Definition: Grid2DObject.h:250
double calculate_cellsize(const double &i_ur_lat, const double &i_ur_lon) const
Definition: Grid2DObject.cc:547
double cellsize
dimension in meters of a cell (considered to be square)
Definition: Grid2DObject.h:223
Grid2DObject()
Default constructor. Initializes all variables to 0, except lat/long which are initialized to IOUtils...
Definition: Grid2DObject.cc:152
void set(const size_t &ncols, const size_t &nrows, const double &cellsize, const Coords &i_llcorner)
Set all variables in one go.
Definition: Grid2DObject.cc:338
Array2D< double > grid2D
the grid itself (simple 2D table containing the values for each point)
Definition: Grid2DObject.h:221
double getMin() const
Definition: Grid2DObject.cc:453
const Grid2DObject operator*(const double &rhs) const
Definition: Grid2DObject.cc:93
bool gridify(Coords &point) const
Compute the positional parameters that are not already known This means that the Coords::point object...
Definition: Grid2DObject.cc:218
size_t getNx() const
Definition: Grid2DObject.cc:445
double getMean() const
Definition: Grid2DObject.cc:461
bool isSameGeolocalization(const Grid2DObject &target) const
check if the current Grid2DObject has the same geolocalization attributes as another Grid2DObject (as...
Definition: Grid2DObject.cc:488
Grid2DObject & operator/=(const double &rhs)
Definition: Grid2DObject.cc:114
void rescale(const double &i_cellsize)
Rescale (bilinear resampling) the grid to match the given cell size.
Definition: Grid2DObject.cc:367
std::vector< double > extractPoints(const std::vector< std::pair< size_t, size_t > > &Pts) const
extract point values from grid
Definition: Grid2DObject.cc:519
void reproject()
Definition: Grid2DObject.cc:562
Grid2DObject & operator-=(const double &rhs)
Definition: Grid2DObject.cc:62
void setValues(const double &cellsize, const Coords &i_llcorner)
Definition: Grid2DObject.cc:482
size_t size() const
Definition: Grid2DObject.cc:441
double & operator()(const size_t &ix, const size_t &iy)
Definition: Grid2DObject.cc:567
void compute_spatial_mean(const double &radius)
Spatially average the grid over a given radius.
Definition: Grid2DObject.cc:382
double getMax() const
Definition: Grid2DObject.cc:457
bool operator==(const Grid2DObject &in) const
Operator that tests for equality.
Definition: Grid2DObject.cc:140
friend std::ostream & operator<<(std::ostream &os, const Grid2DObject &grid)
Definition: Grid2DObject.cc:594
void clear()
deletes the data, but keeps geolocalization
Definition: Grid2DObject.cc:466
bool isLatLon
Definition: Grid2DObject.h:251
const Grid2DObject operator/(const double &rhs) const
Definition: Grid2DObject.cc:119
double ur_lon
Definition: Grid2DObject.h:250
bool WGS84_to_grid(Coords &point) const
Converts WGS84 coordinates into grid coordinates (i,j)
Definition: Grid2DObject.cc:286
size_t getNy() const
Definition: Grid2DObject.cc:449
const Grid2DObject operator-(const double &rhs) const
Definition: Grid2DObject.cc:67
friend std::istream & operator>>(std::istream &is, Grid2DObject &grid)
Definition: Grid2DObject.cc:604
Grid2DObject & operator*=(const double &rhs)
Definition: Grid2DObject.cc:88
void setLatLon(const double &i_ur_lat, const double &i_ur_lon)
Definition: Grid2DObject.h:248
Coords llcorner
lower left corner of the grid
Definition: Grid2DObject.h:222
void binning(const std::vector< double > &thresholds, const std::vector< double > &ids)
Partitional algorithm to classify each point of the grid into a 'bin'. The classification is given by...
Definition: Grid2DObject.cc:500
bool empty() const
Check if a grid does not contain any data (but it can contain geolocalization)
Definition: Grid2DObject.cc:470
static double calculate_XYcellsize(const std::vector< double > &vecX, const std::vector< double > &vecY)
Definition: Grid2DObject.cc:535
Definition: GridsManager.h:33
A class representing the IO Layer of the software Alpine3D. For each type of IO (File,...
Definition: IOInterface.h:98