write WID2 information in extended format
write WID information in extended format.
This function breaks the SFF format definition. It writes the WID2 class data to a line with identifier WIDX rather than WID2. The function is implemented within this library to provide transparent reading of WID-data. Writing will be used outside of the library only.
Reasons to implement this function are:
- The GSE WID2 format does not use microseconds for the time of the first sample. The information present in sff::WID2 however is precise to the level of microseconds and is also used in this way when processing e.g. MiniSEED data. It is thus desirable to read and write this information with the full available content.
- The GSE WID2 format restricts the sampling to be defined in terms of a sampling rate. This is inappropriate to extremely long period data with e.g. 1 Minute sampling interval (i.e. 60s). Round-off errors will lead to time residuals in these cases of more than a second within one day.
- See also
- WIDXline(const std::string& line)
Definition at line 115 of file widXio.cc.
References sff::WID2::auxid, sff::WID2::calib, sff::WID2::calper, sff::WID2::channel, sff::WID2::date, sff::WID2::dt, sff::WID2::hang, sff::WID2::instype, sff::WID2::nsamples, sff::helper::nsignificantdigits(), sff::WID2::station, sff::WID2::vang, and WIDXID.
Referenced by sff::WID2::read(), and test_extended_functions().
119 std::cerr <<
"DEBUG (WIDXline): entered function" <<
122 std::ostringstream os;
124 os <<
" " << wid2.
date.hierarchicalstring();
127 os.setf(std::ios_base::left, std::ios_base::adjustfield);
128 os << wid2.
station.substr(0,5);
131 os.setf(std::ios_base::left, std::ios_base::adjustfield);
132 os << wid2.
channel.substr(0,3);
135 os.setf(std::ios_base::left, std::ios_base::adjustfield);
136 os << wid2.
auxid.substr(0,4);
139 os.setf(std::ios_base::left, std::ios_base::adjustfield);
140 os << wid2.
instype.substr(0,6);
144 std::cerr <<
"DEBUG (WIDXline): partial result:" <<
145 os.str() << std::endl;
147 double rate=1./wid2.
dt;
148 double value=wid2.
dt;
160 std::cerr <<
"DEBUG (WIDXline): partial result:" <<
161 os.str() << std::endl;
163 os.setf(std::ios_base::scientific, std::ios_base::floatfield);
167 std::cerr <<
"DEBUG (WIDXline): ndigits:" <<
168 ndigits << std::endl;
170 os.precision(ndigits);
187 std::cerr <<
"DEBUG (WIDXline): final result:" <<
188 os.str() << std::endl;
std::string auxid
Auxiliary identification code.
double calper
calibration reference period
std::string station
Station code.
std::string instype
instrument type
std::string channel
FDSN channel code.
int nsamples
number of samples
libtime::TAbsoluteTime date
time of first sample
double calib
calibration factor
const char *const WIDXID
ID for extended WID2 format.
double vang
veritcal orientation
int nsignificantdigits(double v, const bool &debug=false)
return number of significant digits
double dt
sampling interval (sec)
double hang
horizontal orientation