GSE++ library: reading and writing GSE waveforms

◆ read()

void GSE2::waveform::TWID2::read ( std::istream &  is)

read a WID2 line from a stream

Definition at line 99 of file gsexx_TWID2.cc.

References Fauxid, Fcalib, Fcalper, Fchannel, Fday, Fhang, Fhour, Finstype, Fmilsec, Fminute, Fmonth, Fsamprate, Fsamps, Fstation, Fvang, Fyear, and setsubformat().

Referenced by GSE2::tests::test_dat2cm6().

100 {
101  std::string theline;
102  getline(is, theline);
103 
104  // check ID
105  std::string lineID=theline.substr(0,4);
106  if (!GSEIDmatch<TWID2>(lineID)) throw
107  Terror("ERROR (TWID2::read): missing WID2 ID!");
108 
109  Fyear =atoi(theline.substr( 5,4).c_str());
110  Fmonth =atoi(theline.substr(10,2).c_str());
111  Fday =atoi(theline.substr(13,2).c_str());
112  Fhour =atoi(theline.substr(16,2).c_str());
113  Fminute =atoi(theline.substr(19,2).c_str());
114  // Fseconds =atof(theline.substr(22,6).c_str());
115  int isec =atoi(theline.substr(22,2).c_str());
116  Fmilsec =atoi(theline.substr(25,3).c_str());
117  Fmilsec += (1000*isec);
118  /*
119  std::cerr << "TWID2 debug: "
120  << theline.substr(22,6) << " "
121  << this->seconds() << " "
122  << isec << " "
123  << Fmilsec
124  << std::endl;
125  */
126 
127  Fstation =theline.substr(29,5);
128  Fchannel =theline.substr(35,3);
129  Fauxid =theline.substr(39,4);
130 
131  this->setsubformat(theline.substr(44,3));
132 
133  Fsamps =atoi(theline.substr(48,8).c_str());
134 
135  Fsamprate=atof(theline.substr(57,11).c_str());
136  Fcalib =atof(theline.substr(69,10).c_str());
137  Fcalper =atof(theline.substr(80,7).c_str());
138  Finstype =theline.substr(88,6);
139  Fhang =atof(theline.substr(95,5).c_str());
140  Fvang =atof(theline.substr(101,4).c_str());
141 }
std::string Finstype
instrument type
Definition: gsexx.h:146
std::string Fchannel
FDSN channel code.
Definition: gsexx.h:139
double Fcalib
calibration factor
Definition: gsexx.h:144
double Fsamprate
sampling rate (Hz)
Definition: gsexx.h:143
int Fhour
hour of time
Definition: gsexx.h:135
int Fminute
minute of time
Definition: gsexx.h:136
void setsubformat(const std::string &key)
set subformat from key string
Definition: gsexx_TWID2.cc:66
int Fyear
year of date
Definition: gsexx.h:132
int Fmonth
month of date
Definition: gsexx.h:133
std::string Fauxid
Auxiliary identification code.
Definition: gsexx.h:140
int Fsamps
number of samples
Definition: gsexx.h:142
int Fday
day of date
Definition: gsexx.h:134
double Fhang
horizontal orientation
Definition: gsexx.h:147
std::string Fstation
Station code.
Definition: gsexx.h:138
double Fcalper
calibration reference period
Definition: gsexx.h:145
double Fvang
veritcal orientation This field is required to obtain millisecond precision
Definition: gsexx.h:148
Here is the call graph for this function:
Here is the caller graph for this function: