5 #include <boost/cast.hpp>
7 #include <boost/date_time/posix_time/posix_time.hpp>
12 TimeSeries::TimeSeries()
21 TimeSeries::~TimeSeries()
34 copy(source.
t.begin(), source.
t.end(), back_inserter(t));
59 void TimeSeries::erase(
const int startindex,
const int endindex)
61 Ex.
GetData().erase(Ex.GetData().begin() + startindex,
62 Ex.GetData().begin() + endindex);
63 Ey.GetData().erase(Ey.GetData().begin() + startindex,
64 Ey.GetData().begin() + endindex);
65 Hx.GetData().erase(Hx.GetData().begin() + startindex,
66 Hx.GetData().begin() + endindex);
67 Hy.GetData().erase(Hy.GetData().begin() + startindex,
68 Hy.GetData().begin() + endindex);
69 Hz.GetData().erase(Hz.GetData().begin() + startindex,
70 Hz.GetData().begin() + endindex);
71 t.erase(t.begin() + startindex, t.begin() + endindex);
74 size_t TimeSeries::Size()
76 size_t exlength = Ex.GetData().size();
77 if (exlength != Ey.GetData().size() || exlength != Hx.GetData().size()
78 || exlength != Hy.GetData().size() || exlength
79 != Hz.GetData().size())
81 "Component sizes differ, unable to determine size !");
92 boost::posix_time::time_duration startdiff(Data1.
GetTime().at(0)
94 int offset = boost::numeric_cast<
int>(startdiff.total_microseconds()
96 if (boost::numeric_cast<unsigned int>(abs(offset)) > min(
100 Data2.
erase(0, offset);
102 Data1.
erase(0, -offset);
ttimedata t
The time associated with each data point.
TimeSeriesComponent Ey
The data for the east-west electric field.
virtual void GetData(const std::string filename)=0
void erase(const int startindex, const int endindex)
Erase data between startindex and endindex.
double GetSamplerate()
The samplerate is stored in each component, we just return the samplerate of Hx assuming they are all...
This class is the base class for all classes dealing with MT time series.
TimeSeriesComponent Ex
The data for the north-south electric field.
TimeSeriesComponent Hz
The data for the vertical magnetic field.
TimeSeriesComponent Hy
The data for the east-west magnetic field.
TimeSeriesComponent Hx
The data for the north-south magnetic field.
The basic exception class for all errors that arise in gplib.