168 TraceHeader traceheader;
169 traceheader.hastracefree =
false;
170 traceheader.hasinfo =
false;
171 traceheader.haswid2 =
false;
177 if (line ==
"contents of SFF WID2 line:")
179 traceheader.haswid2 =
true;
182 std::cout <<
"SFF WID2 line detected." << std::endl;
186 std::istringstream iss(line);
188 int doy, day, month, year, hour, minute, secs, micsecs;
190 iss >> day >> c >> month >> c >> year;
191 iss >> hour >> c >> minute >> c >> secs >> c >> micsecs;
192 traceheader.wid2.date = libtime::TAbsoluteTime(year,
201 "ERROR: inconsistent date values");
204 traceheader.wid2.station = line;
207 traceheader.wid2.channel = line;
210 traceheader.wid2.auxid = line;
213 traceheader.wid2.instype = line;
216 traceheader.wid2.nsamples = std::atoi(line.c_str());
219 traceheader.wid2.dt = std::atof(line.c_str());
222 traceheader.wid2.calib = std::atof(line.c_str());
225 traceheader.wid2.calper = std::atof(line.c_str());
228 traceheader.wid2.hang = std::atof(line.c_str());
231 traceheader.wid2.vang = std::atof(line.c_str());
234 if (line ==
"contents of SFF INFO line:")
236 traceheader.hasinfo =
true;
239 std::cout <<
"SFF INFO line detected." << std::endl;
243 if (line ==
"cartesian")
245 traceheader.info.cs = sff::CS_cartesian;
249 traceheader.info.cs = sff::CS_spherical;
253 traceheader.info.cx = std::atof(line.c_str());
256 traceheader.info.cy = std::atof(line.c_str());
259 traceheader.info.cz = std::atof(line.c_str());
262 traceheader.info.nstacks = std::atoi(line.c_str());
265 if (line ==
"contents of SFF FREE block:")
267 traceheader.hastracefree =
true;
270 std::cout <<
"trace FREE block detected." << std::endl;
272 while (getline(is, line))
275 if (line.empty()) {
break; }
276 traceheader.tracefree.append(line);
280 if (line ==
"data:") {
break; }
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
void extract(std::string &line)
splits a given string after the colon
void extractvalue(std::string &line, bool unit)
split given string