MeteoIODoc 20241221.207bde49
mio::DEMAlgorithms Class Reference

Detailed Description

A static class to compute various DEM-related parameters (such as shading, view factors, etc)

#include <DEMAlgorithms.h>

Static Public Member Functions

static Grid2DObject getHillshade (const DEMObject &dem, const double &elev, const double &azimuth)
 Computes the hillshade for the dem This "fake illumination" method is used to better show the relief on maps. More...
 
static double getHorizon (const DEMObject &dem, const size_t &ix1, const size_t &iy1, const double &bearing)
 Returns the tangente of the horizon from a given point looking toward a given bearing. More...
 
static double getHorizon (const DEMObject &dem, Coords point, const double &bearing)
 Returns the tangente of the horizon from a given point looking toward a given bearing. More...
 
static std::vector< std::pair< double, double > > getHorizonScan (const DEMObject &dem, Coords point, const double &increment)
 Returns the horizon from a given point looking 360 degrees around by increments. If the provided point does not fit within the provided DEM, an empty result set is returned. More...
 
static std::map< std::string, std::vector< std::pair< double, double > > > readHorizonScan (const std::string &where, const std::string &filename)
 Read the horizons from a given set of points looking 360 degrees around provided in a file. More...
 
static double getHorizon (const std::vector< std::pair< double, double > > &horizon, const double &azimuth)
 Linearly interpolate the horizon height for any given azimuth given a set of (azimuth, elevation) points. More...
 
static void writeHorizons (const std::map< std::string, std::vector< std::pair< double, double > > > &horizon, const std::string &filename)
 Write to a file the horizons from a given set of points looking 360 degrees around. More...
 
static double getCellSkyViewFactor (const DEMObject &dem, const size_t &ii, const size_t &jj)
 Compute the sky view factors for the terrain radiation based on the DEM. This is inspired (ie with some changes) by Manners, J., S. B. Vosper, and N. Roberts, "Radiative transfer over resolved topographic features for high‐resolution weather prediction", Quarterly journal of the royal meteorological society, 138.664, pp720-733, 2012. More...
 

Member Function Documentation

◆ getCellSkyViewFactor()

double mio::DEMAlgorithms::getCellSkyViewFactor ( const DEMObject dem,
const size_t &  ii,
const size_t &  jj 
)
static

Compute the sky view factors for the terrain radiation based on the DEM. This is inspired (ie with some changes) by Manners, J., S. B. Vosper, and N. Roberts, "Radiative transfer over resolved topographic features for high‐resolution weather prediction", Quarterly journal of the royal meteorological society, 138.664, pp720-733, 2012.

Parameters
[in]demDEM to work with
[in]iix coordinate of the cell whose view factor should be computed
[in]jjy coordinate of the cell whose view factor should be computed
Returns
sky view factor

◆ getHillshade()

Grid2DObject mio::DEMAlgorithms::getHillshade ( const DEMObject dem,
const double &  elev,
const double &  azimuth 
)
static

Computes the hillshade for the dem This "fake illumination" method is used to better show the relief on maps.

Parameters
[in]demDEM to work with
[in]elevelevation (in degrees) of the source of light
[in]azimuthazimuth (in degrees) of the source of light
Returns
hillshade grid that containing the illumination

◆ getHorizon() [1/3]

double mio::DEMAlgorithms::getHorizon ( const DEMObject dem,
const size_t &  ix1,
const size_t &  iy1,
const double &  bearing 
)
static

Returns the tangente of the horizon from a given point looking toward a given bearing.

Parameters
[in]demDEM to work with
[in]ix1x index of the origin point
[in]iy1y index of the origin point
[in]bearingdirection given by a compass bearing
Returns
tangente of angle above the horizontal (in deg) or IOUtils::nodata if the point (ix1, iy1) does not fit within the provided DEM

◆ getHorizon() [2/3]

double mio::DEMAlgorithms::getHorizon ( const DEMObject dem,
Coords  point,
const double &  bearing 
)
static

Returns the tangente of the horizon from a given point looking toward a given bearing.

Parameters
[in]demDEM to work with
[in]pointthe origin point
[in]bearingdirection given by a compass bearing
Returns
tangente of angle above the horizontal (in deg) or IOUtils::nodata if the provided point does not fir within the provided DEM

◆ getHorizon() [3/3]

double mio::DEMAlgorithms::getHorizon ( const std::vector< std::pair< double, double > > &  horizon,
const double &  azimuth 
)
static

Linearly interpolate the horizon height for any given azimuth given a set of (azimuth, elevation) points.

Parameters
[in]horizona set of (azimuth, elevation) coordinates defining the horizon
[in]azimuththe azimuth where to perform the interpolation
Returns
the interpolated elevation for the provided azimuth

◆ getHorizonScan()

std::vector< std::pair< double, double > > mio::DEMAlgorithms::getHorizonScan ( const DEMObject dem,
Coords  point,
const double &  increment 
)
static

Returns the horizon from a given point looking 360 degrees around by increments. If the provided point does not fit within the provided DEM, an empty result set is returned.

Parameters
[in]demDEM to work with
[in]pointthe origin point
[in]incrementto the bearing between two angles
Returns
horizon vector of heights as a function of azimuth

◆ readHorizonScan()

std::map< std::string, std::vector< std::pair< double, double > > > mio::DEMAlgorithms::readHorizonScan ( const std::string &  where,
const std::string &  filename 
)
static

Read the horizons from a given set of points looking 360 degrees around provided in a file.

The file containing the horizons is made of any number of lines with the following structure: {stationID} {azimuth} {elevation} where the azimuth is given in degrees North (as read from a compass) and the elevation as degrees above the horizontal. For example:

STB2 0 2
STB2 210 18
WFJ 180 5
WFJ 130 10
STB2 180 25
Parameters
[in]whereDescription of the caller to be used in error messages, such as 'Filter::shade'
[in]filenamethe file and path containing the horizon
Returns
a map containing for each stationID the horizon vector of heights as a function of azimuth

◆ writeHorizons()

void mio::DEMAlgorithms::writeHorizons ( const std::map< std::string, std::vector< std::pair< double, double > > > &  horizon,
const std::string &  filename 
)
static

Write to a file the horizons from a given set of points looking 360 degrees around.

The file containing the horizons is made of any number of lines with the following structure: {stationID} {azimuth} {elevation} where the azimuth is given in degrees North (as read from a compass) and the elevation as degrees above the horizontal. For example:

STB2 0 2
STB2 210 18
WFJ 180 5
WFJ 130 10
STB2 180 25
Parameters
[in]horizona map of vectors of (azimuth, elevation) coordinates defining the horizon, per stationID
[in]filenamethe file and path where to write the horizon

The documentation for this class was generated from the following files: