conv/many suite: convert (m)any seismic data format(s)
structgapanalysis.cc
Go to the documentation of this file.
1 
38 #define TF_STRUCTGAPANALYSIS_CC_VERSION \
39  "TF_STRUCTGAPANALYSIS_CC V1.1"
40 
41 #include "structgapanalysis.h"
42 
43 /*----------------------------------------------------------------------*/
44 
46 {
47  Gapsummary retval(this->Mearliest, this->Mlatest, this->ID.dt);
48  Tvecofgap::const_iterator I=gap.begin();
49  while (I!=gap.end())
50  {
51  if (I->isbreak()) { ++retval.nbreaks; } else { ++retval.ngaps; }
52  retval.nmissing += I->nmissing();
53  retval.tmissing += I->tmissing();
54  ++I;
55  }
56  return(retval);
57 } // Gapsummary Gapsofstream::summarize() const
58 
59 /*----------------------------------------------------------------------*/
60 
62 std::ostream& operator<<(std::ostream& os, const Gapid& id)
63 {
64  os << id.ID << " dt=" << id.dt.timestring();
65  return(os);
66 } // std::ostream& operator<<(std:ostream& os, const Gapid& id)
67 
68 /*----------------------------------------------------------------------*/
69 
71 std::ostream& operator<<(std::ostream& os, const Contiguous& chunk)
72 {
73  Gapid id(chunk);
74  os << "chunk of " << id << ":" << "\n";
75  os << chunk.first.timestring() << " - " << chunk.last.timestring();
76  return(os);
77 } // std::ostream& operator<<(std:ostream& os, const Contiguous& chunk)
78 
79 /*----------------------------------------------------------------------*/
80 
82 std::ostream& operator<<(std::ostream& os, const Gap& gap)
83 {
84  os << " " << gap.first.timestring();
85  if (gap.isbreak())
86  {
87  os << ": break in contiguous data\n";
88  }
89  else
90  {
91  os << " - " << gap.last.timestring() << "\n";
92  }
93  unsigned int nmissing=(gap.ID.dt+gap.last-gap.first)/gap.ID.dt;
94  os << " "
95  << ": " << nmissing
96  << " sample";
97  if (nmissing!=1) { os << "s are"; } else { os << " is"; }
98  os << " missing";
99  return(os);
100 } // std::ostream& operator<<(std::ostream& os, const Gap& gap)^
101 
102 /* ----- END OF structgapanalysis.cc ----- */
structs used in primary gap analysis (prototypes)
unsigned int ngaps
total number of gaps
std::ostream & operator<<(std::ostream &os, const Gapid &id)
print stream ID
Gapsummary summarize() const
provide a summary for this stream
ID to identify stream.
unsigned int nbreaks
total number of breaks
libtime::TAbsoluteTime first
libtime::TAbsoluteTime first
struct to present a summary
Indicate a contiguous set of data.
libtime::TAbsoluteTime Mlatest
unsigned int nmissing
number of missing samples
struct to hold one gap
libtime::TAbsoluteTime last
libtime::TRelativeTime dt
libtime::TAbsoluteTime Mearliest
Gapid ID
bool isbreak() const
libtime::TRelativeTime tmissing
time span not covered with samples
libtime::TAbsoluteTime last