Code covered by the BSD License  

Highlights from
Seis_Pick

image thumbnail

Seis_Pick

by

 

06 Feb 2012 (Updated )

Seis_Pick provides an interactive picking environment for processing seismic data.

microseis_plot(datain,nc,t1,t2,r1,r2,smp,scal,varargin)
function microseis_plot(datain,nc,t1,t2,r1,r2,smp,scal,varargin)
% [fact]=microseis_plot_energy(datain,nc,t1,t2,tr1,tr2,smp,scal,picks)
% 
% function for plotting micro_seismic traces 
%
% Input Arguments
% ---------------------------------------------------------------
% datain   - input matrix of seismic traces
% nc       - number of components for each trace
% t1,t2    - beginning and end times to be displayed
% tr1,tr2  - first and last traces to be displayed
%  
% smp      - sampling interval (s)
% scal     - scaling method (see notes below)
% picks    - vector containing pick information in the form [i tp ts]
%
% Notes 
% --------------------------------------------------------------- 
% 1. to display traces in reverse direction set tr1 equal to larger trace
% 
% 2. datain is a matrix i.e. dsivar.dat{1} and not a dsivar!
%  
% Output
% ---------------------------------------------------------------  
% fact - factor that matrix was scaled by for plotting
%        if you want to plot several matrices using the same 
%        scaling factor, capture 'fact' and pass it as input 
%        variable 'scal' to future matrices with 'scfact' set to 1
%
% DSI customized VSP processing software
%  
% written by G. Perron January, 1998
% modified by Jonathan Ajo-Franklin, June 16, 2005
% modified by James P. Verdon, 2011 
% 1. JAF : dealt with the t1:smp:t2 exception ...
% 2. JPV : Plots rotated for horizontal traces more commonly used in 
%          microseismic formats
% 3. JPV : Every three plots (ie., xyz or enz components) are on the same 
%          axis. Colours are now default.          
% 4. JPV : Scal has been modified: 0 is every trace is scaled to the 
%          overall maximum (equivalent to 'xlim all' in SAC). 1 is every 
%          trace is scaled to its own maximum.  2 is each set of 
%          traces on a phone is scaled to the maximum of these traces
% 5. JPV : the wiggles are no longer filled - this is not usually done for
%          microseismic traces       
% 6. JPV : Modified so that picks are plotted as well
% 7. JPV : Modified so that energy envelopes are plotted using a Hilbert
%          transform.
%

ppicks=0;
t=isempty(varargin);
if t==0
    ppicks=1;
    picks=varargin{1};
end

% Check that traces are specified in ascending order
if r2 <= r1
    error('End trace must be larger than initial trace')
end
if t2 <= t1
    error('End time must be larger than initial time')
end
% Check that the number of traces can be divided by 3
if mod(size(datain,2),nc) ~= 0
    error('Number of traces must be a multiple of NC')
end

traces=(r1-1)*nc+1:r2*nc;

% Subsection the data to the desired traces and start times
a=datain(round(t1/smp)+1:round(t2/smp)+1,traces);

% Hilbert transform the data to get energy envelopes
h=abs(hilbert(a));

fmult=1.8; %Scaling of energy relative to trace plots
% Scale by the scaling factor
if scal==0 
    fact=max(max(abs(a)));
    a=a./fact;
    h=h./(fact*fmult);
elseif scal==1;
    fact=max(abs(a));
    for i=1:size(a,2)
        a(:,i)=a(:,i)/fact(i);
        h(:,i)=h(:,i)/(fact(i)*fmult);
    end
elseif scal==2
    for i=1:r2-r1+1
        fact(i)=max(max(abs(a(:,(i-1)*nc+1:i*nc))));
    end
    for i=1:size(a,2)
        a(:,i)=a(:,i)/fact(ceil(i/nc));
        h(:,i)=h(:,i)/(fact(ceil(i/nc))*fmult);
    end
end

for i=1:r2-r1+1
    if nc > 1
        ch(:,i)=sum(abs(h(:,(i-1)*nc+1:i*nc)'))/nc;
    else
        ch(:,i)=abs(h(:,(i-1)*nc+1:i*nc)');
    end
end

% Scale down further to reduce trace overlap
a=a*0.3;

[xmat,ymat] = meshgrid(traces,t1:smp:t2);
if length(xmat) < length(a)
    [xmat,ymat] = meshgrid(traces,t1:smp:t2+smp);
end

inc=1;
a=a.*inc+ceil(xmat/nc);

for i=1:r2-r1+1
    nch(:,i)=-ch(:,i)*inc + xmat(:,nc*i)/nc;
    ch(:,i)=ch(:,i)*inc + xmat(:,nc*i)/nc;
    eymat(:,i)=ymat(:,i);
end

% Deal with the picks
if ppicks==1
    pmat=[xmat(1,picks(:,1))-0.4; xmat(1,picks(:,1))+0.4];
    ppick=[picks(:,2) picks(:,2)]';
    smat=[xmat(1,picks(:,1))-0.4; xmat(1,picks(:,1))+0.4];
    spick=[picks(:,3) picks(:,3)]';
    pemat=[xmat(1,picks(:,1))-0.4; xmat(1,picks(:,1))+0.4];
    pepick=[picks(:,4) picks(:,4)]';
    semat=[xmat(1,picks(:,1))-0.4; xmat(1,picks(:,1))+0.4];
    sepick=[picks(:,5) picks(:,5)]';
end


% Plotting.....
if nc==1
    colourorder=[0 0 0;0 0 0];
elseif nc==2
    colourorder=[1 0 0;0 0 1];
elseif nc==3
    colourorder=[1 0 0; 0 1 0; 0 0 1];
end
hold on
box on
set(gca,'ColorOrder',colourorder)
set(gca,'xgrid','on')
plot(eymat,nch,'k','LineWidth',1.)
plot(eymat,ch,'k','LineWidth',1.)
fill(eymat,nch,[1 1 1]*0.9)
fill(eymat,ch,[1 1 1]*0.9)
plot(ymat,a)
if ppicks==1
    plot(ppick,pmat,'k--')
    plot(spick,smat,'r--')
    plot(pepick,pemat,'b--')
    plot(sepick,semat,'g--')
end
xlabel('Time (s)')















Contact us