52 #ifndef TF_SFFXX_H_VERSION 54 #define TF_SFFXX_H_VERSION \ 63 #include<aff/iterator.h> 82 #define SFF_assert( C , M ) \ 84 std::ostringstream os; \ 85 os << "Condition " << #C << " at line #" << __LINE__ \ 86 << " in " << __FILE__ << " is false: " << M; \ 87 throw(Terror(os.str())); \ 91 #define SFF_abort( M ) \ 93 std::ostringstream os; \ 94 os << "ABORT at line #" << __LINE__ \ 95 << " in " << __FILE__ << " because of " << M; \ 96 throw(Terror(os.str())); \ 143 STAT(std::istream& is,
const bool& debug=
false) {
read(is, debug); }
144 std::string
line()
const;
145 void read(std::istream& is,
const bool& debug=
false);
146 void setstamp(
const libtime::TAbsoluteTime& date)
const;
158 void write(std::ostream& os)
const;
159 void read(std::istream& is,
const bool& debug=
false);
170 std::string
line()
const;
171 void read(std::istream& is,
const bool& debug=
false);
183 std::string
line()
const;
184 void read(std::istream& is,
const bool& debug=
false);
197 std::string
line()
const;
198 void read(std::istream& is);
212 std::string
line()
const;
213 void read(std::istream& is);
247 void write(std::ostream&)
const;
248 void read(std::istream&,
const bool& debug=
false);
339 void write(std::ostream& os)
const;
353 void read(std::istream& is);
369 void read(std::istream& is);
383 { fh.
read(is);
return(is); }
386 { wf.
read(is);
return(is); }
388 { swf.
read(is);
return(is); }
390 { fh.
write(os);
return(os); }
394 os <<
"DATA!" << std::endl;
401 { wf.
write(os);
return(os); }
414 double absval, value;
416 for(aff::Browser<C> i(c); i.valid(); ++i)
420 absval= (value < null) ? -value : value;
421 maxval= (maxval < absval) ? absval : maxval;
437 Mheader.setnsamples(Mseries.size());
438 Mheader.writeheader(os);;
439 GSE2::waveform::TDAT2writeCM6 fwriter(Mheader.wid2().nsamples);
441 typename C::Tvalue data;
442 for(aff::Browser<Tcoc> i(Mseries); i.valid(); ++i)
446 { idata=int(round(data/Mheader.dast().ampfac)); }
448 { idata=int(round(data)); }
449 os << fwriter(idata);
451 Mheader.writetrailer(os);
462 typedef typename C::Tvalue Tvalue;
465 std::cerr <<
"DEBUG (InputWaveform<C>::read): " << std::endl
466 <<
" calling function readheader() of member Mheader." 469 Mheader.setdebug(Mdebug);
470 Mheader.readheader(is);
471 int nsamples=Mheader.wid2().nsamples;
472 GSE2::waveform::TDAT2readCM6 freader(nsamples);
477 std::cerr <<
"ERROR (InputWaveform::read): " 478 <<
"allocating series for " << nsamples <<
" samples!" << std::endl;
481 for(aff::Iterator<C> i(Mseries); i.valid(); ++i)
482 { (*i) = Tvalue(freader(is)*Mheader.dast().ampfac); }
483 Mheader.readtrailer(is);
560 const libtime::TAbsoluteTime& idate);
566 const libtime::TAbsoluteTime& idate);
575 const double& radius=6371.);
580 const double& radius=6371.);
603 #endif // TF_SFFXX_H_VERSION (includeguard)
void append(const FREE &free)
void read(std::istream &is, const bool &debug=false)
STAT(std::istream &is, const bool &debug=false)
char coosysID(const Ecoosys &csid)
compare numbers of samples
libtime::TAbsoluteTime wid2lastsample(const WID2 &wid2)
return time of last sample in waveform
WID2compare(const int &flags=(Fstation|Fchannel|Fdt))
create compare object for comparison of selected fields
std::string auxid
Auxiliary identification code.
void write(std::ostream &os) const
void read(std::istream &is, const bool &debug=false)
void read(std::istream &is)
double calper
calibration reference period
compare dates of first sample
Ewid2field
bit values to select WID2 fields to be compared
void read(std::istream &is, const bool &debug=false)
Terror(const std::string &message)
std::string station
Station code.
compare sampling intervals
compares selected fields from two WID2 objects
std::string instype
instrument type
std::string channel
FDSN channel code.
int nsamples
number of samples
double offsetdeg(const SRCE &srce, const INFO &info, const double &radius)
return offset in degrees
libtime::TAbsoluteTime date
time of first sample
SFFostream< C > & operator<<(SFFostream< C > &os, const typename C::Tcoc &c)
FIRST(!) operator to be called for each trace.
static const char *const LINEID
std::string WIDXline(const sff::WID2 &wid2, const bool &debug=false)
write WID2 information in extended format
std::istream & operator>>(std::istream &is, FileHeader &fh)
void setdatetolerance(const double &tol)
tolerance when comparing date (as a fraction of the sampling interval)
Ecoosys
valid coordinate systems
void setdttolerance(const double &tol)
tolerance when comparing dt (as a fraction of the sampling interval)
double calib
calibration factor
double Mdatetolerance
relative to mean sampling interval
scale if largest amplitude larger than limit
void setstamp(const libtime::TAbsoluteTime &date) const
sff::SRCE srce_reference()
return synthetic time reference from nothing
long int wid2isample(const WID2 &wid2, const libtime::TAbsoluteTime &idate)
return index for sample at given date
const char *const WIDXID
ID for extended WID2 format.
libtime::TAbsoluteTime date
time of source
void read(std::istream &is, const bool &debug=false)
static const double decode_libversion
double vang
veritcal orientation
libtime::TAbsoluteTime wid2nextdate(const WID2 &wid2)
return time of next first sample for contiguous data
std::list< std::string > Tlines
static const char *const LINEID
double offset(const SRCE &srce, const INFO &info, const double &radius)
return offset in meters
void append(const std::string &line)
bool operator()(const WID2 &hd1, const WID2 &hd2) const
static const char *const LINEID
static const char *const LINEID
void read(std::istream &is)
double sourcedistance(const SRCE &srce, const INFO &info)
return spatial distance between source and receiver in meters
static const double libversion
Fortran library version (to ensure compatibility)
bool operator==(const INFO &info) const
double datetolerance() const
double dt
sampling interval (sec)
void clear(const int &flags)
scale for maximum dynamic range
std::string srce_reference_ID()
return ID string for synthtic time reference
double hang
horizontal orientation
double dttolerance() const
compare instrument type strings
static const char *const LINEID
void verbose(std::ostream &os, const WID2 &wid2)
libtime::TRelativeTime wid2isamplerest(const WID2 &wid2, const libtime::TAbsoluteTime &idate)
return time interval between idate and sample sample next to idate