A class to represent time series. More...
#include <TimeSeries.h>
Public Member Functions | |
void | add (te::dt::DateTime *time, te::dt::AbstractData *value) |
It adds an observation (time and attribute value) into the time series. More... | |
void | add (te::dt::DateTime *time, double value) |
It adds an observation (time and attribute value as double) into the time series. More... | |
void | add (te::dt::DateTime *time, int value) |
It adds an observation (time and attribute value as integer) into the time series. More... | |
void | add (te::dt::DateTime *time, const std::string &value) |
It adds an observation (time and attribute value as string) into the time series. More... | |
void | add (const TimeSeriesObservation &item) |
It adds an observation (time and attribute value) into the time series. More... | |
TimeSeries * | clone () const |
It returns a clone of this time series. More... | |
double | getDouble (te::dt::DateTime *t) const |
It returns the value as a double associated to a given date and time. More... | |
std::string | getId () const |
It returns the time series identifier. More... | |
int | getInt (te::dt::DateTime *t) const |
It returns the value as an integer associated to a given date and time. More... | |
AbstractTimeSeriesInterp * | getInterpolator () const |
It returns the interpolator associated to the time series. More... | |
te::gm::Geometry * | getLocation () const |
It returns the time series location. More... | |
const TimeSeriesObservationSet & | getObservations () const |
It returns the time series observations. More... | |
std::string | getString (te::dt::DateTime *t) const |
It returns the value as a string associated to a given date and time. More... | |
std::auto_ptr< te::dt::DateTimePeriod > | getTemporalExtent () const |
It returns the temporal extent or range of the time series. More... | |
std::auto_ptr< te::dt::AbstractData > | getValue (te::dt::DateTime *t) const |
It returns the value associated to a given date and time. More... | |
void | getValueExtent (double &minValue, double &maxValue) |
It returns the minimal and maximun values of the time series. More... | |
void | getValueExtent (int &minValue, int &maxValue) |
It returns the minimal and maximun values of the time series. More... | |
void | getValueExtent (std::string &minValue, std::string &maxValue) |
It returns the minimal and maximun values of the time series. More... | |
TimeSeries & | operator= (const TimeSeries &other) |
Copy assignment operator. More... | |
void | setId (const std::string &id) |
It sets the time series identifier. More... | |
void | setInterpolator (AbstractTimeSeriesInterp *interp) |
It sets the interpolator associated to the time series. More... | |
void | setLocation (te::gm::Geometry *geom) |
It sets the time series location. More... | |
std::size_t | size () const |
It returns the size of the time series observation set. More... | |
virtual | ~TimeSeries () |
It returns time series subsets that satisfy the given relations. More... | |
TimeSeries Constructors | |
TimeSeries () | |
Empty constructor. More... | |
TimeSeries (const std::string &id) | |
Empty constructor. More... | |
TimeSeries (AbstractTimeSeriesInterp *interp, const std::string &id) | |
Empty constructor. More... | |
TimeSeries (AbstractTimeSeriesInterp *interp, const std::string &id, te::gm::Geometry *geom) | |
Empty constructor. More... | |
TimeSeries (const TimeSeriesObservationSet &obs, AbstractTimeSeriesInterp *interp, const std::string &id, te::gm::Geometry *geom) | |
Constructor. More... | |
TimeSeries (const TimeSeriesPatch &patch, AbstractTimeSeriesInterp *interp, const std::string &id, te::gm::Geometry *geom) | |
It constructs a time series from a patch. More... | |
TimeSeries (const TimeSeries &ts) | |
Copy constructor. More... | |
TimeSeries Iterator | |
An example of use: TimeSeriesIterator it = tj.begin(); while(it!=tj.end()) { DateTime* t = it.getTime(); double v = it.getDouble(); //or getValue() or getInt()... ++it; } | |
TimeSeriesIterator | begin () const |
It returns an iterator that points to the first observation of the time series. More... | |
TimeSeriesIterator | end () const |
It returns an iterator that points to the end of the time series. More... | |
TimeSeriesIterator | at (te::dt::DateTime *t) const |
It returns an iterator that points to an observation at a given time. More... | |
Time Series Patch | |
These methods return patches of a time series, as TimeSeriesPatch objects, that satisfy given restrictions. A TimeSeriesPatch object contains only pointers to the initial and final observations that delimit a patch of a TimeSeries. The end() method of a TimeSeriesPatch object returns an iterator that points to the position AFTER the last required observation. Example of use: TimeSeriesPatch patch = tj->getTimeSeries(period, "DURING"); TimeSeriesIterator it = patch.begin(); while(it!=patch.end()) { DateTime* t = it.getTime(); double v = it.getDouble(); //or getInt() or get Value() ++it; } Other option is to create a new TimeSeries from the returned patch: TimeSeriesPatch patch = tj->getTimeSeries(period, "DURING"); TimeSeries tsnew(patch); | |
TimeSeriesPatch | getPatch (const te::dt::DateTime &dt, te::dt::TemporalRelation r=te::dt::DURING) const |
It returns a time series subset that satisfies a given temporal relation. More... | |
void | getPatches (const double &v, te::dt::BasicRelation r, std::vector< TimeSeriesPatch > &result) const |
It returns time series subsets that satisfy a given relation. More... | |
void | getPatches (const double &v, te::dt::BasicRelation r, const te::dt::DateTime &dt, te::dt::TemporalRelation tr, std::vector< TimeSeriesPatch > &result) const |
It returns time series subsets that satisfy a given relation. More... | |
Private Member Functions | |
void | getResultOrderedByTime (const double &v, te::dt::BasicRelation r, std::map< te::dt::DateTime *, te::dt::AbstractData *, te::dt::CompareDateTime > &result) const |
It returns the result of a basic relation ordered by time. More... | |
Private Attributes | |
std::string | m_id |
The time series identification. More... | |
AbstractTimeSeriesInterp * | m_interpolator |
The interpolator used to estimate values at non-observed times. More... | |
std::auto_ptr< te::gm::Geometry > | m_location |
The time series location. More... | |
TimeSeriesObservationSet | m_observations |
The time series observations. More... | |
A class to represent time series.
A time series represents a variation of a property over time, where this property is of a textual or numerical type (T -> A). It is composed of a set of observations and of an interpolator able to estimate values in non-observed times.
Definition at line 66 of file TimeSeries.h.
te::st::TimeSeries::TimeSeries | ( | ) |
Empty constructor.
It constructs an empty time series. The user does not indicate the interpolator associated to it. Internally, it uses a default interpolator that is NearestValueAtTimeInterp.
te::st::TimeSeries::TimeSeries | ( | const std::string & | id | ) |
Empty constructor.
It constructs an empty time series. The user does not indicate the interpolator associated to it. Internally, it uses a default interpolator that is NearestValueAtTimeInterp.
id | The time series id |
te::st::TimeSeries::TimeSeries | ( | AbstractTimeSeriesInterp * | interp, |
const std::string & | id | ||
) |
Empty constructor.
It constructs an empty trajectory.
id | The time series id. |
interp | The interpolator associated to the time series. |
te::st::TimeSeries::TimeSeries | ( | AbstractTimeSeriesInterp * | interp, |
const std::string & | id, | ||
te::gm::Geometry * | geom | ||
) |
Empty constructor.
It constructs an empty trajectory.
interp | The interpolator associated to the time series. |
id | The time series id. |
geom | The time series location. |
te::st::TimeSeries::TimeSeries | ( | const TimeSeriesObservationSet & | obs, |
AbstractTimeSeriesInterp * | interp, | ||
const std::string & | id, | ||
te::gm::Geometry * | geom | ||
) |
Constructor.
obs | The time series observations. |
interp | The interpolator associated to the time series. |
id | The time series id. |
geom | The time series location. |
te::st::TimeSeries::TimeSeries | ( | const TimeSeriesPatch & | patch, |
AbstractTimeSeriesInterp * | interp, | ||
const std::string & | id, | ||
te::gm::Geometry * | geom | ||
) |
It constructs a time series from a patch.
patch | The given patch. |
interp | The interpolator |
id | The time series id |
geom | The time series location |
te::st::TimeSeries::TimeSeries | ( | const TimeSeries & | ts | ) |
Copy constructor.
|
virtual |
It returns time series subsets that satisfy the given relations.
The possible basic relations are: LESS (1); MORE (2); EQUAL (4); LESS | EQUAL (5); MORE | EQUAL (6).
The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8) .
v1 | A given first value. |
r1 | A given relation associated to the first value. |
v2 | A given second value. |
r2 | A given relation associated to the second value. |
dt | A given date and time. |
tr | A given temporal relation. |
result | The returned patches. |
Virtual destructor.
void te::st::TimeSeries::add | ( | te::dt::DateTime * | time, |
te::dt::AbstractData * | value | ||
) |
It adds an observation (time and attribute value) into the time series.
time | A pointer to the time. |
data | A pointer to the attribute value. |
void te::st::TimeSeries::add | ( | te::dt::DateTime * | time, |
double | value | ||
) |
It adds an observation (time and attribute value as double) into the time series.
time | A pointer to the time. |
data | A pointer to the attribute value as a double. |
void te::st::TimeSeries::add | ( | te::dt::DateTime * | time, |
int | value | ||
) |
It adds an observation (time and attribute value as integer) into the time series.
time | A pointer to the time. |
data | A pointer to the attribute value as a integer. |
void te::st::TimeSeries::add | ( | te::dt::DateTime * | time, |
const std::string & | value | ||
) |
It adds an observation (time and attribute value as string) into the time series.
time | A pointer to the time. |
data | A pointer to the attribute value as a string. |
void te::st::TimeSeries::add | ( | const TimeSeriesObservation & | item | ) |
It adds an observation (time and attribute value) into the time series.
item | A time series item. |
TimeSeriesIterator te::st::TimeSeries::at | ( | te::dt::DateTime * | t | ) | const |
It returns an iterator that points to an observation at a given time.
If there is no observation at this given time, the returned iterator points to the end of the trajectory.
TimeSeriesIterator te::st::TimeSeries::begin | ( | ) | const |
It returns an iterator that points to the first observation of the time series.
TimeSeries* te::st::TimeSeries::clone | ( | ) | const |
It returns a clone of this time series.
TimeSeriesIterator te::st::TimeSeries::end | ( | ) | const |
It returns an iterator that points to the end of the time series.
double te::st::TimeSeries::getDouble | ( | te::dt::DateTime * | t | ) | const |
It returns the value as a double associated to a given date and time.
If there is no value associated to the given date and time, it will use internally its interpolation function.
t | A date and time. |
std::string te::st::TimeSeries::getId | ( | ) | const |
It returns the time series identifier.
int te::st::TimeSeries::getInt | ( | te::dt::DateTime * | t | ) | const |
It returns the value as an integer associated to a given date and time.
If there is no value associated to the given date and time, it will use internally its interpolation function.
t | A date and time. |
AbstractTimeSeriesInterp* te::st::TimeSeries::getInterpolator | ( | ) | const |
It returns the interpolator associated to the time series.
te::gm::Geometry* te::st::TimeSeries::getLocation | ( | ) | const |
It returns the time series location.
const TimeSeriesObservationSet& te::st::TimeSeries::getObservations | ( | ) | const |
It returns the time series observations.
TimeSeriesPatch te::st::TimeSeries::getPatch | ( | const te::dt::DateTime & | dt, |
te::dt::TemporalRelation | r = te::dt::DURING |
||
) | const |
It returns a time series subset that satisfies a given temporal relation.
The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8)
dt | A given date and time. |
r | A given temporal relation. |
void te::st::TimeSeries::getPatches | ( | const double & | v, |
te::dt::BasicRelation | r, | ||
std::vector< TimeSeriesPatch > & | result | ||
) | const |
It returns time series subsets that satisfy a given relation.
The possible basic relation is: LESS (1); MORE (2); EQUAL (4); LESS | EQUAL (5); MORE | EQUAL (6).
v | A given value. |
r | A given basic relation. |
result | The returned patches. |
void te::st::TimeSeries::getPatches | ( | const double & | v, |
te::dt::BasicRelation | r, | ||
const te::dt::DateTime & | dt, | ||
te::dt::TemporalRelation | tr, | ||
std::vector< TimeSeriesPatch > & | result | ||
) | const |
It returns time series subsets that satisfy a given relation.
The possible basic relation is: LESS (1); MORE (2); EQUAL (4); LESS | EQUAL (5); MORE | EQUAL (6).
v1 | A given first value. |
r1 | A given relation associated to the first value. |
v2 | A given second value. |
r2 | A given relation associated to the second value. |
result | The returned patches. |
It returns time series subsets that satisfy a the given relations.
The possible basic relations are: LESS (1); MORE (2); EQUAL (4); LESS | EQUAL (5); MORE | EQUAL (6).
The possible temporal relations are: AFTER (2); AFTER | EQUALS (10); 3. BEFORE (1); 4. BEFORE | EQUALS (9); DURING (4); EQUALS (8) .
v | A given value. |
r | A basic relation. |
dt | A given date and time. |
tr | A given temporal relation. |
result | The returned patches. |
|
private |
It returns the result of a basic relation ordered by time.
std::string te::st::TimeSeries::getString | ( | te::dt::DateTime * | t | ) | const |
It returns the value as a string associated to a given date and time.
If there is no value associated to the given date and time, it will use internally its interpolation function.
t | A date and time. |
std::auto_ptr<te::dt::DateTimePeriod> te::st::TimeSeries::getTemporalExtent | ( | ) | const |
It returns the temporal extent or range of the time series.
std::auto_ptr<te::dt::AbstractData> te::st::TimeSeries::getValue | ( | te::dt::DateTime * | t | ) | const |
It returns the value associated to a given date and time.
If there is no value associated to the given date and time, it will use internally its interpolation function.
t | A date and time. |
void te::st::TimeSeries::getValueExtent | ( | double & | minValue, |
double & | maxValue | ||
) |
It returns the minimal and maximun values of the time series.
minValue | The minumun value of the time series. |
maxValue | The maximun value of the time series. |
void te::st::TimeSeries::getValueExtent | ( | int & | minValue, |
int & | maxValue | ||
) |
It returns the minimal and maximun values of the time series.
minValue | The minumun value of the time series. |
maxValue | The maximun value of the time series. |
void te::st::TimeSeries::getValueExtent | ( | std::string & | minValue, |
std::string & | maxValue | ||
) |
It returns the minimal and maximun values of the time series.
minValue | The minumun value of the time series. |
maxValue | The maximun value of the time series. |
TimeSeries& te::st::TimeSeries::operator= | ( | const TimeSeries & | other | ) |
Copy assignment operator.
void te::st::TimeSeries::setId | ( | const std::string & | id | ) |
It sets the time series identifier.
id | The time series identifier. |
void te::st::TimeSeries::setInterpolator | ( | AbstractTimeSeriesInterp * | interp | ) |
It sets the interpolator associated to the time series.
interp | A interpolator which is able to estimate values at non-observed times. |
void te::st::TimeSeries::setLocation | ( | te::gm::Geometry * | geom | ) |
It sets the time series location.
geom | The time series location. |
std::size_t te::st::TimeSeries::size | ( | ) | const |
It returns the size of the time series observation set.
|
private |
The time series identification.
Definition at line 534 of file TimeSeries.h.
|
private |
The interpolator used to estimate values at non-observed times.
Definition at line 532 of file TimeSeries.h.
|
private |
The time series location.
Definition at line 533 of file TimeSeries.h.
|
private |
The time series observations.
Definition at line 531 of file TimeSeries.h.