-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmwigb.m
132 lines (99 loc) · 3.4 KB
/
mwigb.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
function mwigb (a,scal,x,z,amx)
%mwigb: is a modified version of wigb.m which plot seismic data using
%wiggles but displays the screen as a normal seismic display such as those
%seen using SeismicUnix.
%
% wigb(a,scal,x,z,amx)
%
% IN a: seismic data
% scale: multiple data by scale
% x: x-axis;
% z: vertical axis (time or depth)
% x and z are vectors with offset and time.
%
% If only 'a' is enter, 'scal,x,z,amn,amx' are decided automatically;
% otherwise, 'scal' is a scalar; 'x, z' are vectors for annotation in
% offset and time, amx are the amplitude range.
%
% Author:
% Xingong Li, Dec. 1995
% Changes:
% Jun11,1997: add amx
% May16,1997: updated for v5 - add 'zeros line' to background color
% May17,1996: if scal ==0, plot without scaling
% Aug6, 1996: if max(tr)==0, plot a line
% Aug12, 2011: modification by Wail A. Mousa and Abdullatif A. Al-Shuhail
if nargin == 0, nx=10;nz=10; a = rand(nz,nx)-0.5; end;
[nz,nx]=size(a);
trmx= max(abs(a));
if (nargin <= 4); amx=mean(trmx); end;
if (nargin <= 2); x=[1:nx]; z=[1:nz]; end;
if (nargin <= 1); scal =1; end;
if nx <= 1; disp(' ERR:PlotWig: nx has to be more than 1');return;end;
% take the average as dx
dx1 = abs(x(2:nx)-x(1:nx-1));
dx = median(dx1);
dz=z(2)-z(1);
xmx=max(max(a)); xmn=min(min(a));
if scal == 0; scal=1; end;
a = a * dx /amx;
a = a * scal;
fprintf(' PlotWig: data range [%f, %f], plotted max %f \n',xmn,xmx,amx);
% set display range
x1=min(x)-2.0*dx; x2=max(x)+2.0*dx;
z1=min(z)-dz; z2=max(z)+dz;
set(gca,'NextPlot','add','Box','on', ...
'XLim', [x1 x2], ...
'YDir','reverse', ...
'YLim',[z1 z2]);
fillcolor = [0 0 0];
linecolor = [0 0 0];
linewidth = 0.1;
z=z'; % input as row vector
zstart=z(1);
zend =z(nz);
for i=1:nx,
if trmx(i) ~= 0; % skip the zero traces
tr=a(:,i); % --- one scale for all section
s = sign(tr) ;
i1= find( s(1:nz-1) ~= s(2:nz) ); % zero crossing points
npos = length(i1);
%12/7/97
zadd = i1 + tr(i1) ./ (tr(i1) - tr(i1+1)); %locations with 0 amplitudes
aadd = zeros(size(zadd));
[zpos,vpos] = find(tr >0);
[zz,iz] = sort([zpos; zadd]); % indices of zero point plus positives
aa = [tr(zpos); aadd];
aa = aa(iz);
% be careful at the ends
if tr(1)>0, a0=0; z0=1.00;
else, a0=0; z0=zadd(1);
end;
if tr(nz)>0, a1=0; z1=nz;
else, a1=0; z1=max(zadd);
end;
zz = [z0; zz; z1; z0];
aa = [a0; aa; a1; a0];
zzz = zstart + zz*dz -dz;
patch( aa+x(i) , zzz, fillcolor);
line( 'Color',[1 1 1],'EraseMode','background', ...
'Xdata', x(i)+[0 0], 'Ydata',[zstart zend]); % remove zero line
%'LineWidth',linewidth, ...
%12/7/97 'Xdata', x(i)+[0 0], 'Ydata',[z0 z1]*dz); % remove zero line
line( 'Color',linecolor,'EraseMode','background', ...
'LineWidth',linewidth, ...
'Xdata', tr+x(i), 'Ydata',z); % negatives line
else % zeros trace
line( 'Color',linecolor,'EraseMode','background', ...
'LineWidth',linewidth, ...
'Xdata', [x(i) x(i)], 'Ydata',[zstart zend]);
end;
end;
% Displaying the seismic gather in the traditional way for displaying seismic data
% Aug 12, 2011
x=10;y=10;%starting screen position
w=300;%figure width
h=600;%figure hieght
set(gcf,'position',[x y w h]);
% Putting the spatial axis in the top of the figure
set(gca,'xaxislocation','top')