Commit bc5b59c8 authored by thomas.forbriger's avatar thomas.forbriger

devonv [FEATURE]: provide tolerance mode

- let deconv provide tolerance with respect to sampling interval
- fix comment in teseco
parent f3d7311f
......@@ -29,11 +29,12 @@
* REVISIONS and CHANGES
* - 23/04/2009 V1.0 Thomas Forbriger
* - 02/08/2011 V1.1 added some columns to spectral output
* - 26/06/2020 V1.2 provide sampling interval tolerance
*
* ============================================================================
*/
#define DECONV_VERSION \
"DECONV V1.1 calculate response function by deconvolution"
"DECONV V1.2 calculate response function by deconvolution"
#include <string>
#include <iostream>
......@@ -77,7 +78,7 @@ const char* keys[]={
// structure to hold values of command line options
struct Options {
bool verbose, overwrite, writetransform;
double damping, cosinefrac;
double damping, cosinefrac, datetolerance;
std::string transformfile, inputformat;
bool demean, detrend;
int ndemean, ndetrend;
......@@ -94,6 +95,7 @@ int main(int iargc, char* argv[])
DECONV_VERSION "\n"
"usage: deconv [-v] [-o] [-damping=v] [-cosine=v]" "\n"
" [-transform=file] [-type f]" "\n"
" [-datetolerance f\n"
" [-demean[=n]] [-dtrend[=n]]" "\n"
" response input [t:l] [input [t:l]]" "\n"
" or: deconv --help|-h" "\n"
......@@ -114,6 +116,11 @@ int main(int iargc, char* argv[])
"-overwrite overwrite existing output file" "\n"
"-damping v set damping to fraction v of average input energy" "\n"
"-cosine v use cosine taper, wherer 0<v<0.5 is the taper fraction" "\n"
"-datetolerance f\n"
" set a tolerance level f for comparison of date of\n"
" input time series; dates will be considered as different\n"
" if they differ by more than a fraction f of the average\n"
" sampling interval\n"
"-transform f write Fourier transform of impulse response to file \"f\"" "\n"
" 1st column: frequency\n"
" 2nd column: amplitude response\n"
......@@ -160,6 +167,8 @@ int main(int iargc, char* argv[])
{"type",arg_yes,"sff"},
// 8: remove trend
{"detrend",arg_opt,"0"},
// 9: set date and time tolerance when checking consistency
{"datetolerance",arg_yes,"0."},
{NULL}
};
......@@ -196,6 +205,7 @@ int main(int iargc, char* argv[])
opt.inputformat=cmdline.string_arg(7);
opt.detrend=cmdline.optset(8);
opt.ndetrend=cmdline.int_arg(8);
opt.datetolerance=cmdline.double_arg(9);
// check option values
TFXX_assert(((0<=opt.damping) && (opt.damping<=1.0)),
......@@ -304,6 +314,7 @@ int main(int iargc, char* argv[])
/*----------------------------------------------------------------------*/
// check header consistency
sff::WID2compare compare(sff::Fnsamples | sff::Fdt | sff::Fdate);
compare.setdatetolerance(opt.datetolerance);
if (opt.verbose) { cout << "checking consistency..." << endl; }
if (!compare (finputtseries.header.wid2(),foutputtseries.header.wid2()))
{
......
......@@ -139,7 +139,7 @@ int main(int iargc, char* argv[])
{"Type",arg_yes,"sff"},
// 7: report details regarding data types
{"xhelp",arg_no,"-"},
// 8: report details regarding data types
// 8: set date and time tolerance when checking consistency
{"datetolerance",arg_yes,"0."},
// 9: trim size of series to the least number of samples
{"trim",arg_no,"-"},
......
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