|
MsPASS C++ API
2.4.1.dev4+g92330b7a
Defines the C++ API for MsPASS
|
Container defining invalid time spans for gappy seismic data. More...
#include <DataGap.h>

Public Member Functions | |
| DataGap () | |
| DataGap (const std::list< mspass::algorithms::TimeWindow > &twlist) | |
| DataGap (const DataGap &parent) | |
| virtual | ~DataGap () |
| bool | is_gap (const double ttest) |
| bool | has_gap (const mspass::algorithms::TimeWindow twin) |
| bool | has_gap () |
| void | add_gap (const mspass::algorithms::TimeWindow tw) |
| std::list< mspass::algorithms::TimeWindow > | get_gaps () const |
| void | clear_gaps () |
| Clear gaps. | |
| int | number_gaps () const |
| DataGap | subset (const mspass::algorithms::TimeWindow tw) const |
| void | translate_origin (double time_of_new_origin) |
| DataGap & | operator= (const DataGap &parent) |
| DataGap & | operator+= (const DataGap &other) |
Protected Attributes | |
| std::set< mspass::algorithms::TimeWindow, mspass::algorithms::TimeWindowCmp > | gaps |
| Holds data gap definitions. We use an STL set object to define data gaps for any time series object derived from this base class. The set is keyed by a TimeWindow which allows a simple, fast way to define a time range with invalid data. | |
Container defining invalid time spans for gappy seismic data.
DataGap stores TimeWindow intervals in a set so algorithms can query whether samples or windows overlap known gaps.
|
inline |
Default construtor. Does nothing but create empty gap container.
| mspass::seismic::DataGap::DataGap | ( | const std::list< mspass::algorithms::TimeWindow > & | twlist | ) |
Construct with an initial list of TimeWindows defining gaps.
References gaps.
|
inline |
Copy constructor.
|
inlinevirtual |
Virtual destructor for gap-aware derived classes.
| void mspass::seismic::DataGap::add_gap | ( | const mspass::algorithms::TimeWindow | tw | ) |
Adds a gap to the gap definitions for this data object. Sometimes an algorithm detects or needs to create a gap (e.g. a mute, or a constructor). This function provides a common mechanism to define such a gap in the data.
References mspass::algorithms::TimeWindow::end, gaps, and mspass::algorithms::TimeWindow::start.
|
inline |
Clear gaps.
It is sometimes necessary to clear gap definitions. This is particularly important when a descendent of this class is cloned and then morphed into something else. This method clears the entire content. This class assumes gaps are an immutable property of recorded data. A subclass could be used to add that functionality.
References gaps.
| std::list< TimeWindow > mspass::seismic::DataGap::get_gaps | ( | ) | const |
|
inline |
| bool mspass::seismic::DataGap::has_gap | ( | const mspass::algorithms::TimeWindow | twin | ) |
Checks if a given data segment has a gap. For efficiency it is often useful to ask if a whole segment of data is free of gaps. Most time series algorithms cannot process through data gaps so normal practice would be to drop data with any gaps in a requested time segment.
| twin | time window of data to test defined by a TimeWindow object |
References gaps.
| bool mspass::seismic::DataGap::is_gap | ( | const double | ttest | ) |
Checks if data at time ttest is a gap or valid data. This function is like the overloaded version with an int argument except it uses a time instead of sample number for the query.
| ttest | - time to be tested. |
References mspass::algorithms::TimeWindow::end, gaps, and mspass::algorithms::TimeWindow::start.
|
inline |
| DataGap mspass::seismic::DataGap::subset | ( | const mspass::algorithms::TimeWindow | tw | ) | const |
Return the subset of gaps within a specified time interval.
| tw | TimeWindow defining range to be returned. Note overlaps with the edge will be returned with range outside the range defined by tw. If the tw is larger than the range of the current content returns a copy of itself. |
References add_gap(), mspass::algorithms::TimeWindow::end, get_gaps(), and mspass::algorithms::TimeWindow::start.
| void mspass::seismic::DataGap::translate_origin | ( | double | time_of_new_origin | ) |
Shift the times of all gaps by a value.
When used with a TimeSeries or Seismogram the concept of UTC versus relative time requires shifting the time origin. This method should be used in that context or any other context where the data origin is shifted. The number passed as shift is subtracted from all the window start and end times that define data gaps.
References add_gap(), clear_gaps(), mspass::algorithms::TimeWindow::end, gaps, and mspass::algorithms::TimeWindow::start.