27 #include "../../../datatype/DateTime.h" 28 #include "../../../datatype/DateTimePeriod.h" 29 #include "../../../datatype/DateTimeInstant.h" 30 #include "../../../datatype/DateTimeUtils.h" 31 #include "../../../datatype/SimpleData.h" 32 #include "../../../datatype/AbstractData.h" 33 #include "../../../geometry/Geometry.h" 38 #include "../interpolator/AbstractTimeSeriesInterp.h" 39 #include "../interpolator/NearestValueAtTimeInterp.h" 55 const std::string&
id)
83 while(it!=patch.
end())
113 TimeSeriesObservationSet::const_iterator it =
m_observations.begin();
114 TimeSeriesObservationSet::const_iterator ite =
m_observations.end();
199 TimeSeriesObservationSet::const_iterator it =
m_observations.begin();
205 TimeSeriesObservationSet::const_iterator it =
m_observations.end();
212 TimeSeriesObservationSet::const_iterator it =
m_observations.find(item);
219 TimeSeriesObservationSet::const_iterator it =
m_observations.find(item);
220 TimeSeriesObservationSet::const_iterator ite =
m_observations.end();
222 return std::unique_ptr<te::dt::AbstractData>(it->getValue()->clone());
228 std::unique_ptr<te::dt::AbstractData> v(
getValue(t));
229 return atof(v->toString().c_str());
234 std::unique_ptr<te::dt::AbstractData> v(
getValue(t));
235 return atoi(v->toString().c_str());
240 std::unique_ptr<te::dt::AbstractData> v(
getValue(t));
241 return v->toString();
247 TimeSeriesObservationSet::reverse_iterator it2 =
m_observations.rbegin();
279 TimeSeriesObservationSet::const_iterator itb =
m_observations.end();
280 TimeSeriesObservationSet::const_iterator ite =
m_observations.end();
314 std::unique_ptr<te::dt::DateTimePeriod> period(static_cast<te::dt::DateTimePeriod*>(dt.
clone()));
326 std::pair<TimeSeriesObservationSet::const_iterator, TimeSeriesObservationSet::const_iterator> itPair;
339 std::vector<TimeSeriesPatch>& result)
const 342 std::map<te::dt::DateTime*, te::dt::AbstractData*, te::dt::CompareDateTime> resultTS;
347 std::map<te::dt::DateTime*, te::dt::AbstractData*,
351 TimeSeriesObservationSet::const_iterator itOriginBegin =
m_observations.find(item);
352 TimeSeriesObservationSet::const_iterator itOriginEnd =
m_observations.end();
354 TimeSeriesObservationSet::const_iterator patchBegin;
355 TimeSeriesObservationSet::const_iterator patchEnd;
357 while(itResultBegin!=itResultEnd && itOriginBegin!=itOriginEnd)
359 patchBegin = itOriginBegin;
362 while( (itResultBegin!=itResultEnd) && (itOriginBegin!=itOriginEnd) &&
363 (itResultBegin->first == itOriginBegin->getTime()))
365 patchEnd = itOriginBegin;
372 if(patchEnd!=itOriginEnd)
378 if(itResultBegin!=itResultEnd)
380 item.
setTime(static_cast<te::dt::DateTime*>(itResultBegin->first->clone()));
390 std::vector<TimeSeriesPatch>& result)
const 394 std::vector<TimeSeriesPatch> patches;
397 std::vector<TimeSeriesPatch>::const_iterator it = patches.begin();
398 TimeSeriesObservationSet::const_iterator ite =
m_observations.end();
400 while(it!=patches.end())
409 if(itAuxBegin!=ts.
end())
416 if(itAuxEnd==ts.
end())
437 std::map<te::dt::DateTime*, te::dt::AbstractData*, te::dt::CompareDateTime>& result)
const 455 std::pair<TimeSeriesByValue::const_iterator, TimeSeriesByValue::const_iterator> itPair;
457 itResultBeg = itPair.first;
458 itResultEnd = itPair.second;
475 while(itResultBeg!=itResultEnd)
477 result.insert(std::pair<te::dt::DateTime*,te::dt::AbstractData*>(itResultBeg->getTime(), itResultBeg->getValue()));
static boost::posix_time::ptime bt
double getDouble() const
It returns the attribute value as a double pointed by the internal cursor.
This file contains a class to represent a time series observation.
SimpleData< std::string, STRING_TYPE > String
TimeSeries & operator=(const TimeSeries &other)
Copy assignment operator.
TimeSeries * clone() const
It returns a clone of this time series.
void setInterpolator(AbstractTimeSeriesInterp *interp)
It sets the interpolator associated to the time series.
std::string getId() const
It returns the time series identifier.
BasicRelation
Relations between simple attribute values.
TimeSeriesIterator at(te::dt::DateTime *t) const
It returns an iterator that points to an observation at a given time.
std::string getString() const
It returns the attribute value as a string pointed by the internal cursor.
A class to traverse the observations of a TimeSeries.
double getDouble(te::dt::DateTime *t) const
It returns the value as a double associated to a given date and time.
std::unique_ptr< te::gm::Geometry > m_location
The time series location.
TimeSeriesIterator end() const
virtual ~TimeSeries()
It returns time series subsets that satisfy the given relations.
std::size_t size() const
It returns the size of the time series observation set.
SimpleData< boost::int32_t, INT32_TYPE > Int32
TemporalRelation
Temporal relations between date and time (Source: Allen, 1991).
te::dt::DateTime * getTime() const
It returns the datetime pointed by the internal cursor.
An auxiliary struct to compare two datetime pointers.
void getValueExtent(double &minValue, double &maxValue)
It returns the minimal and maximun values of the time series.
virtual std::unique_ptr< te::dt::AbstractData > estimate(const TimeSeries &ts, te::dt::DateTime *time) const =0
It estimates a value at a given non-observed time of a time series.
This file contains a class to represent a time series.
A class to represent an observation (time and value) of a time series.
std::string getString(te::dt::DateTime *t) const
It returns the value as a string associated to a given date and time.
int getInt() const
It returns the attribute value as an integer pointed by the internal cursor.
int getInt(te::dt::DateTime *t) const
It returns the value as an integer associated to a given date and time.
std::unique_ptr< te::dt::DateTimePeriod > getTemporalExtent() const
It returns the temporal extent or range of the time series.
void add(te::dt::DateTime *time, te::dt::AbstractData *value)
It adds an observation (time and attribute value) into the time series.
TimeSeriesIterator begin() const
static te::dt::TimeDuration dt(20, 30, 50, 11)
AbstractTimeSeriesInterp * m_interpolator
The interpolator used to estimate values at non-observed times.
virtual AbstractData * clone() const =0
It returns a clone of this object.
A base class for values that can be retrieved from the data access module.
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.
TimeSeries()
Empty constructor.
const TimeSeriesObservationSet & getObservations() const
It returns the time series observations.
te::gm::Geometry * getLocation() const
It returns the time series location.
A struct to represent a patch or a continuous piece of a time series.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
void setTime(te::dt::DateTime *t)
It sets the date time.
TimeSeriesObservationSet m_observations
The time series observations.
std::unique_ptr< te::dt::AbstractData > getValue(te::dt::DateTime *t) const
It returns the value associated to a given date and time.
An abstract class for an interpolation function or interpolator that estimate a value at non-observav...
void setLocation(te::gm::Geometry *geom)
It sets the time series location.
A class to represent time series.
SimpleData< double, DOUBLE_TYPE > Double
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.
std::string m_id
The time series identification.
void setId(const std::string &id)
It sets the time series identifier.
TEDATATYPEEXPORT DateTimePeriod * GetTemporalExtent(const DateTime *t1, const DateTime *t2)
It returns the temporal extent of two date and time types.
A template for atomic data types (integers, floats, strings and others).
void getPatches(const double &v, te::dt::BasicRelation r, std::vector< TimeSeriesPatch > &result) const
It returns time series subsets that satisfy a given relation.
AbstractTimeSeriesInterp * getInterpolator() const
It returns the interpolator associated to the time series.
TimeSeriesIterator end() const
It returns an iterator that points to the end of the time series.
TimeSeriesIterator begin() const
It returns an iterator that points to the first observation of the time series.
It is an interpolation function the estimates the nearest value at a given non-observed time of a tim...
boost::multi_index_container< TimeSeriesObservation, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::identity< TimeSeriesObservation > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< TimeSeriesObservation, double,&TimeSeriesObservation::getDouble > >, boost::multi_index::ordered_non_unique< boost::multi_index::const_mem_fun< TimeSeriesObservation, std::string,&TimeSeriesObservation::getString > > > > TimeSeriesObservationSet