📄 s_wplot.m
字号:
function aux=s_wplot(seismic,varargin)% Plot seismic data in wiggle-trace, variable-area form. By default, positive % deflections are filled black.% See also: s_cplot, s_plot%% Written by: E. R.: April 15, 2000% Last updated: March 30, 2008: Save handles of traces in output structure "aux"% %% aux=s_wplot(seismic,varargin)% INPUT% seismic seismic structure% varargin one or more cell arrays; the first element of each cell array % is a keyword, the other elements are parameters. % Presently, keywords are:% 'annotation' 2-element or 3-element cell array. Defines a header % mnemonic whose values are used to annotate the horizontal axis. % Default: {'annotation','trace_no'}% 'aindex' annotation index; used to specify which traces to annotate with the% value of the header selected via keyword annotation.% Example {'aindex',10:10:1000} every tenth trace annotated, % starting with trace 10% Default: {'aindex',[]} use Matlab-default annotation% 'background' background color; possible options are the standard % colors (or their abbreviations) and gray.% Default: {'background','white'}% 'deflection' trace deflection in units of trace spacing. % Default: {'deflection',1.5}% 'direction' 2-element cell array defining plot direction. Possible values are: % left-to-right, 'l2r', and right-to-left, 'r2l'.% Default: {'direction','l2r')% 'figure_only' specifies if only a figure window should be created; possible values:% 'yes', 'no'. % Default: {'figure_only','no'}% 'figure' Specifies if new figure needs to be created or if the seismic % traces should be plotted to the current axes of an existing % figure. Possible values are 'new' and any other string. % Default: {'figure','new'} % 'interpol' 2-element cell array which specifies how data should be interpolated in time.% Possible values are 'linear', 'cubic', and 'v5cubic'. % 'cubic' - piecewise cubic Hermite interpolation% 'v5cubic' - the cubic interpolation from MATLAB 5, which does not% extrapolate and uses 'spline' if X is not equally spaced.% Default: {'interpol','v5cubic'}% 'orient' Plot orientation. Possible values are: 'portrait' and 'landscape'% Default: {'orient','landscape'} for more than 10 traces% {'orient','portrait'} for 10 or fewer traces% 'peak_fill' 2-element cell array which specifies color of peak fill. Possible values are % all permissible colors or the empty string. In the latter case peaks are not filled. % Default: {'peak_fill','black'}% 'pixels' 2-element cell array. Minimum number of interpolation points to use for display. % The greater the number the smoother the display if 'interpol' is 'cubic'. % Default: {'pixels',500}% 'polarity' 2-element cell array. Possible values are 1 and -1;% Default: {'polarity',1}% 'quality' 2-element cell array. Possible values are 'draft' and 'high'% 'draft' quality (default) is faster and intended for screen and b/w hard copies; % 'high' quality is for color copies (there is no difference between% 'draft' and 'high' quality for screen displays and b/w copies).% Default: {'quality','draft'}% 'scale' 2-element cell array which specifies if traces should be scaled individually.% Possible values are 'yes', 'no', or the actual scale. This may be a scalar or a% vector whose number of elements is equal to the number of traces.% separation. The scale actually used must be obtained by specifying the output% argument "aux".% Default: {'scale','no'}% 'spacing' 2-element cell array which specifies if traces should be % equidistant ('equal') or non uniformly ('nonequal') spaced; % in the latter case the header mnemonic used for annotation defines % the trace-to-trace separation.% Default: {'spacing','equal'}% 'times' 2-element or 3-element cell array % {'times',vector of first and last time to plot} or ('times',first,last}. % Default: {'times',seismic.first,seismic.last} which is% equivalent to {'times',[seismic.first,seismic.last]}% 'title' 2-element cell array consisting of the keyword 'title' and a title string;% no title is plotted if the title string is empty.% Default: {'title',seismic.name)% 'traces' 2-element or 3-element cell array. The second element can be an array of % trace numbers or it can be a string. If it is a string it can be a header % mnemonic or it can contain a logical expression involving header values to % include. A "pseudo-header" 'trace_no' can also be used.% If the second element is a string containing a header mnemonic there must % be a third element containing a vector of values. (see "s_select")% Default: {'traces',[]} which is equivalent to % {'traces',1:ntr} where ntr denotes the number of traces in the % input data set (ntr = size(seismic.traces,2))% 'tracking' track cursor position; possible values are 'yes', 'no', and ''.% In the latter case a tracking button is created if the the% seismic is plotted in a new figure. Otherwise it is not.% Default: {'tracking',''}% 'trough_fill' 2-element cell array which specifies color of trough fill. % Possible values are all permissible colors or the empty string. % In the latter case troughs are not filled. % Default: {'trough_fill',''}% 'wiggle' 2-element cell array which specifies color of wiggles. % Possible values are all permissible colors or the empty string. % In the latter case wiggles are not plotted. % Default: {'wiggle','black'}% 'wiggle_width' line width of wiggles;% Default: {'wiggle_width',0.5}%% OUTPUT% aux optional structure with scale factor(s) used (required if seismic% data are to be plotted with the same scaling in different plots)% 'scale' field with scale factor(s) used % 'figure_handle' handle of the figure with the plot %% EXAMPLE% seismic=s_data;% aux=s_wplot(seismic,{'annotation','cdp'},{'direction','r2l'});% UPDATE HISTORY% September 1, 2007: bug fix in cursor tracking% November 27, 2007: streamlined scale factor computation and annotation% February 5, 2008: Fix bug in handling of certain null valuesglobal S4Mif ~istype(seismic,'seismic') if isnumeric(seismic) seismic=s_convert(seismic,1,1); seismic.units='Samples'; else error('First input argument must be a seismic dataset or a matrix.') endendrun_presets_if_needed%% Set default valuesparam.annotation='trace_no';param.aindex=[];param.background='white';param.deflection=1.5;param.direction='l2r';param.doublebuffer='on';param.figure='new';param.figure_only='no';param.first=1;param.inc=[];param.interactive=1;param.interpol='v5cubic';param.orient=[];param.peak_fill='black';param.pixels=800;param.polarity=1;param.quality='draft';param.scale='no';param.spacing='equal';param.times=[];param.title=strrep(seismic.name,'_','\_');param.traces=[];param.tracking='';param.trough_fill='';param.wiggle='black';param.wiggle_width=0.5;% Replace defaults by actual input argumentsparam=assign_input(param,varargin,'s_wplot');%% Select requested subset of seismic dataif ~isempty(param.traces) || ~isempty(param.times) seismic=select_subset_no1(seismic,param);end%% Check seismic input data to see if they can be plotted[nsamp,ntr]=size(seismic.traces);if nargout > 0 aux=[];endif nsamp <= 1 disp([' Only one sample per trace; "s_wplot" did not plot the dataset "',seismic.name,'".']) returnelseif ntr == 0 disp([' Alert from "s_wplot": Data set "',seismic.name,'" has no traces to plot.']) returnend%% Set indices of trace headers for annotationif ntr < 21 && isempty(param.aindex) if ntr < 11 param.aindex=1:ntr; else param.aindex=1:2:ntr; endendif isempty(param.aindex) indices=1:max([round(ntr/7),1]):ntr;else indices=param.aindex(param.aindex > 0 & param.aindex <= ntr);end%% Handle special cases of color for seismic tracesif strcmp(param.peak_fill,'gray') param.peak_fill=[0.6,0.6,0.6];elseif strcmp(param.peak_fill,'none') param.peak_fill=[];endif strcmp(param.trough_fill,'gray') param.trough_fill=[0.6,0.6,0.6];elseif strcmp(param.trough_fill,'none') param.trough_fill=[];endif strcmp(param.wiggle,'gray') param.wiggle=[0.6,0.6,0.6];elseif strcmp(param.wiggle,'none') param.wiggle=[];endannotation=s_gh(seismic,param.annotation);if ntr == 1 || isempty(annotation) uniform=true; annotlog=false;else ddd=diff(annotation); annotlog=(max(ddd)==min(ddd)) && ddd(1) ~= 0 && isempty(param.aindex); if annotlog uniform=false; else if strcmp(param.spacing,'equal') uniform=true; % Uniform trace-to-trace distance else uniform=false; end endend% Change polarity if requestedif param.polarity < 0 seismic.traces=-seismic.traces;end% Check if there are null values in the seismic dataisnullvalue=isnull(seismic);% Interpolate data if necessaryif (strcmpi(param.interpol,'v5cubic') || strcmpi(param.interpol,'cubic')) && nsamp < param.pixels npix=round(param.pixels/(nsamp-1))*(nsamp-1); times=linspace(seismic.first,seismic.last,npix)'; times_orig=linspace(seismic.first,seismic.last,nsamp)'; times=unique([times;times_orig]); if isnullvalue && S4M.matlab_version >= 7 % Turn off warnings caused by NaN's in seismic traces% warning('off','MATLAB:interp1:NaNinY') yi=nan_interp1(times_orig,seismic.traces,times,param.interpol,0); for ii=1:ntr % If necessary, replace last NaN at the top and % first NaN at the bottom by zero to terminate % patches idx=find(~isnan(yi(:,ii))); if ~isempty(idx) if idx(1) > 1 if (yi(idx(1),ii) > 0 && ~isempty(param.peak_fill)) || ... (yi(idx(1),ii) < 0 && ~isempty(param.trough_fill)) yi(idx(1)-1,ii)=0; end end if idx(end) < nsamp if (yi(idx(end,ii)) > 0 && ~isempty(param.peak_fill)) || ... (yi(idx(end,ii)) < 0 && ~isempty(param.trough_fill)) yi(idx(end)+1,ii)=0; end end end end % warning('on','MATLAB:interp1:NaNinY') else yi=interp1(seismic.first:seismic.step:seismic.last,seismic.traces,times,param.interpol); 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; dx=1; % Trace-to-trace separationelse xi=annotation; dx=(max(xi)-min(xi))/(ntr-1+eps); % Trace-to-trace separationend% Scale dataif ischar(param.scale) if strcmpi(param.scale,'yes') scale=(dx*param.deflection)./(trace_max+eps)'; for ii=1:ntr yi(:,ii)=yi(:,ii)*scale(ii); end else scale=dx*param.deflection/(max(trace_max)+eps); yi=yi*scale; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -