Skip to content

Commit 8b54e94

Browse files
committed
Calculate CRE trajectory given RNIP and BETA
Calculated CRE trajectory using equation described in the paper 'The common reflection element (CRE) method revisited', Geophysics vol 63, number 3 (2000). That equation is based on a assymetry parameter alpha=sin(BETA)/RNIP. And gives the CRE trajectory m(h) in the m,h plane (CMP x Half-Offset). This trajectory intersects the interpolated constant offset gathers and someone can calculated the vector m(h), that describes a CMP coordinate for a given h in that gather. After that, someone could easy select traces that belong to the CRE trajectory (using m,h coordinates) in the interpolated data cube and build the CRE Gather.
1 parent 8d9a44f commit 8b54e94

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

Mcretrajec.c

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/* Versão 1.0 - Calculate CRE trajectory on m,h plane given zero offset CRS parameters (RNIP, BETA)
2+
3+
Programer: Rodolfo A. C. Neves (Dirack) 31/08/2019
4+
5+
Email: rodolfo_profissional@hotmail.com
6+
7+
License: GPL-3.0 <https://www.gnu.org/licenses/gpl-3.0.txt>.
8+
9+
*/
10+
11+
#include <math.h>
12+
#include <stdio.h>
13+
#include <stdlib.h>
14+
#include <rsf.h>
15+
16+
int main(int argc, char* argv[])
17+
{
18+
19+
float* m; // CMP
20+
float h; // Half offset
21+
float alpha; // Assymetry parameter
22+
float m0; // central CMP
23+
float* p; // RNIP and BETA parameters temporary vector
24+
float RNIP;
25+
float BETA;
26+
int np; // Number of parameters
27+
bool verb;
28+
float dm; // CMP sampling
29+
float om; // CMP axis origin
30+
int nm; // Number of CMP samples
31+
float dh; // Half offset sampling
32+
float oh; // Half offset axis origin
33+
int nh; // Number of Half offset samples
34+
float dt; // Time sampling
35+
float ot; // Time axis origin
36+
int nt; // Number of time samples
37+
int i; // counter
38+
39+
/* RSF files I/O */
40+
sf_file in, out, par;
41+
42+
/* RSF files axis */
43+
sf_axis ax,ay,az;
44+
45+
sf_init(argc,argv);
46+
47+
in = sf_input("in"); // Data cube A(m,h,t)
48+
par = sf_input("param"); // RNIP and BETA parameters
49+
out = sf_output("out"); // m(h) vector
50+
51+
if (!sf_getfloat("m0",&m0)) m0=0;
52+
/* central CMP (Km) */
53+
54+
if (!sf_histint(par,"n1",&np)){
55+
sf_error("No n1= in parameters file");
56+
}else if(np != 2){
57+
sf_error("The number of paramters should be 2: RNIP and BETA");
58+
}else{
59+
p = sf_floatalloc(2);
60+
sf_floatread(p,2,par);
61+
RNIP = p[0];
62+
if(RNIP == 0) sf_error("RNIP can't be zero");
63+
BETA = p[1];
64+
}
65+
66+
if (!sf_histint(in,"n1",&nt)) sf_error("No n1= in input file");
67+
if (!sf_histfloat(in,"d1",&dt)) sf_error("No d1= in input file");
68+
if (!sf_histfloat(in,"o1",&ot)) sf_error("No o1= in input file");
69+
if (!sf_histint(in,"n2",&nh)) sf_error("No n2= in input file");
70+
if (!sf_histfloat(in,"d2",&dh)) sf_error("No d2= in input file");
71+
if (!sf_histfloat(in,"o2",&oh)) sf_error("No o2= in input file");
72+
if (!sf_histint(in,"n3",&nm)) sf_error("No n3= in input file");
73+
if (!sf_histfloat(in,"d3",&dm)) sf_error("No d3= in input file");
74+
if (!sf_histfloat(in,"o3",&om)) sf_error("No o3= in input file");
75+
76+
if(! sf_getbool("verb",&verb)) verb=0;
77+
/* 1: active mode; 0: quiet mode */
78+
79+
alpha = sin(BETA)/RNIP;
80+
81+
if (verb) {
82+
83+
sf_warning("Active mode on!!!");
84+
sf_warning("Command line parameters: ");
85+
sf_warning("m0=%f",m0);
86+
sf_warning("Input file parameters: ");
87+
sf_warning("RNIP=%f BETA=%f",RNIP,BETA);
88+
sf_warning("Data cube dimensions: ");
89+
sf_warning("n1=%i d1=%f o1=%f",nt,dt,ot);
90+
sf_warning("n2=%i d2=%f o2=%f",nh,dh,oh);
91+
sf_warning("n3=%i d3=%f o3=%f",nm,dm,om);
92+
sf_warning("Calculated assimetry parameter:");
93+
sf_warning("alpha=%f", alpha);
94+
}
95+
96+
m = sf_floatalloc(nh);
97+
98+
if(alpha <= 0.001){
99+
for(i=0;i<nh;i++){
100+
m[i] = m0;
101+
}
102+
}else{
103+
for(i=0;i<nh;i++){
104+
h = (dh*i) + oh;
105+
m[i] = m0 + (1/(2*alpha)) * (1 - sqrt(1 + 4 * alpha * alpha * h * h));
106+
}
107+
}
108+
109+
/* axis = sf_maxa(n,o,d)*/
110+
ax = sf_maxa(nh, oh, dh);
111+
ay = sf_maxa(1, 0, 1);
112+
az = sf_maxa(1, 0, 1);
113+
114+
/* sf_oaxa(file, axis, axis index) */
115+
sf_oaxa(out,ax,1);
116+
sf_oaxa(out,ay,2);
117+
sf_oaxa(out,az,3);
118+
sf_floatwrite(m,nh,out);
119+
120+
exit(0);
121+
}

0 commit comments

Comments
 (0)