DATRW++ library: seismic data I/O with multiple formats

◆ set_next_header()

void datrw::ihpmostream::set_next_header ( )
private

set header for next request

Definition at line 172 of file ihpmostream.cc.

References Mdatafile, Mindex, Mnblocks, Mnextblock, Mnextchannel, datrw::hpmo::MinuteBlock::Mtime, datrw::hpmo::nchannels, datrw::idatstream::newtrace(), datrw::hpmo::nsamples, datrw::hpmo::qualityreports(), datrw::hpmo::sampling_interval, datrw::idatstream::setlast(), datrw::idatstream::settracefree(), datrw::idatstream::setwid2(), and datrw::hpmo::toffset().

Referenced by dseries(), and skipseries().

173  {
174  const int firstblock=Mindex[Mnextblock];
175  const int lastblock=Mindex[Mnextblock+1]-1;
176  const int nblocks=lastblock-firstblock+1;
177  const int nsamp=nblocks*datrw::hpmo::nsamples;
178  // DEBUG
179  // std::cout << firstblock << " " << lastblock << " "
180  // << Mnextblock << " " << Mnextchannel << std::endl;
181  this->newtrace();
182  // set WID2 header
183  sff::WID2 wid2line;
184  wid2line.station="BFO";
185  wid2line.auxid="HPMO";
186  wid2line.dt=datrw::hpmo::sampling_interval;
187  std::ostringstream oss;
188  oss << "K";
189  oss.width(2);
190  oss.fill('0');
191  oss << Mnextchannel;
192  wid2line.channel=oss.str();
193  wid2line.nsamples=nsamp;
194  // calculate time of first sample for this channel
195  wid2line.date=Mdatafile[firstblock].Mtime;
196  wid2line.date -= libtime::TRelativeTime(0,0,0,57);
197  wid2line.date += datrw::hpmo::toffset(Mnextchannel);
198  this->setwid2(wid2line);
199  // set FREE block of header
200  oss.str("");
201  oss << "channel " << Mnextchannel << " extracted from "
202  << lastblock-firstblock+1 << " contiguous minute blocks";
203  sff::FREE tracefree;
204  tracefree.append(oss.str());
205  tracefree.append(qualityreports(&Mdatafile[firstblock],
206  lastblock-firstblock+1));
207  this->settracefree(tracefree);
208  // proceed pointers to next trace
209  ++Mnextchannel;
211  {
212  Mnextchannel=1;
213  ++Mnextblock;
214  if (Mnextblock >= Mnblocks)
215  {
216  this->setlast();
217  }
218  }
219  } // void ihpmostream::set_next_header()
sff::FREE qualityreports(const MinuteBlock *blocks, const int &nblocks)
prepare a report on unusual quality reports
Definition: readhpmo.cc:125
const double sampling_interval
sampling interval in seconds
Definition: hpmodata.h:55
const int nchannels
number of channels in HP MO data acquisition system
Definition: hpmodata.h:49
const int nsamples
number of samples per minute block and channel
Definition: hpmodata.h:51
void setwid2(const sff::WID2 &wid2)
Definition: datread.cc:113
datrw::hpmo::MinuteBlock Mdatafile[datrw::hpmo::nminutes]
buffer to hold one data file
Definition: hpmo.h:79
libtime::TRelativeTime toffset(const int &ichannel)
return time offset for channel ichannel (due to multiplexer)
Definition: readhpmo.cc:90
libtime::TAbsoluteTime Mtime
Definition: hpmodata.h:68
void settracefree(const sff::FREE &free)
Definition: datread.cc:105
int Mnextchannel
Definition: hpmo.h:83
int Mindex[datrw::hpmo::nminutes]
Definition: hpmo.h:80
int Mnextblock
Definition: hpmo.h:82
Here is the call graph for this function:
Here is the caller graph for this function: