2.0.0b10
catchment modelling framework
|
A timeseries is a list of values, equally distributed over time. More...
A timeseries is a list of values, equally distributed over time.
To create one, one have to provide as start date and a step size. The end time is calculated from the number of values. Values queried for times before the start time are returned as the first item, values after the end time equal the last item. A timeseries with only one item reacts like a scalar value.
Creating a time series
With this technique it is simple to read files or databases to fill timeseries.
<b> Using a timeseries</b>
Public Member Functions | |
timeseries (cmf::math::Time begin=cmf::math::Time(), cmf::math::Time step=cmf::math::day, int interpolationmethod=1, size_t count=0) | |
Constructor of a time series. | |
void | add (double Value) |
Appends a measurement. | |
cmf::math::Time | begin () const |
First date of measurement. | |
size_t | count_values () const |
Number of valid values (=size - # of NaN's) | |
cmf::math::Time | end () const |
Last date of measurements. | |
int | interpolationpower () const |
Method for the interpolation (0 - Nearest neighbor, 1- linear, 2 - cubic spline (not implemented yet) | |
bool | is_empty () const |
returns true if no values are added to the timeseries | |
double | operator[] (cmf::math::Time t) const |
Returns an interpolated value at time t. | |
double & | operator[] (ptrdiff_t i) |
Returns a reference to the value at position i. | |
size_t | size () const |
Number of items in the timeseries. | |
cmf::math::Time | step () const |
Time between the measurements. | |
Operators | |
Binary operators defined as free operators: x = {+,-,*,/} Defined for (x is one of the operators above):
| |
timeseries & | operator+= (cmf::math::timeseries) |
add timeseries to this | |
timeseries & | operator+= (double) |
add scalar to this | |
timeseries & | operator-= (cmf::math::timeseries) |
Subtract timeseries from this. | |
timeseries & | operator-= (double) |
Subtract scalar from this. | |
timeseries & | operator*= (cmf::math::timeseries) |
Multiply each element of timeseries with each element of this. | |
timeseries & | operator*= (double) |
Multiply each element of timeseries with scalar. | |
timeseries & | operator/= (cmf::math::timeseries) |
Divide each element of this by each element of timeseries. | |
timeseries & | operator/= (double) |
Divide each element of this by scalar. | |
timeseries | reduce_min (cmf::math::Time begin, cmf::math::Time step) const |
Creates a timeseries with a bigger timestep, containing the minimum. | |
timeseries | reduce_max (cmf::math::Time begin, cmf::math::Time step) const |
Creates a timeseries with a bigger timestep, containing the maximum. | |
timeseries | reduce_sum (cmf::math::Time begin, cmf::math::Time step) const |
Creates a timeseries with a bigger timestep, containing the sum. | |
timeseries | reduce_avg (cmf::math::Time begin, cmf::math::Time step) const |
Creates a timeseries with a bigger timestep, containing the average. | |
timeseries | ( | cmf::math::Time | begin = cmf::math::Time(), |
cmf::math::Time | step = cmf::math::day, | ||
int | interpolationmethod = 1, | ||
size_t | count = 0 ) |
Constructor of a time series.
begin | First date of measurement |
step | Time between measurements |
interpolationmethod | Method for the interpolation (0 - Nearest neighbor, 1- linear, 2 - cubic spline (not implemented yet) |
count | Initial number of items. Items are filled with 0.0 |