⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s_iplot.m

📁 基于Matlab的地震数据处理显示和测井数据显示于处理的小程序
💻 M
📖 第 1 页 / 共 2 页
字号:
   endelse%  dti=seismic.step;   times=(seismic.first:seismic.step:seismic.last)';   yi=seismic.traces;endtrace_max=max(abs(yi));%     Compute horizontal trace locationsif uniform   xi=1:ntr;else   xi=annotation;   if min(xi) == max(xi) & length(xi) > 1      disp([' Header requested for annotation ("',param.annotation,'") is constant;'])      disp('  please use uniform spacing')      error(' Abnormal termination')   endend%    Trace-to-trace separationif ntr > 1   dx=(max(xi)-min(xi))/(ntr-1);else   dx=1;end%     Scale dataif ischar(param.scale)   if strcmpi(param.scale,'yes')      scale=(dx*param.deflection)./(trace_max+eps)';      yi=yi*spdiags(scale,0,ntr,ntr);   else      scale=dx*param.deflection/(max(trace_max)+eps);      yi=yi*scale;   endelse   scale=param.scale;   if length(scale) == 1      yi=yi*scale;   elseif length(scale) == ntr      yi=yi*spdiags(scale(:),0,ntr,ntr);   else      error(' Scale factor must be scalar or vector of length equal to the number of traces')   endendif nargout == 1   aux.scale=scale;end%       Create axisaxis([min(xi)-dx*max([param.deflection,1]),max(xi)+dx*max([param.deflection,1]),seismic.first,seismic.last]);hold onha=get(gcf,'CurrentAxes');set(ha,'ydir','reverse')set(ha,'XAxisLocation','top');%    Handle reversal of plot directionif strcmpi(param.direction,'r2l')   set(ha,'XDir','reverse')%   dx=-dx;   yi=-yi;   temp=param.trough_fill;   param.trough_fill=param.peak_fill;   param.peak_fill=temp;elseif strcmpi(param.direction,'l2r')   set(ha,'XDir','normal')else   error(['Keyword for plot direction is wrong (',param.direction,')'])endif strcmpi(param.figure_only,'yes')   returnend%    Check if there are NaNs in the seismic dataif isfield(seismic,'null')   isnull=1;else   isnull=0;end%    Plot dataif strcmpi(param.quality,'draft')   ue4i_seismic_plot(times,yi,xi,isnull,param);else   ue4i_seismic_plot_ps(times,yi,xi,isnull,param)endboxif strcmpi(param.tracking,'yes')%	Add cursor tracking   [dummy,xinfo]=s_gh(seismic,param.annotation);   y=linspace(seismic.first,seismic.last,nsamp);   yinfo=info4time(seismic);   initiate_3d_tracking4seismic(seismic.traces,xi,y,xinfo,yinfo,{'amplitude','','Amplitude'},ha)end%	Add annotation of horizontal axisif ~annotlog   v=axis;   xil=xi(indices);   annol=annotation(indices);   add_xaxis([xil',annol'],'',{'location','top'});end%	Add label of horizontal axis%       (if 5 or more traces or annotation other than trace number)if ~strcmpi(param.annotation,'trace_no') | ntr > 4    xtext=s_gd(seismic,param.annotation);    hunits=s_gu(seismic,param.annotation);    if ~isempty(xtext) & ~strcmpi(xtext,'not available')       if ~isempty(hunits) & ~strcmpi(hunits,'n/a')          xtext=[xtext,' (',hunits,')'];       end       hxlabel=xlabel(xtext);       v=get(hxlabel,'Position'); % Preserve position of x-axis label    else       hxlabel=xlabel('');    endelse    set(gca,'XTickLabel',[])endif uniform & (~strcmpi(param.annotation,'trace_no') | ntr > 4)%  set(gca,'XTickLabel',[]);	 % Delete original annotation but                                 % keep x-axis label at original position   try                              set(hxlabel,'Position',v);       catch   endendgrid on; set(ha,'gridlinestyle','-','box','on','xgrid','off')%  Titleif ~isempty(param.title)   if iscell(param.title)		% Handle multi-line titles      mytitle(param.title{1})   else      mytitle(param.title)   endendif strcmpi(param.figure,'new')   timeStampendzoom offhold off%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function ue4i_seismic_plot(times,traces,location,isnull,param)% Function plot seismic traces at horizontal locations controlled by location%% INPUT% times   vector of y-coordinates for the trace samples% traces  matrix of trace samples% location  vector of x-coordinates of the traces% isnull  logical variable; true if the traces have null values.% param   structure with input parametersdt=times(2)-times(1);times_orig=times;ntr=size(traces,2);hpeak=zeros(1,ntr);htrough=zeros(1,ntr);hwiggle=zeros(1,ntr);for ii=1:ntr   skip=0;           if isnull      idx=find(~isnan(traces(:,ii)));      if isempty(idx)         skip=1;      else         y=traces(idx,ii);         times=times_orig(idx);      end   else      y=traces(:,ii);   end              if ~skip   chg=find(y(1:end-1).*y(2:end) < 0);   x_zero=abs(y(chg)./(y(chg+1)-y(chg)))*dt+times(chg);   [x_data,idx]=sort([times(1);times;x_zero;times(end)]);   y_data=[0;y;zeros(length(x_zero),1);0];   y_data=y_data(idx);   pos=find(y_data >= 0);   hpeak(ii)=fill(y_data(pos)+location(ii),x_data(pos),'w');    neg=find(y_data <= 0);   htrough(ii)=fill(y_data(neg)+location(ii),x_data(neg),'w');   if ~isempty(param.trough_fill) | ~isempty(param.peak_fill)      plot([location(ii),location(ii)],[times(2),times(end)],'w-')   end      hwiggle(ii)=line(y_data(2:end-1)+location(ii),x_data(2:end-1),'Color',param.wiggle, ...      'EraseMode','none','LineWidth',param.wiggle_width);              endendset(htrough,'EdgeColor','none','FaceColor',param.trough_fill)set(hpeak,'EdgeColor','none','FaceColor',param.peak_fill)bool=ishandle(hpeak);hpeak=hpeak(bool);htrough=htrough(bool);hwiggle=hwiggle(bool);set(hpeak,'FaceColor',param.peak_fill)set(htrough,'FaceColor',param.trough_fill)handles.hpeak=hpeak;handles.htrough=htrough;handles.hwiggle=hwiggle;haxes=gca;userdata=get(haxes,'UserData');userdata.trace_handles=handles;set(haxes,'UserData',userdata)%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%function ue4i_seismic_plot_ps(times,traces,location,isnull,param)% Function plot seismic traces at horizontal locations controlled by location% Avoids vertical lines from top to bottom on some PS interpreters% Much slower than ue_seismic_plotdt=times(2)-times(1);times_orig=times;ipeak=0;itrough=0;[nsamp,ntr]=size(traces);hpeak=zeros(1,nsamp*ntr);htrough=zeros(1,nsamp*ntr);hwiggle=zeros(1,ntr);for ii=1:ntr   skip=0;           if isnull      idx=find(~isnan(traces(:,ii)));      if isempty(idx)         skip=1;      else         y=traces(idx,ii);         times=times_orig(idx);      end   else      y=traces(:,ii);   end              if ~skip   chg=find(y(1:end-1).*y(2:end) < 0);   x_zero=abs(y(chg)./(y(chg+1)-y(chg))).*dt+times(chg);   [x_data,idx]=sort([times(1);times;x_zero;times(end)]);   y_data=[0;y;zeros(length(x_zero),1);0];   y_data=y_data(idx);   pos=find(y_data >= 0);     % y_pos=y_data(pos); pos=find(y_data >= 0);   ind1=find(diff(pos) > 1);    ind=[pos(1),reshape([pos(ind1)';pos(ind1+1)'],1,[]),pos(end)];   % x_pos=x_data(pos);   for kk=1:2:length(ind)-1;      index=ind(kk):ind(kk+1);      ipeak=ipeak+1;      hpeak(ipeak)=fill(y_data(index)+location(ii),x_data(index),'w', ...             'erasemode','none','EdgeColor','none');    end   neg=find(y_data <= 0);   ind=find(diff(neg) > 1);    ind=[neg(1),reshape([neg(ind)';neg(ind+1)'],1,[]),neg(end)];   % y_neg=y_data(neg);   % x_neg=x_data(neg);   for kk=1:2:length(ind)-1       itrough=itrough+1;       index=ind(kk):ind(kk+1);       htrough(itrough)=fill(y_data(index)+location(ii),x_data(index),'w', ...             'erasemode','none','EdgeColor','none');    end   hwiggle(ii)=line(y_data(2:end-1)+location(ii),x_data(2:end-1),'Color',param.wiggle, ...        'erasemode','none','LineWidth',param.wiggle_width);               endendhpeak=hpeak(1:ipeak);htrough=htrough(1:itrough);hwiggle=hwiggle(ishandle(hwiggle));set(hpeak,'FaceColor',param.peak_fill)set(htrough,'FaceColor',param.trough_fill)handles.hpeak=hpeak;handles.htrough=htrough;handles.hwiggle=hwiggle;haxes=gca;userdata=get(haxes,'UserData');userdata.trace_handles=handles;set(haxes,'UserData',userdata)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -