35 #define SFFTEST_VERSION \ 36 "SFFTEST V1.0 test library modules" 41 #include <aff/series.h> 42 #include <tfxx/commandline.h> 52 cout <<
"test internals\n" 53 <<
"--------------\n" << endl;
54 cout <<
"sizeof(sff::WID2): " <<
sizeof(
sff::WID2) << endl;
61 cout <<
"test WIDX functions" << endl
62 <<
"-------------------" << endl;
66 mywid2.
date += libtime::TRelativeTime(0,0,0,0,432,567);
77 cout << Xline << std::endl;
88 cout <<
"test line functions" << endl
89 <<
"-------------------" << endl;
92 cout << mystat.
line();
96 cout << mysrce.
line();
100 cout << mydast.
line();
104 cout << myinfo.
line();
108 cout << mywid2.
line();
114 cout << mywid2.
line();
118 myfree.
lines.push_back(
"Hi there!");
119 myfree.
lines.push_back(
"A second free line");
129 cout <<
"test verbose functions" << endl
130 <<
"----------------------" << endl;
154 myfree.
lines.push_back(
"Hi there!");
155 myfree.
lines.push_back(
"A second free line");
170 cout <<
"test write wrappers" << endl
171 <<
"-------------------" << endl;
176 myfree.
lines.push_back(
"auch ein text");
185 cout << endl <<
"next:" << endl;
187 cout << endl <<
"next:" << endl;
189 cout << endl <<
"next:" << endl;
192 cout << endl <<
"next:" << endl;
194 cout << endl <<
"next:" << endl;
196 cout << endl <<
"next:" << endl;
198 cout << endl <<
"next:" << endl;
200 cout << endl <<
"next:" << endl;
209 for (
int i=s.first(); i<=s.last(); i++)
211 cout <<
"scale by " << f << endl;
217 { cout <<
"will be scaled with ampfac "; }
219 { cout <<
"will not be scaled and ampfac is "; }
225 cout <<
"test waveform normalizer" << endl
226 <<
"------------------------" << endl;
229 cout <<
"2^23: " << std::pow(2.,23.) << endl;
233 for (
int i=series.first(); i<=series.last(); i++)
234 { series(i)=sin(3.1415926*i*5/msamp); }
268 char filename[]=
"junk.sff";
269 cout <<
"test writing to file: " << filename << endl
270 <<
"---------------------" << endl;
272 const int msamp=1000;
274 for (
int i=series.first(); i<=series.last(); i++)
275 { series(i)=10.*sin(3.1415926*i*5/msamp); }
281 mysrce.
type=
"Quelle";
286 myfree.
lines.push_back(
"auch ein text");
296 std::ofstream os(filename);
307 cout <<
"you will find the data in " << filename << endl;
314 char infile[]=
"junk.sff";
315 char outfile[]=
"junk2.sff";
316 cout <<
"test reading from file: " << infile << endl
317 <<
"-----------------------" << endl;
321 std::cerr <<
"manipulate " << infile
322 <<
" - if you like to..." << std::endl;
326 std::ifstream is(infile);
329 std::ofstream os(outfile);
334 cout <<
"FREE: " << std::endl << fhd.
free() << endl;
338 cout <<
"SRCEtime: " << fhd.srce().date.timestring() << endl;
347 }
catch (GSE2::Terror) {
348 cerr <<
"UUpppsss" << endl;
350 cerr << wid2line.
line();
352 cerr << series.size() <<
" samples" << endl;
355 cerr << iwf.
header().wid2().line() << endl;
357 os << sff::OutputWaveform<Tseries>(iwf.
series(),
361 cout <<
"you will find the data in " << outfile << endl;
368 char outfile[]=
"junk3.sff";
369 cout <<
"test kipping every second trace" << endl
370 <<
"-------------------------------" << endl;
372 cout <<
"enter name of input file: ";
376 std::ifstream is(infile.c_str());
379 std::ofstream os(outfile);
384 cout <<
"SRCEtime: " << fhd.srce().date.timestring() << endl;
397 os << sff::OutputWaveform<Tseries>(iwf.
series(),
407 os << sff::OutputWaveform<Tseries>(dummy, ohd,
sff::NM_one);
410 cout <<
"you will find the data in " << outfile << endl;
419 int main(
int iargc,
char* argv[])
425 "usage: sfftest [-D] [-v] [-x] [-i]" "\n" 426 " or: sfftest --help|-h" "\n" 432 "-D produce debug output" "\n" 433 "notice: you have to pass at least one dummy argument to make" "\n" 434 "the program run" "\n" 435 "-v test verbose output" "\n" 436 "-x test extended WIDX format" "\n" 437 "-i test library internals" "\n" 441 using namespace tfxx::cmdline;
442 static Declare options[]=
460 cerr << usage_text << endl;
465 Commandline cmdline(iargc, argv, options);
468 if (cmdline.optset(0))
470 cerr << usage_text << endl;
471 cerr << help_text << endl;
476 opt.
debug=cmdline.optset(1);
void test_extended_functions()
aff::Series< double > Tseries
void write(std::ostream &os) const
void test_write_wrappers()
std::string station
Station code.
int main(int iargc, char *argv[])
std::string instype
instrument type
std::string channel
FDSN channel code.
int nsamples
number of samples
libtime::TAbsoluteTime date
time of first sample
void test_verbose_functions()
void test_line_functions()
std::string WIDXline(const sff::WID2 &wid2, const bool &debug=false)
write WID2 information in extended format
void test_waveform_normalizer()
void test_read_file(const bool &debug)
scale if largest amplitude larger than limit
double vang
veritcal orientation
void scale_series(Tseries &s, const double &f)
double dt
sampling interval (sec)
scale for maximum dynamic range
void scaling(const sff::TraceHeader &hd)
double hang
horizontal orientation
void verbose(std::ostream &os, const WID2 &wid2)