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

◆ put()

void datrw::thiesdl1::File::put ( const DataLine line)
private

drop a data line

Definition at line 318 of file thiesdl1file.cc.

References datrw::thiesdl1::DataLine::counts(), DL1_rcassert, datrw::thiesdl1::dl1samplinginterval, datrw::thiesdl1::FileHeader::earliestdate, datrw::thiesdl1::FileHeader::latestdate, datrw::thiesdl1::DataLine::line(), Mbetolerantagainstredundant, Mbetolerantagainstwrongtime, Mfilled, Mfoundunexpecteddatatime, Mheader, Miseries, Mnsamples, Mtracefree, and datrw::thiesdl1::DataLine::time().

Referenced by read().

319  {
320  std::ostringstream oss;
321  // check the time value against the expected time range
323  {
324  DL1_rcassert ((line.time()>=this->Mheader.earliestdate)
325  && (line.time()<=this->Mheader.latestdate),
326  "sample does not fit in expected window",
327  this->Mheader.earliestdate, this->Mheader.latestdate,
328  line.line());
329  }
330  else
331  {
332  if ((line.time()<this->Mheader.earliestdate)
333  || (line.time()>this->Mheader.latestdate))
334  {
335  std::cerr << "sample does not fit in expected window";
336  std::cerr << " earliest in expected window: " <<
337  this->Mheader.earliestdate.timestring();
338  std::cerr << " latest in expected window: " <<
339  this->Mheader.latestdate.timestring();
340  std::cerr << " DL1 data line: " << line.line();
341  oss.clear();
342  oss.str("");
343  oss << "ERROR: data line with weird time: " << line.line();
344  Mtracefree.append(oss.str());
346  }
347  }
348  // evaluate value and fill my record of samples
349  // this uses libtime nfit, which provides safe rounding
350  unsigned int i=(line.time()-
352  if (!this->Mbetolerantagainstwrongtime)
353  {
354  DL1_rcassert (((i>=0) && (i<Mnsamples)),
355  "sample index out of range",
356  this->Mheader.earliestdate,
357  this->Mheader.latestdate,
358  line.line());
359  }
360  if (i>=0 && i<Mnsamples)
361  {
362  if (Mfilled(i))
363  {
364  oss.clear();
365  oss.str("");
366  oss << "NOTICE: duplicate sample time (index "
367  << i << "): " << line.line();
368  if (!this->Mbetolerantagainstredundant)
369  {
370  std::cerr << oss.str() << std::endl;
371  }
372  Mtracefree.append(oss.str());
373  }
374  Mfilled(i)=true;
375  Miseries(i) += line.counts();
376  }
377  else
378  {
379  oss.clear();
380  oss.str("");
381  oss << "ERROR: sample index " << i << " out of range: " << line.line();
382  std::cerr << oss.str() << std::endl;
383  Mtracefree.append(oss.str());
384  }
385  } // void File::put(const DataLine& line)
bool Mbetolerantagainstwrongtime
mode: do not abort upon wrong sample time
Definition: thiesdl1file.h:196
#define DL1_rcassert(C, M, E, L, N)
Definition: thiesdl1file.cc:96
const libtime::TRelativeTime dl1samplinginterval
expected sampling interval of DL1
unsigned int Mnsamples
number of samples
Definition: thiesdl1file.h:183
bool Mbetolerantagainstredundant
mode: do not abort upon redundant samples
Definition: thiesdl1file.h:194
aff::Series< bool > Mfilled
an array to keep track of samples
Definition: thiesdl1file.h:189
Tiseries Miseries
prepare are series of counts
Definition: thiesdl1file.h:187
libtime::TAbsoluteTime latestdate
latest date
Definition: thiesdl1file.h:102
bool Mfoundunexpecteddatatime
found unexpected data time
Definition: thiesdl1file.h:185
FileHeader Mheader
file header
Definition: thiesdl1file.h:181
::sff::FREE Mtracefree
comment header lines
Definition: thiesdl1file.h:191
libtime::TAbsoluteTime earliestdate
earliest date
Definition: thiesdl1file.h:100
Here is the call graph for this function:
Here is the caller graph for this function: