SFF++ library: reading and writing SFF from C++
sffxx.cc
Go to the documentation of this file.
1 
95 #define TF_SFFXX_CC_VERSION \
96  "TF_SFFXX_CC V1.19"
97 
98 #include<sstream>
99 #include <sffxx.h>
100 #include <gsexx.h>
101 #include <cstdio>
102 #include <cmath>
103 #include <stdlib.h>
104 
105 namespace sff {
106 
107  namespace helper {
109  template<class C>
110  bool IDmatch(const std::string& line, const bool& debug=false)
111  {
112  if (debug)
113  {
114  std::cerr << "DEBUG: IDmatch: "
115  << line.substr(0,4) << "=?=" << std::string(C::LINEID)
116  << std::endl;
117  }
118  return(line.substr(0,4)==std::string(C::LINEID));
119  }
120  } // namespace helper
121 
123 
130  const double STAT::libversion=2.00;
136  const double STAT::decode_libversion=1.09;
137  const char* const STAT::LINEID="STAT";
138  const char* const FREE::LINEID="FREE";
139  const char* const SRCE::LINEID="SRCE";
140  const char* const DAST::LINEID="DAST";
141  const char* const INFO::LINEID="INFO";
142 
143  /*----------------------------------------------------------------------*/
144 
145  char coosysID(const Ecoosys& csid)
146  {
147  char retval;
148  if (csid == CS_cartesian) retval='C';
149  else if (csid == CS_spherical) retval='S';
150  else throw
151  GSE2::Terror("ERROR (sff::coosysID): library inconsistency!");
152  return(retval);
153  } // coosysID
154 
155  Ecoosys coosysID(const char& csid)
156  {
157  Ecoosys retval;
158  if (csid=='C') { retval=CS_cartesian; }
159  else if (csid=='S') { retval=CS_spherical; }
160  else throw
161  GSE2::Terror("ERROR (sff::coosysID): unknown coordinate system key!");
162  return(retval);
163  } // coosysID
164 
165 /*======================================================================*/
166 // SFF structs
167 // -----------
168 //
169 // STAT
170 // ----
171 
198  STAT::STAT(): hasfree(false), hassrce(false)
199  { setstamp(libtime::now()); }
200 
201  /*----------------------------------------------------------------------*/
202 
203  void STAT::setstamp(const libtime::TAbsoluteTime& date) const
204  {
205  char stamp[14];
206  int yeardigits, century;
207  century=int(date.year()/100);
208  yeardigits=date.year()-100*century;
209  sprintf(stamp, "%2.2d%2.2d%2.2d.%2.2d%2.2d%2.2d",
210  static_cast<int>(yeardigits), static_cast<int>(date.month()),
211  static_cast<int>(date.day()), static_cast<int>(date.hour()),
212  static_cast<int>(date.minute()), static_cast<int>(date.second()));
213  timestamp=std::string(stamp);
214  } // void STAT::setstamp(const libtime::TAbsoluteTime& date) const
215 
216  /*----------------------------------------------------------------------*/
217 
218  std::string STAT::line() const
219  {
220  this->setstamp(libtime::now());
221  char charline[40];
222  std::string code("");
223  if (this->hasfree) { code.append("F"); }
224  if (this->hassrce) { code.append("S"); }
225  sprintf(charline, "%-4s %6.2f %-13s %-10s\n",
226  STAT::LINEID,
228  timestamp.substr(0,13).c_str(),
229  code.substr(0,10).c_str());
230  std::string retval(charline);
231  return(retval);
232  } // std::string STAT::line() const
233 
234  /*----------------------------------------------------------------------*/
235 
236  void STAT::read(std::istream& fis, const bool& debug)
237  {
238  if (debug) { std::cerr << "DEBUG (STAT::read):" << std::endl; }
239  // read complete line
240  std::string theline;
241  std::getline(fis, theline);
242 
243  if (debug) { std::cerr << theline << std::endl; }
244  std::string lineID=theline.substr(0,4);
245  if (debug) { std::cerr << lineID << std::endl; }
246  if (!helper::IDmatch<STAT>(lineID)) throw
247  GSE2::Terror("ERROR (STAT::read): missing STAT ID!");
248 
249  double inlibversion=atof(theline.substr(5,7).c_str());
250  if (inlibversion>STAT::libversion)
251  {
252  std::cerr << "ERROR (STAT::read): "
253  << "data file has format version "
254  << inlibversion << std::endl;
255  std::cerr << "ERROR (STAT::read): "
256  << "library can decode formats up to version "
257  << STAT::libversion << std::endl;
258  throw
259  GSE2::Terror("ERROR (STAT::read): file library version too large!");
260  }
261  if (inlibversion<STAT::decode_libversion)
262  {
263 // std::cerr << "theline " << theline << std::endl;
264 // std::cerr << "theline.lv " << theline.substr(5,6) << std::endl;
265 // std::cerr << "inlibversion " << inlibversion << std::endl;
266 // std::cerr << "decode_libversion " << decode_libversion << std::endl;
267  std::cerr << "ERROR (STAT::read): "
268  << "data file has format version "
269  << inlibversion << std::endl;
270  std::cerr << "ERROR (STAT::read): "
271  << "library can decode formats from version "
273  << " up to version "
274  << STAT::libversion << std::endl;
275  throw
276  GSE2::Terror("ERROR (STAT::read): incompatible SFF version!");
277  }
278 
279  this->timestamp=theline.substr(13,13);
280 
281  std::string code=theline.substr(27,10);
282 // std::cerr << "code " << code << std::endl;
283  this->hasfree=(code.find('F')!=std::string::npos);
284  this->hassrce=(code.find('S')!=std::string::npos);
285  if (debug)
286  {
287  if (this->hasfree)
288  { std::cerr << "DEBUG (STAT::read): has FREE block" << std::endl; }
289  if (this->hassrce)
290  { std::cerr << "DEBUG (STAT::read): has SRCE line" << std::endl; }
291  std::cerr << "DEBUG (STAT::read): finished" << std::endl;
292  }
293  } // void STAT::read(std::istream& fis, const bool& debug)
294 
295 /*----------------------------------------------------------------------*/
296 // SRCE
297 // ----
298 
352  type("NSP"), date(libtime::now()),
353  cs(CS_cartesian), cx(0.), cy(0.), cz(0.) { }
354 
355  /*----------------------------------------------------------------------*/
356 
357  std::string SRCE::line() const
358  {
359  char charline[95];
360  int yeardigits, century;
361  century=int(date.year()/100);
362  yeardigits=date.year()-100*century;
363  sprintf(charline, "%-4s %-20s %1c %15.6f%15.6f%15.6f "
364  "%2.2i%2.2i%2.2i %2.2i%2.2i%2.2i.%3.3i\n",
365  SRCE::LINEID,
366  type.substr(0,20).c_str(),
367  coosysID(cs), cx, cy, cz,
368  yeardigits, static_cast<int>(date.month()), static_cast<int>(date.day()),
369  static_cast<int>(date.hour()), static_cast<int>(date.minute()),
370  static_cast<int>(date.second()), static_cast<int>(date.milsec()));
371  std::string retval(charline);
372  return(retval);
373  } // std::string SRCE::line() const
374 
375  /*----------------------------------------------------------------------*/
376 
377  void SRCE::read(std::istream& fis, const bool& debug)
378  {
379  std::string theline;
380  std::getline(fis, theline);
381 
382  std::string lineID=theline.substr(0,4);
383  if (!helper::IDmatch<SRCE>(lineID)) throw
384  GSE2::Terror("ERROR (SRCE::read): missing SRCE ID!");
385 
386  this->type=theline.substr(5,20);
387  if (debug)
388  { std::cerr << "DEBUG (SRCE::read): type: " << type << std::endl; }
389 
390  this->cs=coosysID(*theline.substr(26,1).c_str());
391  this->cx=atof(theline.substr(28,15).c_str());
392  this->cy=atof(theline.substr(43,15).c_str());
393  this->cz=atof(theline.substr(58,15).c_str());
394  if (debug)
395  {
396  std::cerr << "DEBUG (SRCE::read): cs,cx,cy,cz: "
397  << coosysID(cs) << "," << cx << "," << cy << "," << cz << std::endl;
398  }
399 
400  std::string datestring,timestring;
401  datestring=theline.substr(74,6);
402  timestring=theline.substr(81,10);
403  if (debug)
404  {
405  std::cerr << "DEBUG (SRCE::read): datestring: "
406  << datestring << std::endl;
407  std::cerr << "DEBUG (SRCE::read): timestring: "
408  << timestring << std::endl;
409  }
410  std::string fulldate("");
411  fulldate+=datestring.substr(0,2);
412  fulldate+="/";
413  fulldate+=datestring.substr(2,2);
414  fulldate+="/";
415  fulldate+=datestring.substr(4,2);
416  fulldate+=" ";
417  fulldate+=timestring.substr(0,2);
418  fulldate+=":";
419  fulldate+=timestring.substr(2,2);
420  fulldate+=":";
421  fulldate+=timestring.substr(4,6);
422  if (debug)
423  {
424  std::cerr << "DEBUG (SRCE::read): convert string: "
425  << fulldate << std::endl;
426  }
427  this->date=libtime::TAbsoluteTime(fulldate);
428  if (debug)
429  {
430  std::cerr << "DEBUG (SRCE::read): time: "
431  << date.timestring() << std::endl;
432  }
433  } // void SRCE::read(std::istream& fis, const bool& debug)
434 
435 /*----------------------------------------------------------------------*/
436 // DAST
437 // ----
438 
488  nchar(-1), ampfac(1.), hasfree(false),
489  hasinfo(false), last(false) { }
490 
491  /*----------------------------------------------------------------------*/
492 
493  std::string DAST::line() const
494  {
495  char charline[50];
496  std::string code("");
497  if (this->hasfree) { code.append("F"); }
498  if (this->hasinfo) { code.append("I"); }
499  if (!this->last) { code.append("D"); }
500  // write -1 to nchar field in any case
501  sprintf(charline, "%-4s %10i %16.6E %-10s\n",
502  DAST::LINEID,
503  -1, ampfac, code.substr(0,10).c_str());
504  std::string retval(charline);
505  return(retval);
506  } // std::string DAST::line() const
507 
508  /*----------------------------------------------------------------------*/
509 
510  void DAST::read(std::istream& fis, const bool& debug)
511  {
512  if (debug)
513  {
514  std::cerr << "DEBUG (DAST::read):" << std::endl;
515  }
516  std::string theline;
517  std::getline(fis, theline);
518  if (debug) { std::cerr << theline << std::endl; }
519 
520  std::string lineID=theline.substr(0,4);
521  if (debug) { std::cerr << lineID << std::endl; }
522  if (!helper::IDmatch<DAST>(lineID)) throw
523  GSE2::Terror("ERROR (DAST::read): missing DAST ID!");
524 
525  this->nchar=atoi(theline.substr(6,10).c_str());
526  this->ampfac=atof(theline.substr(17,16).c_str());
527 
528  std::string code=theline.substr(34,10);
529  if (debug)
530  {
531  std::cerr << "DEBUG (DAST): read nchar=" << nchar
532  << " ampfac=" << ampfac << " code=" << code << std::endl;
533  }
534  this->hasinfo=(code.find('I')!=std::string::npos);
535  this->hasfree=(code.find('F')!=std::string::npos);
536  this->last=(code.find('D')==std::string::npos);
537  } // DAST::read(std::istream& fis, const bool& debug)
538 
539 /*----------------------------------------------------------------------*/
540 // FREE
541 // ----
542 
561  FREE::FREE() { lines.clear(); }
562 
563  /*----------------------------------------------------------------------*/
564 
565  void FREE::write(std::ostream& os) const
566  {
567  os << FREE::LINEID << " " << std::endl;
568  for(Tlines::const_iterator I=lines.begin();
569  I != lines.end(); I++)
570  { os << *I << std::endl; }
571  os << FREE::LINEID << " " << std::endl;
572  } // void FREE::write(std::ostream& os) const
573 
574  /*----------------------------------------------------------------------*/
575 
576  void FREE::read(std::istream& is, const bool& debug)
577  {
578  std::string lineID;
579  // getline(is,lineID);
580  is >> lineID;
581  if (debug)
582  { std::cerr << "DEBUG (FREE): lineID=" << lineID << std::endl; }
583  if (!helper::IDmatch<FREE>(lineID.substr(0,4), debug)) throw
584  GSE2::Terror("ERROR (FREE::read): missing FREE ID!");
585  lines.clear();
586  is.ignore(10,'\n');
587  getline(is,lineID);
588  if (debug) { std::cerr << "FREE " << lineID << std::endl; }
589  if (debug) { std::cerr << "ID \"" << lineID.substr(0,4) << "\"" << std::endl; }
590  while (!helper::IDmatch<FREE>(lineID.substr(0,4), debug))
591  {
592  lines.push_back(lineID);
593  getline(is,lineID);
594  }
595  } // void FREE::read(std::istream& is, const bool& debug)
596 
597  /*----------------------------------------------------------------------*/
598 
599  void FREE::append(const Tlines& newlines)
600  {
601  Tlines::const_iterator I(newlines.begin());
602  while (I != newlines.end())
603  {
604  this->append(*I);
605  ++I;
606  }
607  } // void FREE::append(const Tlines& lines)
608 
609 /*----------------------------------------------------------------------*/
610 // WID2
611 // ----
612 
651  date(libtime::now()), station("NSP"), channel("NSP"), auxid("NSP"),
652  nsamples(-1), dt(-1.), calib(-1.), calper(-1.), instype("NSP"),
653  hang(-1.),vang(-1.) { }
654 
655  /*----------------------------------------------------------------------*/
656 
657  std::string WID2::line() const
658  {
659  GSE2::waveform::TWID2 wid2line;
660  // apply proper rounding to nearest millisecond
661  libtime::TAbsoluteTime rnddate(date.year(), date.month(),
662  date.day(), date.hour(),
663  date.minute(), date.second(),
664  date.milsec());
665  if (date.micsec()>499) { rnddate += libtime::TRelativeTime(0,0,0,0,1); }
666  wid2line.Fyear=rnddate.year();
667  wid2line.Fmonth=rnddate.month();
668  wid2line.Fday=rnddate.day();
669  wid2line.Fhour=rnddate.hour();
670  wid2line.Fminute=rnddate.minute();
671  wid2line.Fmilsec=rnddate.second()*1000+rnddate.milsec();
672  wid2line.Fstation=station;
673  wid2line.Fchannel=channel;
674  wid2line.Fauxid=auxid;
675  wid2line.Fsamps=nsamples;
676  wid2line.Fsamprate=1./dt;
677  wid2line.Fcalib=calib;
678  wid2line.Fcalper=calper;
679  wid2line.Finstype=instype;
680  wid2line.Fhang=hang;
681  wid2line.Fvang=vang;
682  return(wid2line.line());
683  } // std::string WID2::line() const
684 
685  /*----------------------------------------------------------------------*/
686 
687  void WID2::read(std::istream& is)
688  {
689  std::string line;
690  std::getline(is, line);
691  if (line.substr(0,4) == WIDXID)
692  {
693  *this = WIDXline(line);
694  }
695  else
696  {
697  std::istringstream iss(line);
698  GSE2::waveform::TWID2 wid2line;
699  wid2line.read(iss);
700  int second=int(wid2line.Fmilsec/1000);
701  int milsec=wid2line.Fmilsec-1000*second;
702  date=libtime::TAbsoluteTime(wid2line.Fyear,
703  wid2line.Fmonth,
704  wid2line.Fday,
705  wid2line.Fhour,
706  wid2line.Fminute,
707  second, milsec);
708  this->station=wid2line.Fstation;
709  this->channel=wid2line.Fchannel;
710  this->auxid=wid2line.Fauxid;
711  this->nsamples=wid2line.Fsamps;
712  this->dt=1./wid2line.Fsamprate;
713  this->calib=wid2line.Fcalib;
714  this->calper=wid2line.Fcalper;
715  this->instype=wid2line.Finstype;
716  this->hang=wid2line.Fhang;
717  this->vang=wid2line.Fvang;
718  }
719  } // void WID2::read(std::istream& is)
720 
721 /*----------------------------------------------------------------------*/
722 // INFO
723 // ----
724 
750  cs(CS_cartesian), cx(0.), cy(0.), cz(0.), nstacks(0) { }
751 
752  /*----------------------------------------------------------------------*/
753 
754  std::string INFO::line() const
755  {
756  char charline[60];
757  sprintf(charline, "%-4s %1c %15.6f%15.6f%15.6f %4i\n",
758  INFO::LINEID,
759  coosysID(cs), cx, cy, cz, nstacks);
760  std::string retval(charline);
761  return(retval);
762  } // std::string INFO::line() const
763 
764  /*----------------------------------------------------------------------*/
765 
766  void INFO::read(std::istream& fis)
767  {
768  std::string theline;
769  std::getline(fis, theline);
770 
771  std::string lineID=theline.substr(0,4);
772  if (!helper::IDmatch<INFO>(lineID)) throw
773  GSE2::Terror("ERROR (INFO::read): missing INFO ID!");
774 
775  this->cs=coosysID(*theline.substr(5,1).c_str());
776  this->cx=atof(theline.substr(7,15).c_str());
777  this->cy=atof(theline.substr(22,15).c_str());
778  this->cz=atof(theline.substr(37,15).c_str());
779  this->nstacks=atoi(theline.substr(53,4).c_str());
780  } // void INFO::read(std::istream& fis)
781 
782  /*----------------------------------------------------------------------*/
783 
784  bool INFO::operator==(const INFO& info) const
785  {
786  return ((info.cs==this->cs) &&
787  (info.cx==this->cx) &&
788  (info.cy==this->cy) &&
789  (info.cz==this->cz) &&
790  (info.nstacks==this->nstacks));
791  } // bool INFO::operator==(const INFO& info) const
792 
793 /*----------------------------------------------------------------------*/
794 // FileHeader
795 // ----------
796 
806  void FileHeader::write(std::ostream& os) const
807  {
808  os << Mstat.line();
809  if (Mstat.hasfree) { Mfree.write(os); }
810  if (Mstat.hassrce) { os << Msrce.line(); }
811  }
812 
813  /*----------------------------------------------------------------------*/
814 
815  void FileHeader::read(std::istream& is, const bool& debug)
816  {
817  // reading the FREE block first matches the order of header elements as
818  // written by sff_WOpenFS in libstuff.f
819  Mstat.read(is, debug);
820  if (Mstat.hasfree)
821  {
822  Mfree.read(is, debug);
823  if (debug)
824  { std::cerr << "DEBUG (FileHeader::read): file FREE read" << std::endl; }
825  }
826  if (Mstat.hassrce)
827  {
828  Msrce.read(is, debug);
829  if (debug)
830  { std::cerr << "DEBUG (FileHeader::read): SRCE line read" << std::endl; }
831  }
832  if (debug)
833  { std::cerr << "DEBUG (FileHeader::read): finished" << std::endl; }
834  }
835 
836 /*----------------------------------------------------------------------*/
837 // TraceHeader
838 // -----------
839 
849  void TraceHeader::writeheader(std::ostream& os) const
850  {
851  if (Mdebug) { std::cerr << "DEBUG: write DAST line" << std::endl; }
852  os << Mdast.line();
853  if (Mdebug) { std::cerr << "DEBUG: write WID2 line" << std::endl; }
854  os << Mwid2.line();
855  }
856 
857  /*----------------------------------------------------------------------*/
858 
859  void TraceHeader::writetrailer(std::ostream& os) const
860  {
861  if (Mdast.hasfree)
862  {
863  if (Mdebug) { std::cerr << "DEBUG: write FREE block" << std::endl; }
864  Mfree.write(os);
865  }
866  if (Mdast.hasinfo)
867  {
868  if (Mdebug) { std::cerr << "DEBUG: write INFO line" << std::endl; }
869  os << Minfo.line();
870  }
871  }
872 
873  /*----------------------------------------------------------------------*/
874 
875  void TraceHeader::readheader(std::istream& is)
876  {
877  if (Mdebug) { std::cerr << "DEBUG: read DAST line" << std::endl; }
878  Mdast.read(is,Mdebug);
879  if (Mdebug) { std::cerr << "DEBUG: read WID2 line" << std::endl; }
880  Mwid2.read(is);
881  }
882 
883  /*----------------------------------------------------------------------*/
884 
885  void TraceHeader::readtrailer(std::istream& is)
886  {
887  if (Mdebug) { std::cerr << "DEBUG: read trace trailer" << std::endl; }
888  if (Mdast.hasfree)
889  {
890  if (Mdebug) { std::cerr << "DEBUG: read FREE block" << std::endl; }
891  Mfree.read(is, Mdebug);
892  if (Mdebug) { Mfree.write(std::cerr); }
893  }
894  if (Mdast.hasinfo)
895  {
896  if (Mdebug) { std::cerr << "DEBUG: read INFO line" << std::endl; }
897  Minfo.read(is);
898  }
899  }
900 
901 /*----------------------------------------------------------------------*/
902 // WaveformNormalizer
903 // ------------------
904 
913  const int WaveformNormalizer::limit=0x1ffffff;
914 
916  const double& maxval):
917  Mmaxval(maxval), Mnorm(nm)
918  {
919  if (Mnorm == NM_one)
920  {
921  Mampfac=1.;
922  Mscale=false;
923  if (Mmaxval > double(WaveformNormalizer::limit)) throw
924  GSE2::Terror("ERROR (sff::WaveformNormalizer::scan): "
925  "dynamic range to large for non-normalizing mode");
926  }
927  else if (Mnorm == NM_ifneeded)
928  {
929  Mampfac=1.;
930  Mscale=false;
931  if (Mmaxval > double(WaveformNormalizer::limit))
932  {
934  Mscale=true;
935  }
936  }
937  else if (Mnorm == NM_maxdyn)
938  {
940  Mscale=true;
941  }
942  else throw
943  GSE2::Terror("ERROR (sff::WaveformNormalizer::scan): "
944  "library inconsistency!");
945  }
946 
947 /*----------------------------------------------------------------------*/
948 // SkipWaveform
949 // ------------
950 
951  void SkipWaveform::read(std::istream& is)
952  {
953  Mheader.readheader(is);;
954  int nsamples=Mheader.wid2().nsamples;
955  GSE2::waveform::TDAT2readCM6 freader(nsamples);
956  int idata;
957  for (int i=0; i<nsamples; i++)
958  { idata=freader(is); }
959  Mheader.readtrailer(is);
960  Mvalid=true;
961  } // SkipWaveform::read
962 
963 } // namespace sff
964 
965 /* ----- END OF sffxx.cc ----- */
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:236
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
std::string timestamp
Definition: sffxx.h:148
std::string line() const
Definition: sffxx.cc:493
SRCE()
Definition: sffxx.cc:351
all SFF modules
Definition: offset.cc:42
WID2()
Definition: sffxx.cc:650
std::string auxid
Auxiliary identification code.
Definition: sffxx.h:218
void write(std::ostream &os) const
Definition: sffxx.cc:565
std::string line() const
Definition: sffxx.cc:357
do not scale
Definition: sffxx.h:115
Tlines lines
Definition: sffxx.h:163
bool IDmatch(const std::string &line, const bool &debug=false)
Check GSE identifier at beginning of line.
Definition: sffxx.cc:110
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:510
void read(std::istream &is)
Definition: sffxx.cc:687
double calper
calibration reference period
Definition: sffxx.h:222
FREE()
Definition: sffxx.cc:561
std::string line() const
Definition: sffxx.cc:754
double cz
Definition: sffxx.h:176
void write(std::ostream &) const
Definition: sffxx.cc:806
bool last
Definition: sffxx.h:190
STAT()
Definition: sffxx.cc:198
std::string line() const
Definition: sffxx.cc:657
void read(std::istream &is, const bool &debug=false)
Definition: sffxx.cc:576
double cy
Definition: sffxx.h:202
std::string station
Station code.
Definition: sffxx.h:216
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
int nsamples
number of samples
Definition: sffxx.h:219
libtime::TAbsoluteTime date
time of first sample
Definition: sffxx.h:215
Enormmode
Definition: sffxx.h:114
static const char *const LINEID
Definition: sffxx.h:167
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::string type
Definition: sffxx.h:173
STAT Mstat
Definition: sffxx.h:261
Ecoosys
valid coordinate systems
Definition: sffxx.h:104
double cz
Definition: sffxx.h:202
double calib
calibration factor
Definition: sffxx.h:221
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
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
static const double decode_libversion
Definition: sffxx.h:140
double vang
veritcal orientation
Definition: sffxx.h:225
std::list< std::string > Tlines
Definition: sffxx.h:154
static const char *const LINEID
Definition: sffxx.h:180
const WID2 & wid2() const
Definition: sffxx.h:305
void writetrailer(std::ostream &) const
Definition: sffxx.cc:859
double ampfac
Definition: sffxx.h:187
void append(const std::string &line)
Definition: sffxx.h:160
static const char *const LINEID
Definition: sffxx.h:194
INFO()
Definition: sffxx.cc:749
double cx
Definition: sffxx.h:176
static const char *const LINEID
Definition: sffxx.h:141
void read(std::istream &is)
Definition: sffxx.cc:766
double cy
Definition: sffxx.h:176
static const double libversion
Fortran library version (to ensure compatibility)
Definition: sffxx.h:139
bool operator==(const INFO &info) const
Definition: sffxx.cc:784
void readtrailer(std::istream &)
Definition: sffxx.cc:885
int nchar
Definition: sffxx.h:186
bool hasinfo
Definition: sffxx.h:189
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 Mheader
Definition: sffxx.h:375
double dt
sampling interval (sec)
Definition: sffxx.h:220
scale for maximum dynamic range
Definition: sffxx.h:116
std::string line() const
Definition: sffxx.cc:218
bool hassrce
Definition: sffxx.h:150
bool hasfree
Definition: sffxx.h:188
double hang
horizontal orientation
Definition: sffxx.h:224
static const char *const LINEID
Definition: sffxx.h:155
SFF library (prototypes)
void readheader(std::istream &)
Definition: sffxx.cc:875
void read(std::istream &is)
Definition: sffxx.cc:951