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

◆ readheader()

void datrw::isacstream::readheader ( )
private

Definition at line 102 of file isacstream.cc.

References datrw::sac::SACheader::b, datrw::sac::SACheader::cmpaz, datrw::sac::SACheader::cmpinc, DATRW_assert, DATRW_debug, datrw::sac::SACheader::delta, datrw::sac::SACheader::e, datrw::idatstream::free(), datrw::sac::SACheader::iftype, datrw::idatstream::info(), datrw::sac::SACheader::kcmpnm, datrw::sac::SACheader::khole, datrw::sac::SACheader::knetwk, datrw::sac::SACheader::kstnm, datrw::sac::SACheader::leven, datrw::idatstream::Mdebug, datrw::idatstream::Mis, datrw::idatstream::newtrace(), datrw::sac::SACheader::npts, datrw::sac::SACheader::nzhour, datrw::sac::SACheader::nzjday, datrw::sac::SACheader::nzmin, datrw::sac::SACheader::nzmsec, datrw::sac::SACheader::nzsec, datrw::sac::SACheader::nzyear, datrw::sac::read_sac_header(), datrw::idatstream::setinfo(), datrw::idatstream::setlast(), datrw::idatstream::settracefree(), datrw::idatstream::setwid2(), datrw::sac::SACheader::stdp, datrw::sac::SACheader::stel, datrw::sac::SACheader::stla, datrw::sac::SACheader::stlo, and datrw::idatstream::wid2().

Referenced by fseries(), and skipseries().

103  {
104  DATRW_debug(this->Mdebug, "isacstream::readheader()",
105  "start reading header");
106  this->newtrace();
107  sff::FREE free;
108  sff::WID2 wid2;
109  sff::INFO info;
110  std::ostringstream oss;
111  DATRW_debug(this->Mdebug, "isacstream::readheader()",
112  "calling datrw::sac::read_sac_header");
114  DATRW_debug(this->Mdebug, "isacstream::readheader()",
115  "returned from datrw::sac::read_sac_header");
116 
117  oss << "location: ";
118  if (hd.stla>0) { oss << hd.stla << "°N; "; }
119  else { oss << -hd.stla << "°S; "; }
120  if (hd.stlo>0) { oss << hd.stlo << "°E; "; }
121  else { oss << -hd.stlo << "°W"; }
122  free.append(oss.str());
123  DATRW_debug(this->Mdebug, "isacstream::readheader()", oss.str());
124  free.append("values from SAC binary header "
125  "that do not fit into SFF trace header");
126  wid2.dt=hd.delta;
127  oss.str("");
128  oss << "initial index: " << hd.b;
129  oss << "; final index: " << hd.e;
130  free.append(oss.str());
131  info.cs=sff::CS_spherical;
132  info.cx=hd.stla;
133  info.cy=hd.stlo;
134  info.cz=hd.stel;
135  oss.str("");
136  oss << hd.stdp;
137  free.append("station depth: " + oss.str() + " m");
138  wid2.hang=hd.cmpaz;
139  wid2.vang=hd.cmpinc;
140  wid2.date=libtime::TAbsoluteTime(hd.nzyear, 1, 1, hd.nzhour,
141  hd.nzmin, hd.nzsec, hd.nzmsec);
142  wid2.date.setdoy(hd.nzjday);
143  wid2.nsamples=hd.npts;
144  wid2.station=std::string(hd.kstnm,8);
145  wid2.channel=std::string(hd.kcmpnm,8);
146  wid2.auxid=std::string(hd.khole,8);
147  free.append("network name: " + std::string(hd.knetwk, 8));
148  DATRW_assert(hd.iftype==1, "unexpected file type");
149  DATRW_assert(hd.leven==1, "uneven sampling");
150  this->setwid2(wid2);
151  this->setinfo(info);
152  this->settracefree(free);
153  this->setlast();
154 
155  DATRW_debug(this->Mdebug, "isacstream::readheader()",
156  "finished; return from function");
157  }
int nzmsec
F zero time of file, msec.
Definition: sacread.h:192
#define DATRW_assert(C, M)
Check an assertion and report by throwing an exception.
Definition: error.h:92
int npts
RF number of samples.
Definition: sacread.h:196
float cmpaz
T component azimuth.
Definition: sacread.h:174
float b
RD initial value, ampl.
Definition: sacread.h:122
void setinfo(const sff::INFO &info)
Definition: datread.cc:121
float delta
RF time increment, sec.
Definition: sacread.h:117
sff::WID2 wid2() const
Definition: datread.h:111
SACheader read_sac_header(std::istream &is)
read SAC header from stream
Definition: sacread.cc:45
int nzyear
F zero time of file, yr.
Definition: sacread.h:187
char knetwk[8]
network name
Definition: sacread.h:247
float stel
T station elevation, m.
Definition: sacread.h:150
char kstnm[8]
F station name.
Definition: sacread.h:227
float stla
T station latititude.
Definition: sacread.h:148
float stlo
T station longitude.
Definition: sacread.h:149
int iftype
RA type of file.
Definition: sacread.h:202
std::istream & Mis
Definition: datread.h:126
char khole[8]
man-made event name
Definition: sacread.h:229
void setwid2(const sff::WID2 &wid2)
Definition: datread.cc:113
int nzsec
F zero time of file, sec.
Definition: sacread.h:191
sff::INFO info() const
Definition: datread.h:110
header structure for SAC binary data
Definition: sacread.h:114
sff::FREE free() const
Definition: datread.cc:79
int leven
RA data-evenly-spaced flag.
Definition: sacread.h:222
void settracefree(const sff::FREE &free)
Definition: datread.cc:105
char kcmpnm[8]
F component name.
Definition: sacread.h:246
int nzmin
F zero time of file, min.
Definition: sacread.h:190
#define DATRW_debug(C, N, M)
produce debug output
Definition: debug.h:50
int nzhour
F zero time of file, hr.
Definition: sacread.h:189
float cmpinc
T component inclination.
Definition: sacread.h:175
float stdp
T station depth, m.
Definition: sacread.h:151
float e
RD final value, amplitude.
Definition: sacread.h:123
int nzjday
F zero time of file, day.
Definition: sacread.h:188
Here is the call graph for this function:
Here is the caller graph for this function: