SFF++ library: reading and writing SFF from C++
wid2compare.cc
Go to the documentation of this file.
1 
34 #define TF_WID2COMPARE_CC_VERSION \
35  "TF_WID2COMPARE_CC V1.0 "
36 
37 #include <cmath>
38 #include <sffxx.h>
39 
40 namespace sff {
41 
42  bool WID2compare::operator()(const WID2& hd1, const WID2& hd2) const
43  {
44  bool retval=true;
45  if (Mflags & Fdate) {
46  libtime::TRelativeTime diff=hd2.date-hd1.date;
47  retval=retval && (libtime::time2double(diff)
48  <= ((hd1.dt+hd2.dt)*0.5*Mdatetolerance));
49  }
50  if (Mflags & Fstation) { retval=retval && (hd1.station==hd2.station); }
51  if (Mflags & Fchannel) { retval=retval && (hd1.channel==hd2.channel); }
52  if (Mflags & Fauxid) { retval=retval && (hd1.auxid==hd2.auxid); }
53  if (Mflags & Fnsamples) { retval=retval && (hd1.nsamples==hd2.nsamples); }
54  if (Mflags & Fdt)
55  {
56  double diff=hd1.dt-hd2.dt;
57  diff = diff >= 0. ? diff : -diff;
58  retval=retval && (diff <= (hd1.dt*Mdttolerance));
59  }
60  if (Mflags & Fcalib) { retval=retval && (hd1.calib==hd2.calib); }
61  if (Mflags & Fcalper) { retval=retval && (hd1.calper==hd2.calper); }
62  if (Mflags & Finstype) { retval=retval && (hd1.instype==hd2.instype); }
63  if (Mflags & Fhang) { retval=retval && (hd1.hang==hd2.hang); }
64  if (Mflags & Fvang) { retval=retval && (hd1.vang==hd2.vang); }
65  return(retval);
66  }; // WID2compare::operator()
67 
68 } // namespace sff
69 
70 /* ----- END OF wid2compare.cc ----- */
compare numbers of samples
Definition: sffxx.h:508
all SFF modules
Definition: offset.cc:42
std::string auxid
Auxiliary identification code.
Definition: sffxx.h:218
double calper
calibration reference period
Definition: sffxx.h:222
compare dates of first sample
Definition: sffxx.h:500
std::string station
Station code.
Definition: sffxx.h:216
compare sampling intervals
Definition: sffxx.h:510
compare calper fields
Definition: sffxx.h:514
std::string instype
instrument type
Definition: sffxx.h:223
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
compare station IDs
Definition: sffxx.h:502
double calib
calibration factor
Definition: sffxx.h:221
double Mdatetolerance
relative to mean sampling interval
Definition: sffxx.h:547
compare vang fields
Definition: sffxx.h:520
Waveform Header.
Definition: sffxx.h:209
double vang
veritcal orientation
Definition: sffxx.h:225
compare calib fields
Definition: sffxx.h:512
double Mdttolerance
Definition: sffxx.h:546
bool operator()(const WID2 &hd1, const WID2 &hd2) const
Definition: wid2compare.cc:42
compare channel IDs
Definition: sffxx.h:504
double dt
sampling interval (sec)
Definition: sffxx.h:220
compare hang fields
Definition: sffxx.h:518
compare auxilliary IDs
Definition: sffxx.h:506
double hang
horizontal orientation
Definition: sffxx.h:224
compare instrument type strings
Definition: sffxx.h:516
SFF library (prototypes)