Linear data resampling.
If a point is requested that is in between two input data points, the requested value is automatically calculated using a linear interpolation. Furthermore if the argument extrapolate is provided there will be an attempt made to extrapolate the point if the interpolation fails, by computing the line equation y = kx + d. It takes the following arguments:
#include <LinearResampling.h>
Public Member Functions | |
LinearResampling (const std::string &i_algoname, const std::string &i_parname, const double &dflt_max_gap_size, const std::vector< std::pair< std::string, std::string > > &vecArgs) | |
void | resample (const std::string &stationHash, const size_t &index, const ResamplingPosition &position, const size_t ¶mindex, const std::vector< MeteoData > &vecM, MeteoData &md) override |
std::string | toString () const override |
![]() | |
ResamplingAlgorithms (const std::string &i_algoname, const std::string &i_parname, const double &dflt_max_gap_size, const std::vector< std::pair< std::string, std::string > > &) | |
virtual | ~ResamplingAlgorithms () |
const std::string | getAlgo () const |
virtual void | resample (const std::string &stationHash, const size_t &index, const ResamplingPosition &position, const size_t ¶mindex, const std::vector< MeteoData > &vecM, MeteoData &md)=0 |
void | resetResampling () |
virtual std::string | toString () const =0 |
Additional Inherited Members | |
![]() | |
enum | ResamplingPosition { exact_match , before , after , begin , end } |
![]() | |
static size_t | searchBackward (gap_info &last_gap, const size_t &pos, const size_t ¶mindex, const std::vector< MeteoData > &vecM, const Date &resampling_date, const double &i_max_gap_size) |
static size_t | searchForward (gap_info &last_gap, const size_t &pos, const size_t ¶mindex, const std::vector< MeteoData > &vecM, const Date &resampling_date, const double &i_max_gap_size, const size_t &indexP1) |
static gap_info | findGap (const size_t &pos, const size_t ¶mindex, const std::vector< MeteoData > &vecM, const Date &resampling_date, const double &i_max_gap_size) |
![]() | |
void | getNearestValidPts (const std::string &stationHash, const size_t &pos, const size_t ¶mindex, const std::vector< MeteoData > &vecM, const Date &resampling_date, const double &i_max_gap_size, size_t &indexP1, size_t &indexP2) |
This function returns the last and next valid points around a given position. More... | |
![]() | |
static double | partialAccumulateAtLeft (const std::vector< MeteoData > &vecM, const size_t ¶mindex, const size_t &pos, const Date &curr_date) |
static double | partialAccumulateAtRight (const std::vector< MeteoData > &vecM, const size_t ¶mindex, const size_t &pos, const Date &curr_date) |
static double | linearInterpolation (const double &x1, const double &y1, const double &x2, const double &y2, const double &x3) |
This function solves the equation y = ax + b for two given points and returns y for a given x. More... | |
static Date | getDailyStart (const Date &resampling_date) |
For a given date, find the start of the day, considering that for midnight we return the day before! (as is necessary for daily averages, sums, etc that can be provided at midnight for the day before) More... | |
static size_t | getDailyValue (const std::vector< MeteoData > &vecM, const size_t ¶mindex, size_t pos, const Date &intervalStart, const Date &intervalEnd) |
Find a unique value in a given time interval. This is useful for retrieving a unique daily average, daily sum, etc. More... | |
![]() | |
const std::string | algo |
const std::string | parname |
double | max_gap_size |
mio::LinearResampling::LinearResampling | ( | const std::string & | i_algoname, |
const std::string & | i_parname, | ||
const double & | dflt_max_gap_size, | ||
const std::vector< std::pair< std::string, std::string > > & | vecArgs | ||
) |
|
overridevirtual |
Implements mio::ResamplingAlgorithms.
|
overridevirtual |
Implements mio::ResamplingAlgorithms.