Commit 763b44dd authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2239
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 4b0ec957
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: noisymize.cc,v 1.9 2007-03-02 11:59:05 tforb Exp $
* $Id: noisymize.cc,v 1.10 2007-03-09 09:52:20 tforb Exp $
* \author Thomas Forbriger
* \date 27/06/2006
*
......@@ -17,13 +17,18 @@
* - 26/02/2007 V1.2 report factors
* - 02/03/2007 V1.3 scale with offset
* V1.4 special scaling for horizontal component
* - 08/03/2007 V1.5
* - allow switching of offset specific scaling
* - added description in help section
* - improved out format of list of factors
*
* ============================================================================
*/
#define NOISYMIZE_VERSION \
"NOISYMIZE V1.4 program reads a set of SFF traces, convolves them with white noise and stacks"
"NOISYMIZE V1.5 program reads a set of SFF traces,\n" \
" convolves them with white noise and stacks"
#define NOISYMIZE_CVSID \
"$Id: noisymize.cc,v 1.9 2007-03-02 11:59:05 tforb Exp $"
"$Id: noisymize.cc,v 1.10 2007-03-09 09:52:20 tforb Exp $"
#include <fstream>
#include <iostream>
......@@ -46,6 +51,7 @@ using std::endl;
// put all commandline settings into a struct
struct Options {
bool verbose, setnoiselength, overwrite, reportfactors;
bool noscaling;
int noiselength;
double offexp;
std::string inputformat;
......@@ -97,6 +103,29 @@ int main(int iargc, char* argv[])
"-rf report factors" "\n"
"-s e scale seismograms with offset" "\n"
" the scaling factor is r**e, where r is the offset" "\n"
"-fixed do not scale each offset with a randomly" "\n"
" chosen amplitude" "\n"
"\n"
"Description of the procedure:" "\n"
"- the program reads pairs of seismograms from Zin and Rin" "\n"
"- each of the input files may contain multiple traces" "\n"
"- for each trace in Zin there must be a corresponding trace" "\n"
" in Rin at the same offset" "\n"
"- for each offset the program does the following:" "\n"
" 1. the Z-trace and the R-trace are convolved with the same" "\n"
" stochastic time series (random normaly distributed white noise)" "\n"
" a new stochastic time series is calculated for each offset" "\n"
" through the libgsl random number generator" "\n"
" 2. the Z-trace and the R-trace are scaled by a random value" "\n"
" (this function can be switched off through option -fixed)" "\n"
" 3. the Z-trace and the R-trace are scaled by an offset" "\n"
" dependend value (selected through option -s e)" "\n"
" 4. the R-trace is scaled by 2/pi to simulate a uniform" "\n"
" distribution of sources of all azimuths; as a consequence" "\n"
" the R result my be used as N- and E-component as well" "\n"
"- the results for all offsets are stacked; the resulting Z-" "\n"
" and R-series are written to files Zout and Rout," "\n"
" respectively"
};
// define commandline options
......@@ -117,6 +146,8 @@ int main(int iargc, char* argv[])
{"rf",arg_no,"-"},
// 6: report factors
{"s",arg_yes,"0."},
// 7: report factors
{"fixed",arg_no,"-"},
{NULL}
};
......@@ -138,30 +169,6 @@ int main(int iargc, char* argv[])
exit(0);
}
/*
// dummy operation: print option settings
for (int iopt=0; iopt<2; iopt++)
{
cout << "option: '" << options[iopt].opt_string << "'" << endl;
if (cmdline.optset(iopt)) { cout << " option was set"; }
else { cout << "option was not set"; }
cout << endl;
cout << " argument (string): '" << cmdline.string_arg(iopt) << "'" << endl;
cout << " argument (int): '" << cmdline.int_arg(iopt) << "'" << endl;
cout << " argument (long): '" << cmdline.long_arg(iopt) << "'" << endl;
cout << " argument (float): '" << cmdline.float_arg(iopt) << "'" << endl;
cout << " argument (double): '" << cmdline.double_arg(iopt) << "'" << endl;
cout << " argument (bool): '";
if (cmdline.bool_arg(iopt))
{ cout << "true"; } else { cout << "false"; }
cout << "'" << endl;
}
while (cmdline.extra()) { cout << cmdline.next() << endl; }
// dummy operation: print rest of command line
while (cmdline.extra()) { cout << cmdline.next() << endl; }
*/
/*----------------------------------------------------------------------*/
// read command line settings
......@@ -174,6 +181,7 @@ int main(int iargc, char* argv[])
opt.overwrite=cmdline.optset(4);
opt.reportfactors=cmdline.optset(5);
opt.offexp=cmdline.double_arg(6);
opt.noscaling=cmdline.optset(7);
Filenames filename;
TFXX_assert(cmdline.extra(), "ERROR: missing filename Zin!");
......@@ -251,6 +259,7 @@ int main(int iargc, char* argv[])
Tseries Zseries, Rseries;
// scaling factors
Tseries fac=ts::rnd::dugauss(Zindata.size());
if (opt.noscaling) { fac=1.; }
Tseries offfac(Zindata.size());
Tseries traceoffset(Zindata.size());
//
......@@ -308,14 +317,27 @@ int main(int iargc, char* argv[])
if (opt.reportfactors)
{
cout << "factors used for scaling:" << endl;
cout.width(5);
cout << "#";
cout.width(12);
cout << "f1";
cout.width(12);
cout << "f2";
cout.width(14);
cout << "offset" << endl;
for (itrace=0; itrace<Zindata.size(); itrace++)
{
cout << "trace #" << itrace << ": "
<< fac(itrace) << ", "
<< offfac(itrace) << ", "
<< traceoffset(itrace) << "m"
<< endl;
cout.width(5); cout.precision(3);
cout << itrace;
cout.width(12); cout.precision(4);
cout << fac(itrace);
cout.width(12); cout.precision(4);
cout << offfac(itrace);
cout.width(12); cout.precision(4);
cout << traceoffset(itrace)*1.e-3 << "km";
cout << endl;
}
cout << "traces are scale by f1*f2" << endl;
}
/*----------------------------------------------------------------------*/
......
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