version  0.0.1
Defines the C++ API for MsPASS
Loading...
Searching...
No Matches
DataGap.h
1#ifndef _MSPASS_SEISMIC_DATAGAP_H_
2#define _MSPASS_SEISMIC_DATAGAP_H_
3#include "mspass/algorithms/TimeWindow.h"
4#include <list>
5#include <set>
6
7namespace mspass::seismic {
17public:
18 bool operator()(const mspass::algorithms::TimeWindow ti1,
19 const mspass::algorithms::TimeWindow ti2) const {
20 return (ti1.end < ti2.start);
21 };
22};
23
24class DataGap {
25public:
27 DataGap() {};
29 DataGap(const std::list<mspass::algorithms::TimeWindow> &twlist);
30 DataGap(const DataGap &parent) : gaps(parent.gaps) {};
31 virtual ~DataGap() {};
38 bool is_gap(const double ttest); // query by time
55 bool has_gap() { return (!gaps.empty()); };
64 std::list<mspass::algorithms::TimeWindow> get_gaps() const;
74 void clear_gaps() {
75 if (!gaps.empty())
76 gaps.clear();
77 };
79 int number_gaps() const { return gaps.size(); };
97 void translate_origin(double time_of_new_origin);
99 DataGap &operator=(const DataGap &parent);
101 DataGap &operator+=(const DataGap &other);
102
103protected:
109 std::set<mspass::algorithms::TimeWindow, mspass::algorithms::TimeWindowCmp>
111};
112} // namespace mspass::seismic
113#endif // end guard
Function object used for weak comparison to order TimeWindow objects.
Definition TimeWindow.h:81
Defines a time window.
Definition TimeWindow.h:12
double start
Definition TimeWindow.h:17
double end
Definition TimeWindow.h:21
Definition DataGap.h:24
DataGap & operator=(const DataGap &parent)
Definition DataGap.cc:97
void add_gap(const mspass::algorithms::TimeWindow tw)
Definition DataGap.cc:13
DataGap(const std::list< mspass::algorithms::TimeWindow > &twlist)
DataGap & operator+=(const DataGap &other)
Definition DataGap.cc:103
void translate_origin(double time_of_new_origin)
Definition DataGap.cc:85
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 d...
Definition DataGap.h:110
void clear_gaps()
Clear gaps.
Definition DataGap.h:74
bool has_gap()
Definition DataGap.h:55
DataGap()
Definition DataGap.h:27
int number_gaps() const
Definition DataGap.h:79
std::list< mspass::algorithms::TimeWindow > get_gaps() const
Definition DataGap.cc:55
bool is_gap(const double ttest)
Definition DataGap.cc:33
DataGap subset(const mspass::algorithms::TimeWindow tw) const
Definition DataGap.cc:61
Define metadata keys.
Definition BasicSpectrum.h:6