UNIVERS  15.3
UNIVERS base processing software API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
wtn_filter.hpp
1 /* wtn_filter.hpp */
2 /* $Id: wtn_filter.hpp 22094 2013-03-28 07:21:57Z fern $ */
3 #ifndef __wtn_filter_hpp
4 #define __wtn_filter_hpp
5 
6 #include <mth/lev.h>
7 #include <s2proc/wave_field.hpp>
8 #include <mix/General.h>
10 
11 /* SHOULD BE CHANGED!!! */
12 enum { MULT, PRD, AVER };
13 
14 #warning "New extrapolation is not finished/tested."
15 //#define WTNF_NEW_EXTRAPOL
16 
17 #define WTNF_REAL_ZERO 1e-20
18 
19 /*---- Wavelet noise filtering ----*/
20 typedef struct {
21  char sOutMdfR[NMOD_LEN], sOutMdfN[NMOD_LEN];
22 
23  int sgType;
24  int insp1, insp2;
25 
26  float tabase; /* Amplitude Estimation Time Base Size, ms */
27  float agldl; /* Amplitude Global Discrimination Level */
28  float lwmax; /* Noise Wavelet Maximal Available Length, ms */
29  int avtcnt; /* Trace Count of Average Amplitude estimation */
30  float avwin; /* Time Windowof of Average Amplitude estimation, ms */
31  float avdel; /* Deleted Samples Part of Average Amplitude estimation */
32  float alcdl; /* Amplitude Local Discrimination Level */
33  int crtcnt; /* Trace Count of Correlation Discrimination */
34  float crshift; /* Max Trace Shift of Correlation Discrimination */
35  float crclv; /* Critical Level of Correlation Discrimination */
36  bool tar_l; /* Trace Amplitudes Recovery option: Yes/No */
37  int wrtyp; /* Recovery Type: PRD or AVER */
38  int watcnt; /* Wave Averaging Trace Count */
39  float nslw; /* Noise amplitude attenuation slope width, ms */
40  float cfred; /* Factor of ampls reduction to local amplitude average*/
41 } WletFl;
42 
43 
44 typedef struct {
45  int jbs; /* trace order index */
46  int nsp;
47  int nmgl;
48  float hcab;
49  Trace body;
50 } TrDat;
51 
52 typedef std::vector<TrDat> TrDataSet;
53 
54 /* Row output DB parameters */
55 typedef struct WOutPar {
56  int nwavs; /* noise wavelets detected count */
57  float nsrat; /* noise to signal ratio */
58  WOutPar() : nwavs(0), nsrat(0.) {}
59 };
60 
61 
62 
63 
64 int calcPredOper(double *opr, double *acf, int lopr);
65 
66 int TrExtrapol(float *tr, int lgate, int ibwav, int iewav, int extra_side);
67 
68 float WavNsSigRat(const Trace& trin, const Trace& trout);
69 
70 class WTNFilter
71 {
72 public:
73 
74  typedef struct {
75  int ib,ie; /* start and end indeces of amplitude estimation sample */
76  double amp; /* trace local max amplitude */
77  double avAm; /* average median ampl in amp and trace vicinity */
78  bool nsAm; /* noise mark: TRUE if noise ampl */
79  } AmpTr;
80 
81  typedef struct {
82  float Dt;
83  int samples_count;
84  int base_count;
85  } TraceParams;
86 
87  WTNFilter(WletFl wltf);
88 
89  WTNFilter(WletFl wltf, WaveField* wf);
90 
91  /* =========== Modifiers =========== */
92 
94  void setWFData(WaveField* wf);
95 
97  void setFilterData(WletFl wltf);
98 
99 
100  /* =========== Members access =========== */
101 
103  bool ready() { return m_ready; }
104 
105  /* =========== Calculation methods =========== */
106 
108  int filterSeism(std::vector<WOutPar>& outPar,
109  WaveField& wf_res,
110  WaveField& wf_init);
111 
113  int filterSeism(WaveField* wf,
114  std::vector<WOutPar>& outPar,
115  WaveField& wf_res,
116  WaveField& wf_init);
117 
118 protected:
119 
120  WTNFilter();
121 
122  int AWavNsFil(int jr, int ntr, TrDataSet *trb, float *trout, int *nwavs);
123 
124  void fill2DMaxAmplMatrix(int jbeg, TrDataSet *trb, AmpTr **&aTr2D);
125 
126  void fillMedianData(int jra, Trace& body, AmpTr **aTr2D);
127 
128  void waveletNoisesProcessing(int jr, int ntr, TrDataSet *trb, AmpTr *aTr1D, float *trout, int *nwavs);
129 
130  void traceAmplRecovery(int nwav, int nwav3, AmpTr *aTr1D, float *trout, int *ist, int *ift, bool *lnm, int *ibam, int *ieam);
131 
132  int countZeroSamples(const Trace& body);
133 
134  bool m_ready;
140  TraceParams m_tr_par;
141 };
142 
143 
144 
145 int TrRightExtrapol(int lgate, float *tr, int ibwav, int iewav);
146 int TrLeftExtrapol(int lgate, float *tr, int ibwav, int iewav);
147 
148 
149 #endif /* wtn_filter.hpp */
Definition: wtn_filter.hpp:74
bool m_ready
Definition: wtn_filter.hpp:134
Definition: wtn_filter.hpp:81
bool ready()
Definition: wtn_filter.hpp:103
Definition: wtn_filter.hpp:20
int filterSeism(std::vector< WOutPar > &outPar, WaveField &wf_res, WaveField &wf_init)
WletFl m_wltf
Definition: wtn_filter.hpp:136
void setFilterData(WletFl wltf)
Definition: wave_field.hpp:13
Definition: trace.hpp:14
void setWFData(WaveField *wf)
int insp1
urij///UDBSeis::OSType sgType;
Definition: wtn_filter.hpp:24
Definition: wtn_filter.hpp:55
Definition: wtn_filter.hpp:44
Definition: wtn_filter.hpp:70
WaveField * m_wf
Definition: wtn_filter.hpp:138