📄 s_new_time.m
字号:
function seismic=s_new_time(seismic,old_new,varargin)% Function creates new "time" scale (e.g. for time-to-depth conversion: in% this case the first column would be times and the second columns the % corresponding depths).% Trace samples with times earlier than old_new(1) or later than old_new(end)% are discarded.%% Written by: E. R., July 24, 2001% Last updated: July 25, 2001; keyword 'units' added%% seismic=s_new_time(seismic,old_new,varargin)% INPUT% seismic seismic structure% old_new two-column matrix; the first column represents old (original) times,% the second column the corresponding new times% New times corresponding to old times not in array "old_new" are% determined by linear interpolation % varargin one or more cell arrays; the first element of each cell array is % a keyword string, the following arguments contains a parameter(s). % Accepted keywords are:% 'interpolation' type of interpolation used to convert to the new% "time" scale. Possible values are those strings allowed% for input argument "method" of MATLAB function "interp1"% (e.g. 'linear', 'cubic', 'spline')% Default: {'interpolation','cubic'}% 'step' sample interval of output data set% Default: {'step',seismic.step)% 'units' units of measurement of the new "time" scale% Default: {'units',seismic.units}% OUTPUT% seismic seismic structure with new "time" scaleglobal S4Mif ~isstruct(seismic) error(' First input dataset must be a seismic structure')end% Set defaults for input parametersparam.interpolation='cubic';param.step=seismic.step;param.units=seismic.units;% Decode input arguments, modify defaults if necessaryparam=assign_input(param,varargin);newt=interp1q(old_new(:,1),old_new(:,2),(seismic.first:seismic.step:seismic.last)');idx=find(~isnan(newt));newt=newt(idx);seismic.first=ceil(newt(1)/param.step)*param.step;seismic.last=floor(newt(end)/param.step)*param.step;seismic.step=param.step;seismic.units=param.units;seismic.traces=interp1(newt,seismic.traces(idx,:), ... (seismic.first:seismic.step:seismic.last)',param.interpolation);% Check for null valuesidx=find(isnan(seismic.traces));if isempty(idx) if isfield(seismic,'null') seismic=rmfield(seismic,'null'); endelse if ~isfield(seismic,'null') seismic.null=NaN; endend% Append history fieldif S4M.history & isfield(seismic,'history') seismic=s_history(seismic,'append',param.interpolation);end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -