Commit bb01acbe authored by thomas.forbriger's avatar thomas.forbriger
Browse files

croposp [WP]: prepare implementation of computation options

parent 06267914
......@@ -52,6 +52,9 @@ struct Options {
bool verbose, trim, debug;
std::string inputformat, labelpattern;
double datetolerance;
unsigned int n_per_decade;
bool compute_psd, compute_npsd, compute_coherency, compute_transfer;
std::string outfile_psd, outfile_npsd, outfile_coherency, outfile_transfer;
}; // struct Options
// a struct to hold meta data
......@@ -66,6 +69,18 @@ typedef ts::TimeSeriesCollection<double> TCollection;
typedef std::vector<Meta> TMetaVector;
/* ====================================================================== */
// define usage information
char reference_sleeman_et_al_2006[]=
{
"Reinoud Sleeman, Arie van Wettum, and Jeannot Trampert, 2006.\n"
" Three-Channel Correlation Analysis: A New Technique to Measure\n"
" Instrumental Noise of Digitizers and Seismic Sensors.\n"
" Bull. Seism. Soc. Am., Vol. 96, No. 1, pp. 258–271.\n"
" doi: 10.1785/0120050032\n"
" http://www.geo.uu.nl/~seismain/pdf/bssa06-inst.pdf (accessed 2019-01-25)\n" };
/* ====================================================================== */
std::string patsubst(const std::string& templatestring,
const std::string& pattern,
......@@ -123,6 +138,7 @@ int main(int iargc, char* argv[])
CROPOSP_VERSION "\n"
"usage: croposp [-verbose] [-itype f] [-trim] [-datetolerance t]" "\n"
" [-label p]" "\n"
" [-psd f] [-npsd f] [-transfer f] [-coherency f]" "\n"
" file [t:sel] [f:format] [n:label] [file [t:s] [f:f] [n:l]] [...]\n"
" or: croposp --help|-h" "\n"
};
......@@ -146,6 +162,17 @@ int main(int iargc, char* argv[])
" %F: file name\n"
" %NT: number of trace in file\n"
"\n"
"output options:\n"
"-psd f compute power spectral density and write to file \"f\"\n"
"-npsd f compute power spectral density of incoherent component\n"
" and write to file \"f\"\n"
" Sleeman et al (2006, eq. 14)\n"
"-transfer f compute amplitude transfer function for pairs of\n"
" signals and write to file \"f\"\n"
" Sleeman et al (2006, eq. 13)\n"
"-coherency f compute coherecy for pairs of signals\n"
" and write to file \"f\"\n"
"\n"
"keys to be appended to file names if required:\n"
"t:sel trace selection\n"
"f:format file format\n"
......@@ -170,6 +197,14 @@ int main(int iargc, char* argv[])
{"DEBUG",arg_no,"-"},
// 6: pattern for trace label
{"pattern",arg_yes,"%S:%C:%A:%I"},
// 7: compute PSD
{"psd",arg_yes,"-"},
// 8: compute PSD of incoherent component
{"npsd",arg_yes,"-"},
// 9: compute transfer function
{"transfer",arg_yes,"-"},
// 10: compute coherency
{"coherency",arg_yes,"-"},
{NULL}
};
......@@ -201,6 +236,10 @@ int main(int iargc, char* argv[])
{
cerr << usage_text << endl;
cerr << help_text << endl;
cerr << endl;
cerr << "References" << endl
<< "----------" << endl;
cerr << reference_sleeman_et_al_2006 << endl;
exit(0);
}
......@@ -212,6 +251,15 @@ int main(int iargc, char* argv[])
opt.debug=cmdline.optset(5);
opt.labelpattern=cmdline.string_arg(6);
opt.compute_psd=cmdline.optset(7);
opt.outfile_psd=cmdline.string_arg(7);
opt.compute_npsd=cmdline.optset(8);
opt.outfile_npsd=cmdline.string_arg(8);
opt.compute_transfer=cmdline.optset(9);
opt.outfile_transfer=cmdline.string_arg(9);
opt.compute_coherency=cmdline.optset(10);
opt.outfile_coherency=cmdline.string_arg(10);
TFXX_assert(((opt.datetolerance >= 0.) && (opt.datetolerance <=1.)),
"datetolerance is out of accepted range");
......@@ -315,6 +363,11 @@ int main(int iargc, char* argv[])
/* ====================================================================== */
TFXX_assert(!opt.compute_psd, "-psd is not yet implemented");
TFXX_assert(!opt.compute_npsd, "-npsd is not yet implemented");
TFXX_assert(!opt.compute_transfer, "-transfer is not yet implemented");
TFXX_assert(!opt.compute_coherency, "-coherency is not yet implemented");
} // main()
/* ----- END OF croposp.cc ----- */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment