conv/many suite: convert (m)any seismic data format(s)

◆ seriesofmissingsamples()

GapSeries seriesofmissingsamples ( const Gapsofstream gos,
const CompletenessBins cb,
const bool &  debug = false 
)

Function to extract a GapSeries from given Gapsofstream.

Definition at line 48 of file fnseriesofmissingsamples.cc.

References CompletenessBins::bin(), Gapid::dt, Gapsofstream::gap, GapSeries::gapseries, Gapsofstream::ID, CompletenessBins::isinbin(), CompletenessBins::nbins(), and CompletenessBins::nextbin().

Referenced by gnuplotplot(), and main().

51 {
52  // fetch header data
53  GapSeriesHeader header(cb, gos.ID);;
54  GapSeries retseries(header);
55  const libtime::TRelativeTime& dt=gos.ID.dt;
56  // build series
57  for (Gapsofstream::Tvecofgap::const_iterator G=gos.gap.begin();
58  G!=gos.gap.end(); ++G)
59  {
60  TFXX_debug(debug, "seriesofmissingsamples",
61  "fill in gap: " << (*G));
62  const libtime::TAbsoluteTime& first=G->first;
63  const libtime::TAbsoluteTime& last=G->last;
64  libtime::TAbsoluteTime current=first;
65  // do not process if this gaps actually is a break
66  if (!G->isbreak())
67  {
68  for (unsigned int i=0; i<cb.nbins(); ++i)
69  {
70  TFXX_debug(debug, "seriesofmissingsamples",
71  "bin #" << i << ": "
72  << cb.bin(i).timestring() << " - "
73  << cb.nextbin(i).timestring());
74  TFXX_debug(debug, "seriesofmissingsamples",
75  " current: " << current.timestring());
76  if (cb.isinbin(current, i))
77  {
78  TFXX_debug(debug, "seriesofmissingsamples",
79  "is in bin " << i << ": " << current.timestring());
80  libtime::TAbsoluteTime nextbin=cb.nextbin(i);
81  TFXX_debug(debug, "seriesofmissingsamples",
82  TFXX_value(nextbin.timestring()) << " " <<
83  TFXX_value(last.timestring()));
84  if (nextbin<=last)
85  {
86  unsigned int n=(nextbin-current)/dt;
87  while ((current+n*dt)<nextbin)
88  {
89  TFXX_debug(debug, "seriesofmissingsamples",
90  "n: " << n <<
91  " (current+n*dt): " <<
92  libtime::TAbsoluteTime(current+n*dt).timestring() <<
93  " nextbin: " << nextbin.timestring());
94  ++n;
95  }
96  TFXX_debug(debug, "seriesofmissingsamples",
97  "n: " << n <<
98  " (current+n*dt): " <<
99  libtime::TAbsoluteTime(current+n*dt).timestring() <<
100  " nextbin: " << nextbin.timestring());
101  retseries.gapseries(i) += n;
102  current += n*dt;
103  }
104  else
105  {
106  unsigned int n=(last-current)/dt;
107  while ((current+n*dt)<=last)
108  {
109  TFXX_debug(debug, "seriesofmissingsamples",
110  "n: " << n <<
111  " (current+n*dt): " <<
112  libtime::TAbsoluteTime(current+n*dt).timestring() <<
113  " last: " << last.timestring());
114  ++n;
115  }
116  TFXX_debug(debug, "seriesofmissingsamples",
117  "n: " << n <<
118  " (current+n*dt): " <<
119  libtime::TAbsoluteTime(current+n*dt).timestring() <<
120  " last: " << last.timestring());
121  retseries.gapseries(i) += n;
122  // no need to cycle further
123  i=cb.nbins();
124  }
125  } // if (cb.isinbin(current, i))
126  } // end of loop over bins
127  } // if (last >= first)
128  } // end of loop over gaps in gos
129  if (debug)
130  {
131  for (unsigned int j=retseries.gapseries.first();
132  j<=retseries.gapseries.last(); ++j)
133  {
134  std::cout << TFXX_value(j) << " "
135  << TFXX_value(retseries.gapseries(j)) << "\n";
136  }
137  }
138  return(retseries);
139 } // GapSeries seriesofmissingsamples()
a class to hold a gap series for one stream
unsigned int nbins() const
libtime::TAbsoluteTime bin(const unsigned int &i) const
beginnig of bin (according to bin raster)
bool isinbin(const libtime::TAbsoluteTime &d, const unsigned int &i) const
libtime::TRelativeTime dt
header data for complenetess series
libtime::TAbsoluteTime nextbin(const unsigned int &i) const
start of bin (will be earliest for fisrt bin)
Here is the call graph for this function:
Here is the caller graph for this function: