39 #define TF_IPO_CC_VERSION \ 54 : Exception(message, file, line, cond)
65 : Exception(message, file, line, cond)
73 const libtime::TAbsoluteTime&
first,
74 const libtime::TRelativeTime& dt,
79 typedef Ttimeseries::Theader Theader;
81 using libtime::TAbsoluteTime;
82 using libtime::TRelativeTime;
83 using libtime::TRange;
85 TAbsoluteTime old_first=hd.date;
86 TAbsoluteTime old_last=sff::wid2lastsample(hd);
87 TAbsoluteTime new_first=
first;
88 TAbsoluteTime new_last=new_first+(n-1)*dt;
93 if (old_first > new_first)
95 int noff=(old_first-new_first)/dt;
96 new_first += (dt*noff);
98 while (new_first < old_first) { new_first += dt; nsamples--; }
100 if (old_last < new_last)
102 int noff=(new_last-old_last)/dt;
103 new_last -= (dt*noff);
105 while (new_last > old_last) { new_last -= dt; nsamples--; }
108 "new time window is empty",
112 "window covered by input series:\n " 113 << old_first.timestring() <<
" - " 114 << old_last.timestring());
116 "window requested for output series:\n " 117 << new_first.timestring() <<
" - " 118 << new_last.timestring());
119 TRange inputwindow(old_first, old_last);
120 TRange outputwindow(new_first, new_last);
122 "new time span is outside time series",
125 retval.header.date=new_first;
126 retval.header.nsamples=nsamples;
127 retval.header.dt=libtime::time2double(dt);
128 TAbsoluteTime it=new_first;
129 for (
int i=0; i<nsamples; ++i) { retval(i)=ip(it); it += dt; }
Exception in case time windows are not overlapping.
void first(const Tseries &s)
Exception in case resulting time window is empty.
#define TSXX_debug(C, N, M)
produce debug output
Interface to time series interpolator.
Structure to hold the data samples of a series together with header information to form a time series...
ts::TDsfftimeseries resample(const Interpolator &ip, const libtime::TAbsoluteTime &first, const libtime::TRelativeTime &dt, const int &n, const bool &shrink)
resample a time series
ts::TDtimeseries Ttimeseries
use double precision time series
All stuff in this library will be placed within namespace ts.
Ttimeseries::Tseries Tseries
bool debug() const
indicate whether interpolator is in debug mode
#define TSXX_Xassert(C, M, E)
Check an assertion and report by throwing an exception.
interpolation interface (prototypes)
ExceptionTimeWindowEmpty(const char *message, const char *file, const int &line, const char *condition)
ExceptionTimeWindowOutside(const char *message, const char *file, const int &line, const char *condition)