1 | |
---|
2 | /* file SCUSRDEF.H |
---|
3 | * ========== |
---|
4 | * |
---|
5 | * version 4, 29-Jan-2007 |
---|
6 | * |
---|
7 | * prototypes of module SHCORR.C |
---|
8 | * K. Stammler, 22-MAY-91 |
---|
9 | */ |
---|
10 | |
---|
11 | |
---|
12 | /* |
---|
13 | * |
---|
14 | * SeismicHandler, seismic analysis software |
---|
15 | * Copyright (C) 1996, Klaus Stammler, Federal Institute for Geosciences |
---|
16 | * and Natural Resources (BGR), Germany |
---|
17 | * |
---|
18 | * This program is free software; you can redistribute it and/or modify |
---|
19 | * it under the terms of the GNU General Public License as published by |
---|
20 | * the Free Software Foundation; either version 2 of the License, or |
---|
21 | * (at your option) any later version. |
---|
22 | * |
---|
23 | * This program is distributed in the hope that it will be useful, |
---|
24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
26 | * GNU General Public License for more details. |
---|
27 | * |
---|
28 | * You should have received a copy of the GNU General Public License |
---|
29 | * along with this program; if not, write to the Free Software |
---|
30 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | |
---|
35 | #ifndef __SCUSRDEF |
---|
36 | #define __SCUSRDEF |
---|
37 | |
---|
38 | #ifndef __SHCONST |
---|
39 | #include "shconst.h" |
---|
40 | #endif |
---|
41 | |
---|
42 | /*---------------------------------------------------------------------------*/ |
---|
43 | |
---|
44 | |
---|
45 | void sc_set_corrm( int mode, STATUS *status ); |
---|
46 | |
---|
47 | /* set correlation mode |
---|
48 | * |
---|
49 | * parameters of routine |
---|
50 | * int mode; input; correlation mode (see above) |
---|
51 | * STATUS *status; output; return status |
---|
52 | */ |
---|
53 | |
---|
54 | |
---|
55 | /*---------------------------------------------------------------------------*/ |
---|
56 | |
---|
57 | |
---|
58 | void sc_set_corrl( REAL from_t, REAL to_t, STATUS *status ); |
---|
59 | |
---|
60 | /* sets correlation length for all following correlations |
---|
61 | * |
---|
62 | * parameters of routine |
---|
63 | * REAL from_t; input; rel. start time |
---|
64 | * REAL to_t; input; rel. end time |
---|
65 | * STATUS *status; output; return status |
---|
66 | */ |
---|
67 | |
---|
68 | |
---|
69 | /*---------------------------------------------------------------------------*/ |
---|
70 | |
---|
71 | |
---|
72 | long sc_restrclth( REAL dt ); |
---|
73 | |
---|
74 | /* returns length of result trace of correlation |
---|
75 | * |
---|
76 | * parameters of routine |
---|
77 | * REAL dt; input; sample distance |
---|
78 | */ |
---|
79 | |
---|
80 | |
---|
81 | /*---------------------------------------------------------------------------*/ |
---|
82 | |
---|
83 | |
---|
84 | void sc_do_corr( SAMPLE *wav, long wav_s, long wav_e, SAMPLE *trc, |
---|
85 | long maxtrc, REAL dt, SAMPLE *res, STATUS *status ); |
---|
86 | |
---|
87 | /* computes crosscorrelation of two traces "wav" and "trc". The |
---|
88 | * wavelet wav[wav_s..wav_e] is correlated with the trace windows |
---|
89 | * trc[wav_s-cls..wav_e-cls], trc[wav_s-cls+1..wav_e-cls+1], ... |
---|
90 | * up to trc[wav_s+cle..wav_e+cle]. Not existing samples of the |
---|
91 | * "trc"-array are replaced by zeroes. |
---|
92 | * |
---|
93 | * parameters of routine |
---|
94 | * SAMPLE *wav; input; (whole) wavelet trace |
---|
95 | * long wav_s, wav_e; input; wavelet window (samples) |
---|
96 | * SAMPLE *trc; input; 2. correlation trace |
---|
97 | * long maxtrc; input; length of 2. correlation trace (samples) |
---|
98 | * REAL dt; input; sample distance in sec |
---|
99 | * SAMPLE *res; output; result trace |
---|
100 | * STATUS *status; output; return status |
---|
101 | */ |
---|
102 | |
---|
103 | |
---|
104 | /*---------------------------------------------------------------------------*/ |
---|
105 | |
---|
106 | |
---|
107 | void sc_polar2( SAMPLE zarr[], SAMPLE rarr[], long lth, REAL *angle, |
---|
108 | REAL eigval[] ); |
---|
109 | |
---|
110 | /* computes main direction of polarisation in 2-dimensional case. |
---|
111 | * Result is the angle "angle" to the z-direction (in degrees) |
---|
112 | * |
---|
113 | * the coherence matrix |
---|
114 | * |
---|
115 | * - - - - |
---|
116 | * | <Z*Z> <Z*R> | | z c | |
---|
117 | * C = | | =: | | |
---|
118 | * | <Z*R> <R*R> | | c r | |
---|
119 | * - - - - |
---|
120 | * |
---|
121 | * is diagonalised. The direction of the eigenvector with the |
---|
122 | * largest eigenvalue is the desired direction |
---|
123 | * |
---|
124 | * Let |
---|
125 | * k := (z - r) / c |
---|
126 | * and |
---|
127 | * alpha[1] := 1/2 * (k + sqrt(k*k+4)) |
---|
128 | * alpha[2] := 1/2 * (k - sqrt(k*k+4)) |
---|
129 | * |
---|
130 | * then the eigenvalues lambda[i] and eigenvectors v[i] (i = 1,2) |
---|
131 | * are given by |
---|
132 | * |
---|
133 | * lambda[i] = r + c*alpha[i] |
---|
134 | * v[i] = ( alpha[i], 1 ) |
---|
135 | * |
---|
136 | * |
---|
137 | * parameters of routine |
---|
138 | * SAMPLE zarr[]; input; samples of z-trace |
---|
139 | * SAMPLE rarr[]; input; samples of r-trace |
---|
140 | * long lth; input; length of traces in samples |
---|
141 | * REAL *angle; output; computed angle |
---|
142 | * REAL eigval[];output; 2 eigenvalues returned |
---|
143 | */ |
---|
144 | |
---|
145 | |
---|
146 | /*---------------------------------------------------------------------------*/ |
---|
147 | |
---|
148 | |
---|
149 | void sc_polar3( SAMPLE zarr[], SAMPLE narr[], SAMPLE earr[], |
---|
150 | long lth, REAL *azim, REAL *inci, REAL eigval[], STATUS *status ); |
---|
151 | |
---|
152 | /* computes main direction of polarisation in 3-dimensional case. |
---|
153 | * Result is azimuth and angle of incidence (in degrees). |
---|
154 | * |
---|
155 | * the coherence matrix |
---|
156 | * |
---|
157 | * - - - - |
---|
158 | * | <Z*Z> <N*Z> <E*Z> | | zz zn ze | |
---|
159 | * | | | | |
---|
160 | * C = | <Z*N> <N*N> <E*N> | =: | zn nn ne | |
---|
161 | * | | | | |
---|
162 | * | <Z*E> <N*E> <E*E> | | ze ne ee | |
---|
163 | * - - - - |
---|
164 | * |
---|
165 | * is diagonalised. The direction of the eigenvector with the |
---|
166 | * largest eigenvalue is the desired direction |
---|
167 | * |
---|
168 | * parameters of routine |
---|
169 | * SAMPLE zarr[]; input; samples of z-trace |
---|
170 | * SAMPLE narr[]; input; samples of n-trace |
---|
171 | * SAMPLE earr[]; input; samples of e-trace |
---|
172 | * long lth; input; length of traces in samples |
---|
173 | * REAL *azim; output; computed azimuth |
---|
174 | * REAL *inci; output; computed angle of incidence |
---|
175 | * REAL eigval[];output; 3 eigenvalues returned |
---|
176 | * STATUS *status; output; return status |
---|
177 | */ |
---|
178 | |
---|
179 | |
---|
180 | /*---------------------------------------------------------------------------*/ |
---|
181 | |
---|
182 | #endif /* __SCUSRDEF */ |
---|