SFF++ library: reading and writing SFF from C++
sffxx.h
Go to the documentation of this file.
1 
51 // include guard
52 #ifndef TF_SFFXX_H_VERSION
53 
54 #define TF_SFFXX_H_VERSION \
55  "TF_SFFXX_H V1.10"
56 
57 #include<string>
58 #include<cmath>
59 #include<list>
60 #include<iostream>
61 #include<sstream>
62 #include<libtime++.h>
63 #include<aff/iterator.h>
64 //#include<tfxx/commandline.h>
65 #include<gsexx.h>
66 
69 namespace sff {
70 
71 /*======================================================================*/
72 // basic error handling
73 // --------------------
74 
75  class Terror: public GSE2::Terror
76  {
77  public:
78  Terror(const std::string& message): GSE2::Terror(message) { }
79  }; // class Terror
80 
82 #define SFF_assert( C , M ) \
83  if (!(C)) { \
84  std::ostringstream os; \
85  os << "Condition " << #C << " at line #" << __LINE__ \
86  << " in " << __FILE__ << " is false: " << M; \
87  throw(Terror(os.str())); \
88  }
89 
91 #define SFF_abort( M ) \
92  { \
93  std::ostringstream os; \
94  os << "ABORT at line #" << __LINE__ \
95  << " in " << __FILE__ << " because of " << M; \
96  throw(Terror(os.str())); \
97  }
98 
99 /*======================================================================*/
100 // enum
101 // ----
102 
104  enum Ecoosys {
107  }; // enum Ecoosys
108 
109  char coosysID(const Ecoosys& csid);
110  Ecoosys coosysID(const char& csid);
111 
112 /*----------------------------------------------------------------------*/
113 
114  enum Enormmode {
118  }; // enum Enormmode
119 
120 /*======================================================================*/
121 // constants
122 // ---------
123 
132  const char *const WIDXID = "WIDX";
133 
134 /*======================================================================*/
135 // SFF structs
136 // -----------
137 
138  struct STAT {
139  static const double libversion;
140  static const double decode_libversion;
141  static const char* const LINEID;
142  STAT();
143  STAT(std::istream& is, const bool& debug=false) { read(is, debug); }
144  std::string line() const;
145  void read(std::istream& is, const bool& debug=false);
146  void setstamp(const libtime::TAbsoluteTime& date) const;
147  public:
148  mutable std::string timestamp;
149  bool hasfree;
150  bool hassrce;
151  }; // struct STAT
152 
153  struct FREE {
154  typedef std::list<std::string> Tlines;
155  static const char* const LINEID;
156  FREE();
157  FREE(std::istream& is) { read(is); }
158  void write(std::ostream& os) const;
159  void read(std::istream& is, const bool& debug=false);
160  void append(const std::string& line) { lines.push_back(line); }
161  void append(const Tlines& newlines);
162  void append(const FREE& free) { this->append(free.lines); }
164  }; // struct FREE
165 
166  struct SRCE {
167  static const char* const LINEID;
168  SRCE();
169  SRCE(std::istream& is) { read(is); }
170  std::string line() const;
171  void read(std::istream& is, const bool& debug=false);
172  public:
173  std::string type;
174  libtime::TAbsoluteTime date;
176  double cx, cy, cz;
177  }; // struct SRCE
178 
179  struct DAST {
180  static const char* const LINEID;
181  DAST();
182  DAST(std::istream& is) { read(is); }
183  std::string line() const;
184  void read(std::istream& is, const bool& debug=false);
185  public:
186  int nchar;
187  double ampfac;
188  bool hasfree;
189  bool hasinfo;
190  bool last;
191  }; // struct DAST
192 
193  struct INFO {
194  static const char* const LINEID;
195  INFO();
196  INFO(std::istream& is) { read(is); }
197  std::string line() const;
198  void read(std::istream& is);
199  bool operator==(const INFO& info) const;
200  public:
202  double cx, cy, cz;
203  int nstacks;
204  }; // struct INFO
205 
209  struct WID2 {
210  WID2();
211  WID2(std::istream& is) { read(is); }
212  std::string line() const;
213  void read(std::istream& is);
214  public:
215  libtime::TAbsoluteTime date;
216  std::string station;
217  std::string channel;
218  std::string auxid;
219  int nsamples;
220  double dt;
221  double calib;
222  double calper;
223  std::string instype;
224  double hang;
225  double vang;
226  }; // struct WID2
227 
228 /*======================================================================*/
229 // file I/O classes
230 // ----------------
231 
232  class FileHeader {
233  public:
235  { Mstat.hasfree=false; Mstat.hassrce=false; }
236  FileHeader(const FREE& free):
237  Mfree(free)
238  { Mstat.hasfree=true; Mstat.hassrce=false; }
239  FileHeader(const SRCE& srce):
240  Msrce(srce)
241  { Mstat.hasfree=false; Mstat.hassrce=true; }
242  FileHeader(const SRCE& srce, const FREE& free):
243  Mfree(free), Msrce(srce)
244  { Mstat.hasfree=true; Mstat.hassrce=true; }
245  FileHeader(std::istream& is, const bool& debug=false)
246  { read(is, debug); }
247  void write(std::ostream&) const;
248  void read(std::istream&, const bool& debug=false);
249  const STAT& stat() const { return(Mstat); }
250  const FREE& free() const { return(Mfree); }
251  const SRCE& srce() const { return(Msrce); }
252  const bool& hassrce() const { return(Mstat.hassrce); }
253  const bool& hasfree() const { return(Mstat.hasfree); }
254  void appendfree(const std::string& line)
255  { Mstat.hasfree=true; Mfree.lines.push_back(line); }
256  void setfree(const FREE& free)
257  { Mstat.hasfree=true; Mfree=free; }
258  void setsrce(const SRCE& srce)
259  { Mstat.hassrce=true; Msrce=srce; }
260  private:
264  }; // class FileHeader
265 
269  public:
270  static const int limit;
271  WaveformNormalizer(const Enormmode& nm, const double& maxval);
272  const double& maxval() const { return(Mmaxval); }
273  const double& ampfac() const { return(Mampfac); }
274  const bool& scale() const { return(Mscale); }
275  private:
276  double Mampfac;
277  double Mmaxval;
278  bool Mscale;
280  }; // class WaveformNormalizer
281 
282  class TraceHeader {
283  public:
284  TraceHeader(): Mdebug(false) { }
285  TraceHeader(const WID2& wid2, const bool& last=false):
286  Mwid2(wid2), Mdebug(false)
287  { Mdast.hasfree=false; Mdast.hasinfo=false; Mdast.last=last; }
288  TraceHeader(const WID2& wid2, const FREE& free, const bool& last=false):
289  Mwid2(wid2), Mfree(free), Mdebug(false)
290  { Mdast.hasfree=true; Mdast.hasinfo=false; Mdast.last=last; }
291  TraceHeader(const WID2& wid2, const INFO& info, const bool& last=false):
292  Mwid2(wid2), Minfo(info), Mdebug(false)
293  { Mdast.hasfree=false; Mdast.hasinfo=true; Mdast.last=last; }
294  TraceHeader(const WID2& wid2, const INFO& info,
295  const FREE& free, const bool& last=false):
296  Mwid2(wid2), Mfree(free), Minfo(info), Mdebug(false)
297  { Mdast.hasfree=true; Mdast.hasinfo=true; Mdast.last=last; }
298  void writeheader(std::ostream&) const;
299  void writetrailer(std::ostream&) const;
300  void readheader(std::istream&);
301  void readtrailer(std::istream&);
302  bool last() const { return(Mdast.last); }
303  template<class C> void scanseries(const C&,
304  const Enormmode& nm=NM_maxdyn);
305  const WID2& wid2() const { return(Mwid2); }
306  const DAST& dast() const { return(Mdast); }
307  const FREE& free() const { return(Mfree); }
308  const INFO& info() const { return(Minfo); }
309  const bool& scale() const { return(Mscale); }
310  const bool& hasinfo() const { return(Mdast.hasinfo); }
311  const bool& hasfree() const { return(Mdast.hasfree); }
312  void setlast(const bool& flag) { Mdast.last=flag; }
313  void setdebug(const bool& flag) { Mdebug=flag; }
314  void setwid2(const WID2& wid2line) { Mwid2=wid2line; }
315  void setnsamples(const long int& n) { Mwid2.nsamples=n; }
316  void setinfo(const INFO& infoline)
317  { Mdast.hasinfo=true; Minfo=infoline; }
318  void setfree(const FREE& free)
319  { Mdast.hasfree=true; Mfree=free; }
320  void appendfree(const std::string& line)
321  { Mdast.hasfree=true; Mfree.lines.push_back(line); }
322  private:
327  bool Mscale;
328  bool Mdebug;
329  }; // class TraceHeader
330 
331  template<class C>
333  public:
334  typedef typename C::Tcoc Tcoc;
335  OutputWaveform(const Tcoc& c, const TraceHeader& th,
336  const Enormmode& nm=NM_maxdyn):
337  Mseries(c), Mheader(th)
338  { Mheader.scanseries(Mseries,nm); }
339  void write(std::ostream& os) const;
340  private:
343  }; // class Waveform
344 
345  template<class C>
347  public:
348  typedef C Tcontainer;
349  InputWaveform(const bool& debug=false):
350  Mvalid(false), Mdebug(debug) { }
351  InputWaveform(std::istream& is, const bool& debug=false):
352  Mdebug(debug) { this->read(is); }
353  void read(std::istream& is);
354  const bool& valid() const { return(Mvalid); }
355  Tcontainer series() const { return(Mseries); }
356  TraceHeader header() const { return(Mheader); }
357  const bool& last() const { return(Mheader.dast().last); }
358  private:
359  bool Mvalid;
362  bool Mdebug;
363  }; // class InputWaveform
364 
365  class SkipWaveform {
366  public:
367  SkipWaveform(): Mvalid(false) { }
368  SkipWaveform(std::istream& is) { this->read(is); }
369  void read(std::istream& is);
370  const bool& valid() const { return(Mvalid); }
371  TraceHeader header() const { return(Mheader); }
372  const bool& last() const { return(Mheader.dast().last); }
373  private:
374  bool Mvalid;
376  }; // class SkipWaveform
377 
378 /*======================================================================*/
379 // I/O operators
380 // -------------
381 
382  inline std::istream& operator >> (std::istream& is, FileHeader& fh)
383  { fh.read(is); return(is); }
384  template<class C>
385  inline std::istream& operator >> (std::istream& is, InputWaveform<C>& wf)
386  { wf.read(is); return(is); }
387  inline std::istream& operator >> (std::istream& is, SkipWaveform& swf)
388  { swf.read(is); return(is); }
389  inline std::ostream& operator << (std::ostream& os, const FileHeader& fh)
390  { fh.write(os); return(os); }
391  inline std::ostream& operator << (std::ostream& os, const TraceHeader& th)
392  {
393  th.writeheader(os);
394  os << "DATA!" << std::endl;
395  th.writetrailer(os);
396  return(os);
397  }
398  template<class C>
399  inline std::ostream& operator << (std::ostream& os, const
400  OutputWaveform<C>& wf)
401  { wf.write(os); return(os); }
402 
403 /*======================================================================*/
404 // WaveformNormalizer template functions
405 // -------------------------------------
406 
407  template<class C>
408  inline
409  void TraceHeader::scanseries(const C& c,
410  const Enormmode& nm)
411  {
412  Mwid2.nsamples=0;
413  double maxval=0.;
414  double absval, value;
415  double null(0);
416  for(aff::Browser<C> i(c); i.valid(); ++i)
417  {
418  Mwid2.nsamples++;
419  value= *i;
420  absval= (value < null) ? -value : value;
421  maxval= (maxval < absval) ? absval : maxval;
422  }
423  double dmaxval=double((maxval==0) ? WaveformNormalizer::limit : maxval);
424  WaveformNormalizer normalizer(nm, dmaxval);
425  Mdast.ampfac=normalizer.ampfac();
426  Mscale=normalizer.scale();
427  } // TraceHeader::scanseries
428 
429 /*----------------------------------------------------------------------*/
430 // template OutputWaveform functions
431 // ---------------------------------
432 
433  template<class C>
434  inline
435  void OutputWaveform<C>::write(std::ostream& os) const
436  {
437  Mheader.setnsamples(Mseries.size());
438  Mheader.writeheader(os);;
439  GSE2::waveform::TDAT2writeCM6 fwriter(Mheader.wid2().nsamples);
440  int idata;
441  typename C::Tvalue data;
442  for(aff::Browser<Tcoc> i(Mseries); i.valid(); ++i)
443  {
444  data= *i;
445  if (Mheader.scale())
446  { idata=int(round(data/Mheader.dast().ampfac)); }
447  else
448  { idata=int(round(data)); }
449  os << fwriter(idata);
450  }
451  Mheader.writetrailer(os);
452  } // OutputWaveform::write
453 
454 /*----------------------------------------------------------------------*/
455 // template InputWaveform functions
456 // --------------------------------
457 
458  template<class C>
459  inline
460  void InputWaveform<C>::read(std::istream& is)
461  {
462  typedef typename C::Tvalue Tvalue;
463  if (Mdebug)
464  {
465  std::cerr << "DEBUG (InputWaveform<C>::read): " << std::endl
466  << " calling function readheader() of member Mheader."
467  << std::endl;
468  }
469  Mheader.setdebug(Mdebug);
470  Mheader.readheader(is);
471  int nsamples=Mheader.wid2().nsamples;
472  GSE2::waveform::TDAT2readCM6 freader(nsamples);
473  try {
474  Mseries=C(nsamples);
475  }
476  catch(...) {
477  std::cerr << "ERROR (InputWaveform::read): "
478  << "allocating series for " << nsamples << " samples!" << std::endl;
479  throw;
480  }
481  for(aff::Iterator<C> i(Mseries); i.valid(); ++i)
482  { (*i) = Tvalue(freader(is)*Mheader.dast().ampfac); }
483  Mheader.readtrailer(is);
484  Mvalid=true;
485  } // InputWaveform::read
486 
487 /*======================================================================*/
488 // some utilities
489 // --------------
490 
491 
492  /*----------------------------------------------------------------------*/
493  // compare WID2 headers
494  // --------------------
498  enum Ewid2field {
500  Fdate =1<<0,
502  Fstation =1<<1,
504  Fchannel =1<<2,
506  Fauxid =1<<3,
508  Fnsamples=1<<4,
510  Fdt =1<<5,
512  Fcalib =1<<6,
514  Fcalper =1<<7,
516  Finstype =1<<8,
518  Fhang =1<<9,
520  Fvang =1<<10
521  }; // enum Ewid2field
522 
526  class WID2compare {
527  public:
532  WID2compare(const int& flags=(Fstation | Fchannel | Fdt)):
533  Mflags(flags), Mdttolerance(0.), Mdatetolerance(0.) { }
534  void set(const int& flags) { Mflags=Mflags | flags; }
535  void clear(const int& flags) { Mflags=Mflags & (0xffffffff ^ flags); }
537  void setdttolerance(const double& tol) { Mdttolerance=tol; }
539  void setdatetolerance(const double& tol) { Mdatetolerance=tol; }
540  bool operator()(const WID2& hd1, const WID2& hd2) const;
541  int flags() const { return(Mflags); }
542  double dttolerance() const { return(Mdttolerance); }
543  double datetolerance() const { return(Mdatetolerance); }
544  private:
545  int Mflags;
546  double Mdttolerance;
547  double Mdatetolerance;
548  }; // class WID2compare
549 
550  /*======================================================================*/
551  // functions
552  // ---------
553 
555  libtime::TAbsoluteTime wid2lastsample(const WID2& wid2);
557  libtime::TAbsoluteTime wid2nextdate(const WID2& wid2);
559  long int wid2isample(const WID2& wid2,
560  const libtime::TAbsoluteTime& idate);
562  libtime::TAbsoluteTime wid2isample(const WID2& wid2,
563  const long int& i);
565  libtime::TRelativeTime wid2isamplerest(const WID2& wid2,
566  const libtime::TAbsoluteTime& idate);
567 
569  std::string srce_reference_ID();
572 
574  double offset(const SRCE& srce, const INFO& info,
575  const double& radius=6371.);
577  double sourcedistance(const SRCE& srce, const INFO& info);
579  double offsetdeg(const SRCE& srce, const INFO& info,
580  const double& radius=6371.);
581 
583  std::string WIDXline(const sff::WID2& wid2, const bool& debug=false);
584 
586  sff::WID2 WIDXline(const std::string& line);
587 
588  /*======================================================================*/
589  // verbose output
590  // --------------
591 
592  void verbose(std::ostream& os, const WID2& wid2);
593  void verbose(std::ostream& os, const SRCE& srce);
594  void verbose(std::ostream& os, const DAST& dast);
595  void verbose(std::ostream& os, const INFO& info);
596  void verbose(std::ostream& os, const FREE& free);
597  void verbose(std::ostream& os, const STAT& stat);
598  void verbose(std::ostream& os, const FileHeader& fh);
599  void verbose(std::ostream& os, const TraceHeader& th);
600 
601 } // namespace sff
602 
603 #endif // TF_SFFXX_H_VERSION (includeguard)
604 
605 /* ----- END OF sffxx.h ----- */
void append(const FREE &free)
Definition: sffxx.h:162
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:236
TraceHeader Mheader
Definition: sffxx.h:342
STAT(std::istream &is, const bool &debug=false)
Definition: sffxx.h:143
FileHeader(const SRCE &srce)
Definition: sffxx.h:239
static const int limit
the absolute maximum amplitude (one-sided) to which the time series will be normalized.
Definition: sffxx.h:270
char coosysID(const Ecoosys &csid)
Definition: sffxx.cc:145
void setfree(const FREE &free)
Definition: sffxx.h:256
FileHeader(const FREE &free)
Definition: sffxx.h:236
compare numbers of samples
Definition: sffxx.h:508
std::string timestamp
Definition: sffxx.h:148
SFF trace header elements.
Definition: sffxx.h:282
libtime::TAbsoluteTime wid2lastsample(const WID2 &wid2)
return time of last sample in waveform
std::string line() const
Definition: sffxx.cc:493
WID2compare(const int &flags=(Fstation|Fchannel|Fdt))
create compare object for comparison of selected fields
Definition: sffxx.h:532
SRCE()
Definition: sffxx.cc:351
TraceHeader(const WID2 &wid2, const bool &last=false)
Definition: sffxx.h:285
all SFF modules
Definition: offset.cc:42
WID2()
Definition: sffxx.cc:650
TraceHeader(const WID2 &wid2, const FREE &free, const bool &last=false)
Definition: sffxx.h:288
INFO(std::istream &is)
Definition: sffxx.h:196
std::string auxid
Auxiliary identification code.
Definition: sffxx.h:218
void write(std::ostream &os) const
Definition: sffxx.cc:565
const double & maxval() const
Definition: sffxx.h:272
DAST(std::istream &is)
Definition: sffxx.h:182
std::string line() const
Definition: sffxx.cc:357
do not scale
Definition: sffxx.h:115
Tlines lines
Definition: sffxx.h:163
TraceHeader Mheader
Definition: sffxx.h:361
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:510
TraceHeader(const WID2 &wid2, const INFO &info, const bool &last=false)
Definition: sffxx.h:291
TraceHeader header() const
Definition: sffxx.h:371
void read(std::istream &is)
Definition: sffxx.cc:687
double calper
calibration reference period
Definition: sffxx.h:222
compare dates of first sample
Definition: sffxx.h:500
FREE()
Definition: sffxx.cc:561
Ewid2field
bit values to select WID2 fields to be compared
Definition: sffxx.h:498
std::string line() const
Definition: sffxx.cc:754
double cz
Definition: sffxx.h:176
void read(std::istream &is)
Definition: sffxx.h:460
const double & ampfac() const
Definition: sffxx.h:273
void write(std::ostream &) const
Definition: sffxx.cc:806
const bool & hasfree() const
Definition: sffxx.h:311
bool last
Definition: sffxx.h:190
STAT()
Definition: sffxx.cc:198
void scanseries(const C &, const Enormmode &nm=NM_maxdyn)
Definition: sffxx.h:409
FileHeader(const SRCE &srce, const FREE &free)
Definition: sffxx.h:242
std::string line() const
Definition: sffxx.cc:657
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:576
const INFO & info() const
Definition: sffxx.h:308
double cy
Definition: sffxx.h:202
const bool & scale() const
Definition: sffxx.h:309
TraceHeader(const WID2 &wid2, const INFO &info, const FREE &free, const bool &last=false)
Definition: sffxx.h:294
const bool & hasfree() const
Definition: sffxx.h:253
SkipWaveform(std::istream &is)
Definition: sffxx.h:368
WID2(std::istream &is)
Definition: sffxx.h:211
Terror(const std::string &message)
Definition: sffxx.h:78
std::string station
Station code.
Definition: sffxx.h:216
compare sampling intervals
Definition: sffxx.h:510
compare calper fields
Definition: sffxx.h:514
const FREE & free() const
Definition: sffxx.h:250
const bool & last() const
Definition: sffxx.h:372
SRCE(std::istream &is)
Definition: sffxx.h:169
compares selected fields from two WID2 objects
Definition: sffxx.h:526
const STAT & stat() const
Definition: sffxx.h:249
void write(std::ostream &os) const
Definition: sffxx.h:435
std::string instype
instrument type
Definition: sffxx.h:223
double cx
Definition: sffxx.h:202
FREE Mfree
Definition: sffxx.h:262
DAST()
Definition: sffxx.cc:487
std::string channel
FDSN channel code.
Definition: sffxx.h:217
OutputWaveform(const Tcoc &c, const TraceHeader &th, const Enormmode &nm=NM_maxdyn)
Definition: sffxx.h:335
int nsamples
number of samples
Definition: sffxx.h:219
double offsetdeg(const SRCE &srce, const INFO &info, const double &radius)
return offset in degrees
Definition: offset.cc:103
InputWaveform(const bool &debug=false)
Definition: sffxx.h:349
void appendfree(const std::string &line)
Definition: sffxx.h:320
libtime::TAbsoluteTime date
time of first sample
Definition: sffxx.h:215
SFFostream< C > & operator<<(SFFostream< C > &os, const typename C::Tcoc &c)
FIRST(!) operator to be called for each trace.
Definition: sffostream.h:197
void appendfree(const std::string &line)
Definition: sffxx.h:254
Enormmode
Definition: sffxx.h:114
static const char *const LINEID
Definition: sffxx.h:167
void setinfo(const INFO &infoline)
Definition: sffxx.h:316
std::string WIDXline(const sff::WID2 &wid2, const bool &debug=false)
write WID2 information in extended format
Definition: widXio.cc:115
SRCE Msrce
Definition: sffxx.h:263
std::istream & operator>>(std::istream &is, FileHeader &fh)
Definition: sffxx.h:382
bool last() const
Definition: sffxx.h:302
void setlast(const bool &flag)
Definition: sffxx.h:312
void setdatetolerance(const double &tol)
tolerance when comparing date (as a fraction of the sampling interval)
Definition: sffxx.h:539
std::string type
Definition: sffxx.h:173
const bool & hasinfo() const
Definition: sffxx.h:310
STAT Mstat
Definition: sffxx.h:261
Tcontainer series() const
Definition: sffxx.h:355
Ecoosys
valid coordinate systems
Definition: sffxx.h:104
double cz
Definition: sffxx.h:202
compare station IDs
Definition: sffxx.h:502
void setdttolerance(const double &tol)
tolerance when comparing dt (as a fraction of the sampling interval)
Definition: sffxx.h:537
double calib
calibration factor
Definition: sffxx.h:221
double Mdatetolerance
relative to mean sampling interval
Definition: sffxx.h:547
const bool & valid() const
Definition: sffxx.h:370
void read(std::istream &, const bool &debug=false)
Definition: sffxx.cc:815
scale if largest amplitude larger than limit
Definition: sffxx.h:117
void setstamp(const libtime::TAbsoluteTime &date) const
Definition: sffxx.cc:203
sff::SRCE srce_reference()
return synthetic time reference from nothing
Definition: srcesynref.cc:51
long int wid2isample(const WID2 &wid2, const libtime::TAbsoluteTime &idate)
return index for sample at given date
Definition: wid2isample.cc:44
Ecoosys cs
Definition: sffxx.h:175
void writeheader(std::ostream &) const
Definition: sffxx.cc:849
const char *const WIDXID
ID for extended WID2 format.
Definition: sffxx.h:132
libtime::TAbsoluteTime date
time of source
Definition: sffxx.h:174
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:377
compare vang fields
Definition: sffxx.h:520
static const double decode_libversion
Definition: sffxx.h:140
Waveform Header.
Definition: sffxx.h:209
double vang
veritcal orientation
Definition: sffxx.h:225
void setnsamples(const long int &n)
Definition: sffxx.h:315
libtime::TAbsoluteTime wid2nextdate(const WID2 &wid2)
return time of next first sample for contiguous data
std::list< std::string > Tlines
Definition: sffxx.h:154
static const char *const LINEID
Definition: sffxx.h:180
compare calib fields
Definition: sffxx.h:512
const WID2 & wid2() const
Definition: sffxx.h:305
void writetrailer(std::ostream &) const
Definition: sffxx.cc:859
double ampfac
Definition: sffxx.h:187
FREE(std::istream &is)
Definition: sffxx.h:157
double offset(const SRCE &srce, const INFO &info, const double &radius)
return offset in meters
Definition: offset.cc:45
double Mdttolerance
Definition: sffxx.h:546
const bool & scale() const
Definition: sffxx.h:274
void append(const std::string &line)
Definition: sffxx.h:160
void setfree(const FREE &free)
Definition: sffxx.h:318
bool operator()(const WID2 &hd1, const WID2 &hd2) const
Definition: wid2compare.cc:42
static const char *const LINEID
Definition: sffxx.h:194
INFO()
Definition: sffxx.cc:749
class to normalize waveforms
Definition: sffxx.h:268
double cx
Definition: sffxx.h:176
static const char *const LINEID
Definition: sffxx.h:141
void read(std::istream &is)
Definition: sffxx.cc:766
InputWaveform(std::istream &is, const bool &debug=false)
Definition: sffxx.h:351
double cy
Definition: sffxx.h:176
double sourcedistance(const SRCE &srce, const INFO &info)
return spatial distance between source and receiver in meters
Definition: offset.cc:78
static const double libversion
Fortran library version (to ensure compatibility)
Definition: sffxx.h:139
bool operator==(const INFO &info) const
Definition: sffxx.cc:784
double datetolerance() const
Definition: sffxx.h:543
void setwid2(const WID2 &wid2line)
Definition: sffxx.h:314
void readtrailer(std::istream &)
Definition: sffxx.cc:885
Tcontainer Mseries
Definition: sffxx.h:360
int nchar
Definition: sffxx.h:186
bool hasinfo
Definition: sffxx.h:189
const FREE & free() const
Definition: sffxx.h:307
C::Tcoc Tcoc
Definition: sffxx.h:334
FileHeader(std::istream &is, const bool &debug=false)
Definition: sffxx.h:245
Ecoosys cs
Definition: sffxx.h:201
bool hasfree
Definition: sffxx.h:149
int nstacks
Definition: sffxx.h:203
WaveformNormalizer(const Enormmode &nm, const double &maxval)
Definition: sffxx.cc:915
TraceHeader header() const
Definition: sffxx.h:356
TraceHeader Mheader
Definition: sffxx.h:375
compare channel IDs
Definition: sffxx.h:504
double dt
sampling interval (sec)
Definition: sffxx.h:220
void clear(const int &flags)
Definition: sffxx.h:535
scale for maximum dynamic range
Definition: sffxx.h:116
const bool & hassrce() const
Definition: sffxx.h:252
std::string line() const
Definition: sffxx.cc:218
std::string srce_reference_ID()
return ID string for synthtic time reference
Definition: srcesynref.cc:42
compare hang fields
Definition: sffxx.h:518
compare auxilliary IDs
Definition: sffxx.h:506
bool hassrce
Definition: sffxx.h:150
const SRCE & srce() const
Definition: sffxx.h:251
bool hasfree
Definition: sffxx.h:188
void setdebug(const bool &flag)
Definition: sffxx.h:313
double hang
horizontal orientation
Definition: sffxx.h:224
const bool & valid() const
Definition: sffxx.h:354
double dttolerance() const
Definition: sffxx.h:542
int flags() const
Definition: sffxx.h:541
compare instrument type strings
Definition: sffxx.h:516
static const char *const LINEID
Definition: sffxx.h:155
SFF file header elements.
Definition: sffxx.h:232
void verbose(std::ostream &os, const WID2 &wid2)
Definition: sffverbose.cc:93
void readheader(std::istream &)
Definition: sffxx.cc:875
libtime::TRelativeTime wid2isamplerest(const WID2 &wid2, const libtime::TAbsoluteTime &idate)
return time interval between idate and sample sample next to idate
Definition: wid2isample.cc:63
void setsrce(const SRCE &srce)
Definition: sffxx.h:258
void read(std::istream &is)
Definition: sffxx.cc:951
const bool & last() const
Definition: sffxx.h:357
const DAST & dast() const
Definition: sffxx.h:306