WSL/SLF GitLab Repository

Commit 2df8d53d authored by Mathias Bavay's avatar Mathias Bavay
Browse files

The physical filter algorithms (as defined in libinterpol2D) have seen their...

The physical filter algorithms (as defined in libinterpol2D) have seen their interface modified so they all follow the same logic (for the order and naming of the arguments).

The documentation has been cleaned up (the warnings have been fixed, some missing items added).
parent 64772122
......@@ -34,6 +34,9 @@
* A few data transformations are also supported besides filtering:
* - resample: resamples (if necessary) the data so that if a required time stamp is between two data points, an interpolated value will be returned (instead of nodata).
* - accumulation: accumulates the data on a given period. A practical use is to return hourly precipitations from a sensor measuring precipitation on a 10 minutes interval.
* - median_avg: running median average over a given window, see FilterAlgorithms::MedianAvgFilter
* - mean_avg: running mean average over a given window, see FilterAlgorithms::MeanAvgFilter
* - wind_avg: vector average over a given window
*/
using namespace std;
......
......@@ -42,14 +42,14 @@ bool AlgorithmFactory::initStaticData()
return true;
}
InterpolationAlgorithm* AlgorithmFactory::getAlgorithm(const string& _algoname,
InterpolationAlgorithm* AlgorithmFactory::getAlgorithm(const std::string& _algoname,
const Meteo2DInterpolator& _mi,
const DEMObject& _dem,
const std::vector<MeteoData>& _vecMeteo,
const std::vector<StationData>& _vecStation,
const std::vector<string>& _vecArgs)
const std::vector<std::string>& _vecArgs)
{
string algoname(_algoname);
std::string algoname(_algoname);
IOUtils::toUpper(algoname);
//Check whether algorithm theoretically exists
......@@ -99,8 +99,8 @@ unsigned int InterpolationAlgorithm::getData(const MeteoData::Parameters& param,
return vecData.size();
}
unsigned int InterpolationAlgorithm::getStationAltitudes(const vector<StationData>& vecMeta,
vector<double>& vecData) const
unsigned int InterpolationAlgorithm::getStationAltitudes(const std::vector<StationData>& vecMeta,
std::vector<double>& vecData) const
{
for (unsigned int ii=0; ii<vecMeta.size(); ii++){
const double& val = vecMeta[ii].position.getAltitude();
......@@ -119,7 +119,6 @@ void InterpolationAlgorithm::printInfo(const MeteoData::Parameters& param, const
/**********************************************************************************/
double ConstAlgorithm::getQualityRating(const MeteoData::Parameters& param)
{
//check incoming data for number of data points
......@@ -259,7 +258,7 @@ void IDWAlgorithm::calculate(const MeteoData::Parameters& param, Grid2DObject& g
throw IOException("Interpolation FAILED for parameter " + MeteoData::getParameterName(param), AT);
//run algorithm
Interpol2D::IDWKrieging(dem, vecData, vecMeta, grid);
Interpol2D::IDW(vecData, vecMeta, dem, grid);
}
double IDWLapseAlgorithm::getQualityRating(const MeteoData::Parameters& param)
......@@ -292,7 +291,7 @@ void IDWLapseAlgorithm::calculate(const MeteoData::Parameters& param, Grid2DObje
//run algorithm
Interpol2D::LinRegression(vecAltitudes, vecData, vecCoefficients);
Interpol2D::LapseIDWKrieging(dem, &Interpol2D::LinProject, vecCoefficients, vecData, vecMeta, grid);
Interpol2D::LapseIDW(vecData, vecMeta, dem, vecCoefficients, &Interpol2D::LinProject, grid);
}
double RHAlgorithm::getQualityRating(const MeteoData::Parameters& param)
......@@ -365,7 +364,7 @@ void RHAlgorithm::calculate(const MeteoData::Parameters& param, Grid2DObject& gr
//run algorithm
Interpol2D::LinRegression(vecAltitudes, vecTd, vecCoefficients);
Interpol2D::LapseIDWKrieging(dem, &Interpol2D::LinProject, vecCoefficients, vecTd, vecMeta, grid);
Interpol2D::LapseIDW(vecTd, vecMeta, dem, vecCoefficients, &Interpol2D::LinProject, grid);
//Recompute Rh from the interpolated td
for (unsigned int ii=0; ii<grid.ncols; ii++) {
......@@ -434,7 +433,7 @@ void SimpleWindInterpolationAlgorithm::calculate(const MeteoData::Parameters& pa
vecCoefficients.resize(4, 0.0);
Interpol2D::LinRegression(vecAltitudes, vecDataVW, vecCoefficients);
Interpol2D::LapseIDWKrieging(dem, &Interpol2D::LinProject, vecCoefficients, vecDataVW, vecMeta, grid);
Interpol2D::LapseIDW(vecDataVW, vecMeta, dem, vecCoefficients, &Interpol2D::LinProject, grid);
Interpol2D::SimpleDEMWindInterpolate(dem, grid, dw);
}
......@@ -64,7 +64,7 @@ class AlgorithmFactory {
static InterpolationAlgorithm* getAlgorithm(const std::string& _algoname,
const Meteo2DInterpolator& _mi,
const DEMObject& _dem,
const std::vector<MeteoData>& _vecMeteo,
const std::vector<MeteoData>& _vecMeteo,
const std::vector<StationData>& _vecStation,
const std::vector<std::string>& _vecArgs);
......
......@@ -35,8 +35,8 @@
* -# \subpage quick_overview "Quick overview" of the functionnality provided by MeteoIO
* -# \subpage plugins "Available plugins" and usage
* -# \subpage filters "Available filters" and usage
* -# \subpage dev_plugins "Plugin" developer's guide
* -# \subpage dev_filters "Filter" developer's guide
* -# \subpage dev_plugins How to write a "Plugin"
* -# \subpage dev_filters How to write a "Filter"
* -# \subpage examples "Examples"
*/
......@@ -102,11 +102,7 @@
//Plugins overview given in IOHandler.cc
//Filters overview given in FilterAlgorithms.cc
/**
* @page dev_plugins Plugin developer's guide
*
*/
//Plugin development given in IOInterface.h
/**
* @page dev_filters Filter developer's guide
......
......@@ -130,7 +130,8 @@ unsigned int Meteo2DInterpolator::getAlgorithmsForParameter(const std::string& p
}
unsigned int Meteo2DInterpolator::getArgumentsForAlgorithm(const MeteoData::Parameters& param,
const string& algorithm, vector<string>& vecArgs) const
const std::string& algorithm,
std::vector<std::string>& vecArgs) const
{
vecArgs.clear();
string keyname = MeteoData::getParameterName(param) +"::"+ algorithm;
......
......@@ -196,12 +196,13 @@ int Interpol2D::LinRegression(const std::vector<double>& X, const std::vector<do
//example: Ta projected to 1500m with a rate of -0.0065K/m
/**
* @brief Projects a given parameter to another elevation:
* This implementation keeps the value constant as a function of the elevation
* @param value (const double) original value
* @param altitude (const double) altitude of the original value (unused)
* @param new_altitude (const double) altitude of the reprojected value (unused)
* @param coeffs (const vector\<double\>) coefficients to use for the projection (unused)
* @return (double) reprojected value
* This implementation keeps the value constant as a function of the elevation.
* This interface has to follow the interface of *LapseRateProjectPtr
* @param value original value
* @param altitude altitude of the original value
* @param new_altitude altitude of the reprojected value
* @param coeffs coefficients to use for the projection
* @return reprojected value
*/
double Interpol2D::ConstProject(const double& value, const double&, const double&, const std::vector<double>&)
{
......@@ -210,12 +211,13 @@ double Interpol2D::ConstProject(const double& value, const double&, const double
/**
* @brief Projects a given parameter to another elevation:
* This implementation assumes a linear dependency of the value as a function of the elevation
* @param value (const double) original value
* @param altitude (const double) altitude of the original value
* @param new_altitude (const double) altitude of the reprojected value
* @param coeffs (const vector\<double\>) coefficients to use for the projection
* @return (double) reprojected value
* This implementation assumes a linear dependency of the value as a function of the elevation.
* This interface has to follow the interface of *LapseRateProjectPtr
* @param value original value
* @param altitude altitude of the original value
* @param new_altitude altitude of the reprojected value
* @param coeffs coefficients to use for the projection
* @return reprojected value
*/
double Interpol2D::LinProject(const double& value, const double& altitude, const double& new_altitude, const std::vector<double>& coeffs)
{
......@@ -230,17 +232,17 @@ double Interpol2D::LinProject(const double& value, const double& altitude, const
/**
* @brief Grid filling function:
* This implementation builds a standard air pressure as a function of the elevation
* @param _dem (DEMObject) array of elevations (dem)
* @param grid (Grid2DObject) 2D array to fill
* @param dem array of elevations (dem)
* @param grid 2D array to fill
*/
void Interpol2D::stdPressureGrid2DFill(const DEMObject& _dem, Grid2DObject& grid) {
grid.set(_dem.ncols, _dem.nrows, _dem.cellsize, _dem.llcorner);
void Interpol2D::stdPressureGrid2DFill(const DEMObject& dem, Grid2DObject& grid) {
grid.set(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner);
//provide each point with an altitude dependant pressure... it is worth what it is...
for (unsigned int i=0; i<grid.ncols; i++) {
for (unsigned int j=0; j<grid.nrows; j++) {
if (_dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = lw_AirPressure(_dem.grid2D(i,j));
if (dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = lw_AirPressure(dem.grid2D(i,j));
} else {
grid.grid2D(i,j) = IOUtils::nodata;
}
......@@ -251,19 +253,19 @@ void Interpol2D::stdPressureGrid2DFill(const DEMObject& _dem, Grid2DObject& grid
/**
* @brief Grid filling function:
* This implementation fills the grid with a constant value
* @param _value (double) value to put in the grid
* @param _dem (DEMObject) array of elevations (dem). This is needed in order to know if a point is "nodata"
* @param grid (Array2D\<double\>) 2D array to fill
* @param value value to put in the grid
* @param dem array of elevations (dem). This is needed in order to know if a point is "nodata"
* @param grid 2D array to fill
*/
void Interpol2D::constantGrid2DFill(const double& _value, const DEMObject& _dem, Grid2DObject& grid)
void Interpol2D::constantGrid2DFill(const double& value, const DEMObject& dem, Grid2DObject& grid)
{
grid.set(_dem.ncols, _dem.nrows, _dem.cellsize, _dem.llcorner);
grid.set(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner);
//fills a data table with constant values
for (unsigned int i=0; i<grid.ncols; i++) {
for (unsigned int j=0; j<grid.nrows; j++) {
if (_dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = _value;
if (dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = value;
} else {
grid.grid2D(i,j) = IOUtils::nodata;
}
......@@ -273,105 +275,140 @@ void Interpol2D::constantGrid2DFill(const double& _value, const DEMObject& _dem,
/**
* @brief Grid filling function:
* This implementation fills a flat grid with a constant value, and then reproject it to the terrain's elevation.
* for example, the air temperature measured at one point at 1500m would be given as value, the 1500m as altitude and the dem would allow to reproject this temperature on the full DEM using a default lapse rate.
* @param param_out (Array2D\<double\>) 2D array to fill
* @param topoHeight (DEMObject) array of elevations (dem)
* @param value (double) value to put in the grid
* @param altitude (double) altitude of the "value"
* This implementation fills a flat grid with a constant value and then reproject it to the terrain's elevation.
* for example, the air temperature measured at one point at 1500m would be given as value, the 1500m as altitude and the dem would allow to reproject this temperature on the full DEM using the detrending function provided as pointer (with its previously calculated coefficients).
* @param value value to put in the grid
* @param altitude altitude of the "value"
* @param dem array of elevations (dem)
* @param vecCoefficients vector of detrending coefficients
* @param funcptr detrending function pointer (that uses the detrending coefficients)
* @param grid 2D array to fill
*/
void Interpol2D::constantLapseGrid2DFill(const double& value, const double& altitude,
const DEMObject& _dem, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& funcptr, Grid2DObject& param_out)
const DEMObject& dem, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& funcptr, Grid2DObject& grid)
{
param_out.set(_dem.ncols, _dem.nrows, _dem.cellsize, _dem.llcorner);
grid.set(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner);
//fills a data table with constant values and then reprojects it to the DEM's elevation from a given altitude
//the laspe rate parameters must have been set before
for (unsigned int i=0; i<param_out.ncols; i++) {
for (unsigned int j=0; j<param_out.nrows; j++) {
if (_dem.grid2D(i,j)!=IOUtils::nodata) {
param_out.grid2D(i,j) = funcptr(value, altitude, _dem.grid2D(i,j), vecCoefficients);
for (unsigned int i=0; i<grid.ncols; i++) {
for (unsigned int j=0; j<grid.nrows; j++) {
if (dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = funcptr(value, altitude, dem.grid2D(i,j), vecCoefficients);
} else {
param_out.grid2D(i,j) = IOUtils::nodata;
grid.grid2D(i,j) = IOUtils::nodata;
}
}
}
}
double Interpol2D::IDWKriegingCore(const double& x, const double& y,const std::vector<double>& vecData_in,
const std::vector<StationData>& vecStations)
double Interpol2D::IDWCore(const double& x, const double& y, const std::vector<double>& vecData_in,
const std::vector<StationData>& vecStations_in)
{
//The value at any given cell is the sum of the weighted contribution from each source
double parameter=0., norm=0., weight;
for (unsigned int i=0; i<(unsigned int)vecStations.size(); i++) {
weight=1./(HorizontalDistance(x, y, vecStations[i].position.getEasting(), vecStations[i].position.getNorthing()) + 1e-6);
for (unsigned int i=0; i<(unsigned int)vecStations_in.size(); i++) {
weight=1./(HorizontalDistance(x, y, vecStations_in[i].position.getEasting(),
vecStations_in[i].position.getNorthing()) + 1e-6);
parameter += weight*vecData_in[i];
norm += weight;
}
return (parameter/norm); //normalization
return (parameter/norm); //normalization
}
void Interpol2D::LapseIDWKrieging(const DEMObject& topoHeight, const LapseRateProjectPtr& funcptr,
const std::vector<double>& vecCoefficients,
const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations_in,
Grid2DObject& T)
/**
* @brief Grid filling function:
* This implementation fills a flat grid using Inverse Distance Weighting and then reproject it to the terrain's elevation.
* for example, the air temperatures measured at several stations would be given as values, the stations altitude and positions
* as positions and projected to a flat grid. Afterward, the grid would be reprojected to the correct elevation as given
* by the dem would using the detrending function provided as pointer (with its previously calculated coefficients).
* @param vecData_in input values to use for the IDW
* @param vecStations_in position of the "values" (altitude and coordinates)
* @param dem array of elevations (dem)
* @param vecCoefficients vector of detrending coefficients
* @param funcptr detrending function pointer (that uses the detrending coefficients)
* @param grid 2D array to fill
*/
void Interpol2D::LapseIDW(const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations_in,
const DEMObject& dem, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& funcptr,
Grid2DObject& grid)
{ //multiple source stations: lapse rate projection, IDW Krieging, re-projection
const double ref_altitude = getReferenceAltitude(dem);
T.set(topoHeight.ncols, topoHeight.nrows, topoHeight.cellsize, topoHeight.llcorner);
grid.set(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner);
std::vector<double> vecTref(vecStations_in.size(), 0.0); // init to 0.0
for (unsigned int i=0; i<(unsigned int)vecStations_in.size(); i++) {
vecTref[i] = funcptr(vecData_in[i], vecStations_in[i].position.getAltitude(),
getReferenceAltitude(topoHeight), vecCoefficients);
ref_altitude, vecCoefficients);
}
const double xllcorner = topoHeight.llcorner.getEasting();
const double yllcorner = topoHeight.llcorner.getNorthing();
for (unsigned int i=0; i<T.ncols; i++) {
for (unsigned int j=0; j<T.nrows; j++) {
if (topoHeight.grid2D(i,j)!=IOUtils::nodata) {
T.grid2D(i,j) = IDWKriegingCore((xllcorner+i*topoHeight.cellsize),
(yllcorner+j*topoHeight.cellsize), vecTref, vecStations_in);
T.grid2D(i,j) = funcptr(T.grid2D(i,j), getReferenceAltitude(topoHeight), topoHeight.grid2D(i,j), vecCoefficients);
const double xllcorner = dem.llcorner.getEasting();
const double yllcorner = dem.llcorner.getNorthing();
const double cellsize = dem.cellsize;
for (unsigned int i=0; i<grid.ncols; i++) {
for (unsigned int j=0; j<grid.nrows; j++) {
if (dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = IDWCore((xllcorner+i*cellsize),
(yllcorner+j*cellsize), vecTref, vecStations_in);
grid.grid2D(i,j) = funcptr(grid.grid2D(i,j), ref_altitude,
dem.grid2D(i,j), vecCoefficients);
} else {
T.grid2D(i,j) = IOUtils::nodata;
grid.grid2D(i,j) = IOUtils::nodata;
}
}
}
}
void Interpol2D::IDWKrieging(const DEMObject& topoHeight,
const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations,
Grid2DObject& T)
/**
* @brief Grid filling function:
* This implementation fills a grid using Inverse Distance Weighting.
* for example, the air temperatures measured at several stations would be given as values, the stations positions
* as positions and projected to a grid. No elevation detrending is performed, the DEM is only used for checking if a grid point is "nodata".
* @param vecData_in input values to use for the IDW
* @param vecStations_in position of the "values" (altitude and coordinates)
* @param dem array of elevations (dem). This is needed in order to know if a point is "nodata"
* @param grid 2D array to fill
*/
void Interpol2D::IDW(const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations_in,
const DEMObject& dem, Grid2DObject& grid)
{
T.set(topoHeight.ncols, topoHeight.nrows, topoHeight.cellsize, topoHeight.llcorner);
grid.set(dem.ncols, dem.nrows, dem.cellsize, dem.llcorner);
//multiple source stations: simple IDW Krieging
const double xllcorner = topoHeight.llcorner.getEasting();
const double yllcorner = topoHeight.llcorner.getNorthing();
for (unsigned int i=0; i<T.ncols; i++) {
for(unsigned int j=0; j<T.nrows; j++) {
if (topoHeight.grid2D(i,j)!=IOUtils::nodata) {
T.grid2D(i,j) = IDWKriegingCore((xllcorner+i*topoHeight.cellsize), (yllcorner+j*topoHeight.cellsize), vecData_in, vecStations);
const double xllcorner = dem.llcorner.getEasting();
const double yllcorner = dem.llcorner.getNorthing();
const double cellsize = dem.cellsize;
for (unsigned int i=0; i<grid.ncols; i++) {
for(unsigned int j=0; j<grid.nrows; j++) {
if (dem.grid2D(i,j)!=IOUtils::nodata) {
grid.grid2D(i,j) = IDWCore((xllcorner+i*cellsize), (yllcorner+j*cellsize),
vecData_in, vecStations_in);
} else {
T.grid2D(i,j) = IOUtils::nodata;
grid.grid2D(i,j) = IOUtils::nodata;
}
}
}
}
/**
* @brief Grid filling function:
* This implementation fills a grid using a curvature and slope algorithm, as described in "A Meteorological
* Distribution System for High-Resolution Terrestrial Modeling (MicroMet)", Liston and Alder, 2006.
* @param dem array of elevations (dem). The slope must have been updated as it is required for the DEM analysis.
* @param VW 2D array of Wind Velocity to fill
* @param DW 2D array of Wind Direction to fill
*/
void Interpol2D::SimpleDEMWindInterpolate(const DEMObject& dem, Grid2DObject& VW, Grid2DObject& DW)
{
if ((!VW.isSameGeolocalization(DW)) || (!VW.isSameGeolocalization(dem))){
throw IOException("Requested grid VW and grid DW don't match the geolocalization of the DEM", AT);
}
//This method computes the speed of the wind and returns a table in 2D with this values
//This Wind interpolation is similar to Liston and Elder (2006)
double speed; // Wind speed (m s-1)
double dir; // Wind direction
double u; // Zonal component u (m s-1)
......
......@@ -15,7 +15,10 @@
You should have received a copy of the GNU Lesser General Public License
along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
*/
//This is the two 2D meteo interpolation library.
/**
* @file libinterpol2D.h
* This is the two 2D meteo interpolation statistical library.
*/
#ifndef INTERPOL2D_H
#define INTERPOL2D_H
......@@ -32,15 +35,15 @@
/**
* @class Interpol2D
* @brief A class to perform 2D spatial interpolations.
* Each parameter to be interpolated declares which interpolation method to use
* for single and multiple data sources. Then the class computes the interpolation for each 2D grid point,
* Each parameter to be interpolated declares which interpolation method to use.
* Then the class computes the interpolation for each 2D grid point,
* combining the inputs provided by the available data sources.
* @author Mathias Bavay
* @date 2009-01-20
*/
typedef double (*LapseRateProjectPtr)(const double& value, const double& altitude,
const double& new_altitude, const std::vector<double>& coeffs);
const double& new_altitude, const std::vector<double>& coeffs);
class Interpol2D {
public:
......@@ -50,56 +53,54 @@ class Interpol2D {
R_LIN ///< linear elevation dependence
} reg_types;
static void SimpleDEMWindInterpolate(const DEMObject& dem, Grid2DObject& VW, Grid2DObject& DW);
static int LinRegression(const std::vector<double>& data_in,
const std::vector<double>& elevations, std::vector<double>& coeffs);
static void stdPressureGrid2DFill(const DEMObject& dem, Grid2DObject& grid);
static void constantGrid2DFill(const double& value, const DEMObject& dem, Grid2DObject& grid);
static void constantLapseGrid2DFill(const double& value, const double& altitude,
const DEMObject& dem, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& funcptr, Grid2DObject& grid);
static void LapseIDW(const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations_in,
const DEMObject& dem, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& funcptr,
Grid2DObject& grid);
static void IDW(const std::vector<double>& vecData_in, const std::vector<StationData>& vecStations_in,
const DEMObject& dem, Grid2DObject& grid);
static void SimpleDEMWindInterpolate(const DEMObject& dem, Grid2DObject& VW, Grid2DObject& DW);
static double getReferenceAltitude(const DEMObject& dem);
//projections functions
static double ConstProject(const double& value, const double& altitude, const double& new_altitude,
const std::vector<double>& coeffs);
static double LinProject(const double& value, const double& altitude, const double& new_altitude,
const std::vector<double>& coeffs);
static void constantGrid2DFill(const double& value, const DEMObject& topoHeight, Grid2DObject& param);
static void stdPressureGrid2DFill(const DEMObject& dem, Grid2DObject& param);
static int LinRegression(const std::vector<double>& data_in,
const std::vector<double>& elevations, std::vector<double>& coeffs);
//these should be in the libphysicslaws, that still has to be created...!
static double lw_AirPressure(const double& altitude);
static double RhtoDewPoint(double RH, double TA, const short int& force_water);
static double DewPointtoRh(double TD, double TA, const short int& force_water);
static void constantLapseGrid2DFill(const double& value, const double& altitude,
const DEMObject& topoHeight, const std::vector<double>& vecCoefficients,
const LapseRateProjectPtr& ptr, Grid2DObject& param_out);
static double IDWKriegingCore(const double& x, const double& y,
const std::vector<double>& vecData_in,
const std::vector<StationData>& vecStations);
static void LapseIDWKrieging(const DEMObject& topoHeight, const LapseRateProjectPtr& funcptr,
const std::vector<double>& vecCoefficients,
const std::vector<double>& vecData_in,
const std::vector<StationData>& vecStations_in,
Grid2DObject& T);
static void IDWKrieging(const DEMObject& topoHeight,
const std::vector<double>& data_in, const std::vector<StationData>& vecStations,
Grid2DObject& grid);
//projections functions
static double ConstProject(const double& val, const double& alt, const double& new_alt,
const std::vector<double>& coeffs);
static double LinProject(const double& value, const double& altitude, const double& new_altitude,
const std::vector<double>& coeffs);
//some consts
const static double dflt_temperature_lapse_rate;///<default lapse rate for temperature(elevation)
const static double dflt_temperature_lapse_rate; ///<default lapse rate for temperature(elevation)
private:
//generic functions
static double HorizontalDistance(const double& X1, const double& Y1, const double& X2, const double& Y2);
static double HorizontalDistance(const DEMObject& dem, const int& i, const int& j,
const double& X2, const double& Y2);
const double& X2, const double& Y2);
static double getReferenceAltitude(const DEMObject& dem);
//regressions
//core methods
static void LinRegressionCore(const std::vector<double>& X, const std::vector<double>& Y,
double& a, double& b, double& r, const int ignore_index);
double& a, double& b, double& r, const int ignore_index);
static double IDWCore(const double& x, const double& y,
const std::vector<double>& vecData_in,
const std::vector<StationData>& vecStations_in);
private:
//static members
const static double wind_ys; ///coefficient for wind dependency on slope
const static double wind_yc; ///coefficient for wind dependency on curvature
const static double wind_ys; ///coefficient for wind dependency on slope
const static double wind_yc; ///coefficient for wind dependency on curvature
};
#endif
......@@ -103,7 +103,7 @@ void GeotopIO::readLanduse(Grid2DObject&)
throw IOException("Nothing implemented here", AT);
}
void GeotopIO::initParamNames(map<string, unsigned int>& mapParam)
void GeotopIO::initParamNames(std::map<std::string, unsigned int>& mapParam)
{
mapParam["Iprec"] = MeteoData::HNW;
mapParam["WindS"] = MeteoData::VW;
......@@ -320,7 +320,7 @@ void GeotopIO::readMeteoData(const Date_IO& dateStart, const Date_IO& dateEnd,
}
}
void GeotopIO::parseDate(const string& datestring, const string& fileandline, Date_IO& date)
void GeotopIO::parseDate(const std::string& datestring, const std::string& fileandline, Date_IO& date)
{
/*
* In order to be more flexible with the date parsing in GEOtop meteo files,
......
......@@ -63,12 +63,12 @@ void ImisIO::getProjectionParameters() {
}
}
ImisIO::ImisIO(void (*delObj)(void*), const string& filename) : IOInterface(delObj), cfg(filename)
ImisIO::ImisIO(void (*delObj)(void*), const std::string& filename) : IOInterface(delObj), cfg(filename)
{
getProjectionParameters();
}
ImisIO::ImisIO(const string& configfile) : IOInterface(NULL), cfg(configfile)
ImisIO::ImisIO(const std::string& configfile) : IOInterface(NULL), cfg(configfile)
{
getProjectionParameters();
}
......@@ -83,7 +83,7 @@ ImisIO::~ImisIO() throw()
cleanup();
}
void ImisIO::read2DGrid(Grid2DObject&, const string&)
void ImisIO::read2DGrid(Grid2DObject&, const std::string&)
{
//Nothing so far
throw IOException("Nothing implemented here", AT);
......@@ -113,15 +113,15 @@ void ImisIO::readSpecialPoints(std::vector<Coords>&)
throw IOException("Nothing implemented here", AT);
}
void ImisIO::write2DGrid(const Grid2DObject&, const string&)
void ImisIO::write2DGrid(const Grid2DObject&, const std::string&)
{
//Nothing so far
throw IOException("Nothing implemented here", AT);
}
void ImisIO::writeMeteoData(const std::vector< std::vector<MeteoData> >&,
const std::vector< std::vector<StationData> >&,
const std::string&)
const std::vector< std::vector<StationData> >&,
const std::string&)
{
//Nothing so far
throw IOException("Nothing implemented here", AT);
......@@ -170,7 +170,7 @@ void ImisIO::readStationMetaData()
}
}
void ImisIO::parseStationName(const string& stationName, string& stName, unsigned int& stNumber)
void ImisIO::parseStationName(const std::string&