A class to represent DEMs and automatically compute some properties. This class stores elevation grids and their georeferencing, expressed as the lower-left coordinates, the cellsize (cells are assumed to be square) and a nodata code for potentially empty cells (The nodata parameter is supposed to be IOUtils::nodata). This class also automatically computes local slope, azimuth, curvature, normals and minimal/maximal for normalization. Various algorithms are available to compute these properties (see mio::DEMObject::slope_type) and it is possible to toggle between automatic refresh or not. Several other DEM related values can be computed, such as the horizon, displacements within the DEM, etc.
- Author
- Gaƫl Rosset - Mathias Bavay
- Date
- 2009-07-20
|
| DEMObject (const slope_type &i_algorithm=DFLT) |
| Default constructor. Initializes all variables to 0, except lat/long which are initialized to IOUtils::nodata. More...
|
|
| DEMObject (const size_t &ncols_in, const size_t &nrows_in, const Coords &llcorner_in, const double &init) |
| Constructor that sets a constant DEM. More...
|
|
| DEMObject (const size_t &ncols_in, const size_t &nrows_in, const double &cellsize_in, const Coords &llcorner_in, const slope_type &i_algorithm=DFLT) |
| Constructor that sets variables. More...
|
|
| DEMObject (const double &cellsize_in, const Coords &llcorner_in, const Array2D< double > &altitude_in, const bool &i_update=true, const slope_type &i_algorithm=DFLT) |
| Constructor that sets variables. More...
|
|
| DEMObject (const Grid2DObject &dem_in, const bool &i_update=true, const slope_type &i_algorithm=DFLT) |
| Constructor that sets variables from a Grid2DObject. More...
|
|
| DEMObject (const DEMObject &i_dem, const size_t &i_nx, const size_t &i_ny, const size_t &i_ncols, const size_t &i_nrows, const bool &i_update=true, const slope_type &i_algorithm=DFLT) |
| Constructor that sets variables from a subset of another DEMObject, given an origin (X,Y) (first index being 0) and a number of columns and rows. More...
|
|
void | setDefaultAlgorithm (const std::string &i_algorithm) |
| Sets the default slope calculation algorithm. More...
|
|
void | setDefaultAlgorithm (const slope_type &i_algorithm) |
| Sets the default slope calculation algorithm. More...
|
|
int | getDefaultAlgorithm () const |
| Get the default slope calculation algorithm. More...
|
|
void | setUpdatePpt (const update_type &in_update_flag) |
| Set the properties that will be calculated by the object when updating The following properties can be turned on/off: slope/azimuth and/or normals, and/or curvatures. Flags are combined using the binary "|" operator. More...
|
|
int | getUpdatePpt () const |
| Get the properties that will be calculated by the object when updating. More...
|
|
void | setCurvatureScale (const double &in_curvature_scale) |
| Set the curvature length scale for calculating curvature. More...
|
|
void | update (const std::string &algorithm) |
| Force the computation of the local slope, azimuth, normal vector and curvature. It has to be called manually since it can require some time to compute. Without this call, the above mentionned parameters are NOT up to date. More...
|
|
void | update (const slope_type &algorithm=DFLT) |
| Force the computation of the local slope, azimuth, normal vector and curvature. It has to be called manually since it can require some time to compute. Without this call, the above mentionned parameters are NOT up to date. More...
|
|
void | updateAllMinMax () |
| Recomputes the min/max of altitude, slope and curvature It returns +/- std::numeric_limits<double> ::max() for a given parameter if its grid was empty/undefined. More...
|
|
void | printFailures () |
| Prints the list of points that have an elevation different than nodata but no slope or curvature Such points can happen if they are surrounded by too many points whose elevation is nodata If no such points exist, it prints nothing. More...
|
|
void | sanitize () |
| Clean up the DEM Object When computing the slope and curvature, it is possible to get points where the elevation is known but where no slope/azimuth/normals/curvature could be computed. This method sets the elevation to nodata for such points, so that latter use of the DEM would be simpler (simply test the elevation in order to know if the point can be used and it guarantees that all other information is available). More...
|
|
DEMObject & | operator= (const Grid2DObject &) |
| Assignement operator. More...
|
|
DEMObject & | operator= (const double &value) |
| Assignement operator. More...
|
|
DEMObject & | operator+= (const double &rhs) |
|
const DEMObject | operator+ (const double &rhs) const |
|
DEMObject & | operator+= (const Grid2DObject &rhs) |
|
const DEMObject | operator+ (const Grid2DObject &rhs) const |
|
DEMObject & | operator-= (const double &rhs) |
|
const DEMObject | operator- (const double &rhs) const |
|
DEMObject & | operator-= (const Grid2DObject &rhs) |
|
const DEMObject | operator- (const Grid2DObject &rhs) const |
|
DEMObject & | operator*= (const double &rhs) |
|
const DEMObject | operator* (const double &rhs) const |
|
DEMObject & | operator*= (const Grid2DObject &rhs) |
|
const DEMObject | operator* (const Grid2DObject &rhs) const |
|
DEMObject & | operator/= (const double &rhs) |
|
const DEMObject | operator/ (const double &rhs) const |
|
DEMObject & | operator/= (const Grid2DObject &rhs) |
|
const DEMObject | operator/ (const Grid2DObject &rhs) const |
|
bool | operator== (const DEMObject &in) const |
| Operator that tests for equality. More...
|
|
bool | operator!= (const DEMObject &in) const |
| Operator that tests for inequality. More...
|
|
const std::string | toString (const FORMATS &type=FULL) const |
|
double & | operator() (const size_t &ix, const size_t &iy) |
|
double | operator() (const size_t &ix, const size_t &iy) const |
|
double & | operator() (const size_t &i) |
|
double | operator() (const size_t &i) const |
|
const std::string | toString () const |
|
| Grid2DObject () |
| Default constructor. Initializes all variables to 0, except lat/long which are initialized to IOUtils::nodata. More...
|
|
| Grid2DObject (const size_t &ncols, const size_t &nrows, const double &cellsize, const Coords &i_llcorner) |
|
| Grid2DObject (const size_t &ncols, const size_t &nrows, const double &cellsize, const Coords &i_llcorner, const double &init) |
|
| Grid2DObject (const Grid2DObject &i_grid, const double &init) |
|
| Grid2DObject (const double &cellsize, const Coords &i_llcorner, const Array2D< double > &grid2D_in) |
|
| Grid2DObject (const Grid2DObject &i_grid2Dobj, const size_t &i_nx, const size_t &i_ny, const size_t &i_ncols, const size_t &i_nrows) |
| constructs an object as a subset of another grid object More...
|
|
bool | gridify (Coords &point) const |
| Compute the positional parameters that are not already known This means that the Coords::point object that is given either contains geographic coordinates or grid indices. This method will calculate the missing ones (so that (i,j) match with (lat,lon) and (east,north)). If the given point had a "NULL" projection, it will be set to the grid's. More...
|
|
bool | gridify (std::vector< Coords > &vec_points, const bool &keep_invalid=false) const |
| Compute the positional parameters that are not already known This means that the Coords::point object that is given either contains geographic coordinates or grid indices. This method will calculate the missing ones (so that (i,j) match with (lat,lon) and (east,north)). Any point that is either invalid or outside the grid is removed from the vector. If the given point had a "NULL" projection, it will be set to the grid's. More...
|
|
bool | gridify (std::vector< StationData > &vec_points, const bool &keep_invalid=false) const |
|
void | set (const size_t &ncols, const size_t &nrows, const double &cellsize, const Coords &i_llcorner) |
| Set all variables in one go. More...
|
|
void | set (const double &cellsize, const Coords &i_llcorner, const Array2D< double > &grid2D_in) |
| Set all variables in one go. Notably the member grid2D of type Array2D<double> will be destroyed and recreated to size ncols x nrows. More...
|
|
void | set (const size_t &ncols, const size_t &nrows, const double &cellsize, const Coords &i_llcorner, const double &init) |
|
void | set (const Grid2DObject &i_grid, const double &init) |
|
void | rescale (const double &i_cellsize) |
| Rescale (bilinear resampling) the grid to match the given cell size. More...
|
|
void | compute_spatial_mean (const double &radius) |
| Spatially average the grid over a given radius. More...
|
|
void | size (size_t &o_ncols, size_t &o_nrows) const |
|
size_t | size () const |
|
size_t | getNx () const |
|
size_t | getNy () const |
|
double | getMin () const |
|
double | getMax () const |
|
double | getMean () const |
|
void | clear () |
| deletes the data, but keeps geolocalization More...
|
|
bool | empty () const |
| Check if a grid does not contain any data (but it can contain geolocalization) More...
|
|
bool | allNodata () const |
|
bool | isSameGeolocalization (const Grid2DObject &target) const |
| check if the current Grid2DObject has the same geolocalization attributes as another Grid2DObject (as well as same cells). The grid coordinates (xllcorner & yllcorner) are NOT checked as these might be tweaked for convenience (like between input grid and local grid) More...
|
|
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 a list of growing thresholds, the 'bins' are then a simple range of values. Threshold values will be put into the next higher bin. Each bin comes with an 'id' that replaces the values of the points. More...
|
|
std::vector< double > | extractPoints (const std::vector< std::pair< size_t, size_t > > &Pts) const |
| extract point values from grid More...
|
|
Grid2DObject & | operator= (const double &value) |
| Assignement operator. More...
|
|
Grid2DObject & | operator+= (const double &rhs) |
|
const Grid2DObject | operator+ (const double &rhs) const |
|
Grid2DObject & | operator+= (const Grid2DObject &rhs) |
|
const Grid2DObject | operator+ (const Grid2DObject &rhs) const |
|
Grid2DObject & | operator-= (const double &rhs) |
|
const Grid2DObject | operator- (const double &rhs) const |
|
Grid2DObject & | operator-= (const Grid2DObject &rhs) |
|
const Grid2DObject | operator- (const Grid2DObject &rhs) const |
|
Grid2DObject & | operator*= (const double &rhs) |
|
const Grid2DObject | operator* (const double &rhs) const |
|
Grid2DObject & | operator*= (const Grid2DObject &rhs) |
|
const Grid2DObject | operator* (const Grid2DObject &rhs) const |
|
Grid2DObject & | operator/= (const double &rhs) |
|
const Grid2DObject | operator/ (const double &rhs) const |
|
Grid2DObject & | operator/= (const Grid2DObject &rhs) |
|
const Grid2DObject | operator/ (const Grid2DObject &rhs) const |
|
bool | operator== (const Grid2DObject &in) const |
| Operator that tests for equality. More...
|
|
bool | operator!= (const Grid2DObject &in) const |
| Operator that tests for inequality. More...
|
|