version
0.0.1
Defines the C++ API for MsPASS
|
Base class for time series objects. More...
#include <BasicTimeSeries.h>
Public Member Functions | |
BasicTimeSeries () | |
BasicTimeSeries (const BasicTimeSeries &) | |
virtual | ~BasicTimeSeries () |
Virtual destructor. More... | |
double | time (const int i) const |
int | sample_number (double t) const |
double | endtime () const noexcept |
bool | shifted () const |
double | time_reference () const |
void | force_t0_shift (const double t) |
Force a t0 shift value on data. More... | |
virtual void | ator (const double tshift) |
virtual void | rtoa () |
virtual void | shift (const double dt) |
bool | live () const |
bool | dead () const |
void | kill () |
void | set_live () |
double | dt () const |
bool | time_is_UTC () const |
bool | time_is_relative () const |
TimeReferenceType | timetype () const |
double | samprate () const |
size_t | npts () const |
double | t0 () const |
virtual void | set_dt (const double sample_interval) |
Set the sample interval. More... | |
virtual void | set_npts (const size_t npts) |
Set the number of samples attribute for data. More... | |
virtual void | set_t0 (const double t0in) |
Set the data start time. More... | |
void | set_tref (const TimeReferenceType newtref) |
Force the time standard. More... | |
BasicTimeSeries & | operator= (const BasicTimeSeries &parent) |
Protected Attributes | |
bool | mlive |
double | mdt |
double | mt0 |
size_t | nsamp |
TimeReferenceType | tref |
bool | t0shift_is_valid |
double | t0shift |
Base class for time series objects.
This is a mostly abstract class defining data and methods shared by all data objects that are time series. In MsPASS time series means data sampled on a 1d, uniform grid defined by a sample rate, start time, and number of samples. Derived types can be scalar, vector, complex, or any data that is uniformly sampled.
The seispp version of this class had public attributes for key data are essential for defining any time series data (e.g. sample interval). This was revised in MsPASS to use getters and putters to provide a cleaner interface to python with pybind11.
mspass::seismic::BasicTimeSeries::BasicTimeSeries | ( | ) |
Default constructor. Does essentially nothing since a BasicTimeSeries object has no data. Does initialize data to avoid run time checkers bitching about unitialized data, but values are meaningless when this constructor is called.
References mspass::seismic::Relative.
mspass::seismic::BasicTimeSeries::BasicTimeSeries | ( | const BasicTimeSeries & | tsin | ) |
|
inlinevirtual |
Virtual destructor.
A base class with virtual members like this requires this incantation to avoid some odd conflicts. This particular one was added to make the boost::serialization code work properly. The geeky details for why this is necessary can be found in Scott Meyers book "Effective C++"
|
virtual |
Absolute to relative time conversion. Sometimes we want to convert data from absolute time (epoch times) to a relative time standard. Examples are conversions to travel time using an event origin time or shifting to an arrival time reference frame. This operation simply switches the tref variable and alters t0 by tshift.
tshift | - time shift applied to data before switching data to relative time mode. |
Reimplemented in mspass::seismic::TimeSeriesWGaps.
References mspass::seismic::Relative.
|
inline |
|
inline |
|
inlinenoexcept |
|
inline |
Force a t0 shift value on data.
This is largely an interface routine for constructors that need to handle data in relative time that are derived from an absolute base. It can also be used to fake processing routines that demand data be in absolute time when the original data were not. It was added for MsPASS to support reads and writes to MongoDB where we want to be able to read and write data that had been previously time shifted (e.g. ArrivalTimeReference).
t | is the time shift to force |
|
inline |
|
inline |
|
inline |
BasicTimeSeries & mspass::seismic::BasicTimeSeries::operator= | ( | const BasicTimeSeries & | parent | ) |
Standard assignment operator.
|
virtual |
Relative to absolute time conversion. Sometimes we want to convert data from relative time to to an UTC time standard. An example would be converting segy shot data to something that could be processed like earthquake data in a css3.0 database.
This method returns data previously converted to relative back to UTC using the internally stored time shift attribute.
Reimplemented in mspass::seismic::TimeSeriesWGaps.
References mspass::seismic::UTC.
|
inline |
Inverse of time function. That is, it returns the integer position of a given time t within a time series. The returned number is not tested for validity compared to the data range. This is the callers responsibility as this is a common error condition that should not require the overhead of an exception.
|
inline |
|
inlinevirtual |
Set the sample interval.
This is a simple setter for the sample interval attribute. It is virtual because children may want to do more than just set the attribute in this base class. In MsPASS that means keeping the Metadata attributes that define sample interval in sync with the data. Aliases further complicate that issue so it is not trivial. Other data objects that could be derived form this base could have similar issues.
sample_interval | is the new data sample interval to be used. |
Reimplemented in mspass::seismic::CoreTimeSeries, and mspass::seismic::CoreSeismogram.
References mdt.
|
inline |
|
inlinevirtual |
Set the number of samples attribute for data.
This is a simple setter for the number of samples attribute. It is virtual because children may want to do more than just set the attribute in this base class. In MsPASS that means keeping the Metadata attributes that define the number of points in sync with the data. Aliases further complicate that issue so it is not trivial. Other data objects that could be derived form this base could have similar issues.
npts | is the new number of points to set. |
Reimplemented in mspass::seismic::CoreTimeSeries, and mspass::seismic::CoreSeismogram.
|
inlinevirtual |
Set the data start time.
This is a simple setter for the start time attribute. It is virtual because children may want to do more than just set the attribute in this base class. In MsPASS that means keeping the Metadata attributes that define t0 in sync with the data. Aliases further complicate that issue so it is not trivial. Other data objects that could be derived form this base could have similar issues.
t0in | is the new data sample interval to be used. |
Reimplemented in mspass::seismic::CoreTimeSeries, and mspass::seismic::CoreSeismogram.
References mt0.
|
inline |
Force the time standard.
Time series data may have multiple concepts of what the time standard is. In MsPASS the allowed values currently are UTC and relative defined by the TimeReferenceType enum class. Other implementations might need to use some other standard (e.g. raw gps time is not utc). This method allows forcing a standard. It is not recommended for normal use, but only as a brutal solution for assembling a data object outside normal constructors.
newtref | is the new time standard to set for these data. |
References tref.
|
virtual |
Shift the reference time.
Sometimes we need to shift the reference time t0. An example is a moveout correction. This method shifts the reference time by dt. Note a positive dt means data aligned to zero will be shifted left because relative time is t-t0.
Reimplemented in mspass::seismic::TimeSeriesWGaps.
|
inline |
|
inline |
|
inline |
|
inline |
Test if the time standard is UTC.
References tref, and mspass::seismic::UTC.
double mspass::seismic::BasicTimeSeries::time_reference | ( | ) | const |
Return the reference time.
We distinguish relative and UTC time by a time shift constant stored with the object. This returns the time shift to return data to an epoch time.
SeisppError | object if the request is not rational. That is this request only makes sense if the data began with an absolute time and was converted with the ator method. Some cross checks are made for consistency that can throw an error in this condition. |
References mspass::seismic::UTC.
|
protected |
Sample interval.
|
protected |
Boolean defining if a data object has valid data or is to be ignored. Data processing often requires data to be marked bad but keep the original data around in case an error was made. This boolean allows this capability.
|
protected |
Data start time. That is the time of the first sample of data.
|
protected |
Number of data samples in this data object.
|
protected |
Time reference standard for this data object. Defined by enum Time_Reference this currently is only one of two things. When set as "UTC" the time standard is an epoch time. When set as "relative" time has no relationship to any external standard but are relative to some arbitrary reference that must ascertained by the algorithm by some other means (in seispp this is normally done through a metadata object). A classic example is multichannel data where channels have a time relative to a shot time.