提交 52d4ee57 authored 作者: Heyaoyao's avatar Heyaoyao

Initial commit

上级
%% This shell aims to calculate the H-Kappa
% Written by Hyy on 2025/5/22
clear;clc;close all
%%
sacdir = "D:\YB\yunnan2\F0_6.0_waterlevel_0.01\3_selected_stationset_v2";
dirlist = string(ls(fullfile(sacdir, 'NK*')));
fig_savedir = "D:\YB\yunnan2\F0_6.0_waterlevel_0.01\HKAPPA_ANALYSIS";
if ~exist(fig_savedir, 'dir')
mkdir(fig_savedir);
end
np = 1000;
mod = 'ak135'; thmax = 15;
em = refinemodel(set_vmodel_v2(mod), thmax);
labelsize = 28;
tickfontsize = 24;
labelsize2 = 24;
tickfontsize2 = 20;
textsize = 16;
color = [0,0,0;0.7451,0.7451,0.7451];% black and grey
color_moveout = [1,0,0;0.7451,0.7451,0.7451];%red and grey
color_stack = [0,0,1;0.7451,0.7451,0.7451];
amp_scale = 1;
timewin = [-30 60];
delta = 0.1;
time = (timewin(1):delta:timewin(2))';
t0 = -timewin(1);
rayp0 = 0.07;
fl = 0.02;
fh = 1;
order = 2;
dH = 0.1;
dk = 0.01;
H = 30:dH:60;
k = 1.5:dk:2.0;
vp = 6.3;
ref_k = 1.73;
weight = [3/5 1/5 1/5];
% bootstrap
B = 500; % bootstrap times,要做 500 次重采样来估计s0的波动
% ind_4 = find(time == 4);
% ind_8 = find(time == 8);
% ind_16 = find(time == 16);
% ind_20 = find(time == 20);
% ind_22 = find(time == 22);
% ind_26 = find(time == 26);
% flag_H = 1;
% H_results_savepath = fullfile(fig_savedir, "mohodepth.txt");
% if ~exist(H_results_savepath, 'file')
% flag_H = 0;
% fid1 = fopen(H_results_savepath, 'w');
% fprintf(fid1, '# Longitude Latitude MohoDepth \n');
% end
% flag_k = 1;
% k_results_savepath = fullfile(fig_savedir, "kappa.txt");
% if ~exist(k_results_savepath, 'file')
% flag_k = 0;
% fid2 = fopen(k_results_savepath, 'w');
% fprintf(fid2, '# Longitude Latitude Kappa \n');
% end
% flag_stloc = 1;
% station_loc_savepath = "D:\YB\YB-geospatial\china-geospatial-data-GB2312\YB_station.txt";
% if ~exist(station_loc_savepath, 'file')
% flag_stloc = 0;
% fid3 = fopen(station_loc_savepath, 'w');
% fprintf(fid3, '# Longitude Latitude \n');
% end
% H_uncertainty_savepath = fullfile(fig_savedir, "H_uncertainty.txt");
% fid4 = fopen(H_uncertainty_savepath, 'w');
% fprintf(fid4, '# Longitude Latitude H_uncertainty \n');
%
% K_uncertainty_savepath = fullfile(fig_savedir, "K_uncertainty.txt");
% fid5 = fopen(K_uncertainty_savepath, 'w');
% fprintf(fid5, '# Longitude Latitude K_uncertainty \n');
for i = 27%:length(dirlist)
clear RF rayp RF_moveout distance
% tempfile = dir(fullfile(sacdir, dirlist(i)));
% if length(tempfile) <= 2
% continue
% end
% sacfiles = string(ls(fullfile(inputdir, stdir(profile_NO(i)), '*R.sac.PF.Decon')));
fid = fopen(fullfile(sacdir, dirlist(i), 'list_r_Decon_PF.txt'), 'r');
if fid == -1
continue
end
list_r_Decon_PF = textscan(fid, '%s %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f %f %f \n', ...
'Commentstyle', 'shell', 'HeaderLines', 1);
fclose(fid);
if isempty(list_r_Decon_PF{1})
continue
end
sacfiles = list_r_Decon_PF{1};
rayp = list_r_Decon_PF{8};
distance = list_r_Decon_PF{15};
for j = 1:length(sacfiles)
[hdr, data] = irdsac(fullfile(sacdir, dirlist(i), sacfiles(j)));
RF(:,j) = filtering(data, hdr.delta, fl, fh, order);
RF(:,j) = RF(:,j)/max(abs(RF(:,j)));
header{j} = hdr;
% [RAYP, taup, Xp]= y_get_p_P_Pdiff (hdr.evdp, np, em);
% dd = Xp*180/pi;
% dist = hdr.gcarc;
% rayp_i = interp1db(dist, dd, RAYP);
% rayp_i = rayp_i/6371; % slowness unit: s/km
% rayp(j) = rayp_i;
% distance(j) = dist;
end
[S, xi] = y_Hkappa_modified_v2( RF, time, rayp, H, k, vp, weight );
[ind_k, ind_H] = find(S == max(max(S)));
theo_k = sum(k(ind_k))/length(k(ind_k));
theo_H = sum(H(ind_H))/length(H(ind_H));
[X, Y] = meshgrid(H, k);
[X_new, Y_new] = meshgrid(linspace(H(1), H(end), 2001), linspace(k(1), k(end), 251));
Hk_new = interp2(X,Y,S, X_new,Y_new, 'linear');
%% calculate uncertainty
B = 300; % bootstrap次数
dH = 0.1; dK = 0.01; % 你的网格步长(按你实际的)
Hgrid = (theo_H-3):dH:(theo_H+3); % 只在最优点±3 km内重搜
Kgrid = (theo_k-0.08):dK:(theo_k+0.08);% 只在最优点±0.08内重搜
Ne = size(RF,2);
Hbest = nan(B,1);
Kbest = nan(B,1);
for b = 1:B
idx = randi(Ne, Ne, 1); % 有放回抽样事件
RFb = RF(:,idx);
pb = rayp(idx);
% 计算这一轮的能量面 Sb
Sb = y_Hkappa_modified_v2( RFb, time, pb, Hgrid, Kgrid, vp, weight );
% 找最大值
[~, idm] = max(Sb(:));
[iK, iH] = ind2sub(size(Sb), idm);
Hbest(b) = Hgrid(iH);
Kbest(b) = Kgrid(iK);
end
% 1-sigma(标准差)
sigmaH = std(Hbest, 'omitnan');
sigmaK = std(Kbest, 'omitnan');
fprintf('Bootstrap param std: sigmaH=%.2f km, sigmaK=%.3f\n', sigmaH, sigmaK);
% fprintf(fid4, '%0.4f %0.4f %0.1f \n', hdr.stlo, hdr.stla, sigmaH);
% fprintf(fid5, '%0.4f %0.4f %0.2f \n', hdr.stlo, hdr.stla, sigmaK);
% if flag_H == 0
% fprintf(fid1, '%0.4f %0.4f %0.1f \n', hdr.stlo, hdr.stla, theo_H);
% else
% fid_temple_1_r = fopen(H_results_savepath, 'r');
% H_result = textscan(fid_temple_1_r, '%f %f %f \n', 'CommentStyle', 'shell', 'HeaderLines', 1);
% H_result_lo = H_result{1};
% H_result_la = H_result{2};
% H_result_H = H_result{3};
% H_result_H(i) = theo_H;
% fid_temple_1_w = fopen(H_results_savepath, 'w');
% fprintf(fid_temple_1_w, '# Longitude Latitude MohoDepth \n');
% for i_result = 1:length(H_result_H)
% fprintf(fid_temple_1_w, '%f %f %f \n', H_result_lo(i_result), H_result_la(i_result), H_result_H(i_result));
% end
% fclose(fid_temple_1_r);
% fclose(fid_temple_1_w);
% end
% if flag_k == 0
% fprintf(fid2, '%0.4f %0.4f %0.2f \n', hdr.stlo, hdr.stla, theo_k);
% else
% fid_temple_2_r = fopen(k_results_savepath, 'r');
% k_result = textscan(fid_temple_2_r, '%f %f %f \n', 'CommentStyle', 'shell', 'HeaderLines', 1);
% k_result_lo = k_result{1};
% k_result_la = k_result{2};
% k_result_k = k_result{3};
% k_result_k(i) = theo_k;
% fid_temple_2_w = fopen(k_results_savepath, 'w');
% fprintf(fid_temple_2_w, '# Longitude Latitude Kappa \n');
% for i_result = 1:length(k_result_k)
% fprintf(fid_temple_2_w, '%f %f %f \n', k_result_lo(i_result), k_result_la(i_result), k_result_k(i_result));
% end
% fclose(fid_temple_2_r);
% fclose(fid_temple_2_w);
% end
% if flag_stloc == 0
% fprintf(fid3, '%0.4f %0.4f \n', hdr.stlo, hdr.stla);
% end
%% H-k figure
figure(1)
pcolor(X_new, Y_new, Hk_new);
colormap('parula')
shading interp
colorbar
% caxis([max(max(Hk_new))/2 max(max(Hk_new))])
hold on
plot([H(1), H(end)], [theo_k, theo_k], 'k-', 'LineWidth', 2);
hold on
plot([theo_H, theo_H], [k(1), k(end)], 'k-', 'LineWidth', 2);
set(gca, 'FontSize', tickfontsize)
xlabel('H (km)','FontSize', labelsize)
ylabel('Vp/Vs', 'FontSize', labelsize)
plus_minus = char(177);
title(sprintf('%s: H = %0.1f %c %0.1f, Vp/Vs = %0.2f %c %0.2f ', dirlist(i), theo_H, plus_minus, sigmaH, theo_k, plus_minus, sigmaK), 'FontSize', labelsize+4);
size_fig1 = [-1642 46 1141 1035];
set(gcf, 'OuterPosition', size_fig1)
fig_name_Hk = strcat('HKappa_', deblank(dirlist(i)),'.png');
% saveas(gcf,fullfile(fig_savedir, fig_name_Hk));
exportgraphics(gcf,fullfile(fig_savedir, fig_name_Hk), 'BackgroundColor', 'white', 'Resolution',600);
[rayp_ascend, ind] = sort(rayp);
%% RFs' waveform figure and moveout figure
figure(2)
vs = vp/theo_k;
rayp1 = sum(rayp)/length(rayp);
% theoretical arrival time
partP = sqrt(vp^(-2) - rayp1^2);
partS = sqrt(vs^(-2) - rayp1^2);
tPs = theo_H*(partS-partP);
tPpPs = theo_H*(partP+partS);
tPpSs = 2*theo_H*partS;
for ii = 1:size(RF,2)
% phase = 'PpPs';
% data_moveout = h_moveout_phases(RF(:,ind(ii)), header{ind(ii)}, rayp(ind(ii)), rayp0, vp, vp/ref_k, phase);
i_RF = RF(:,ind(ii));
% Ps_NMO = h_moveout_phases(i_RF, header{ind(ii)}, rayp(ind(ii)), rayp0, vp, ref_k, 'Ps')';
% PpPs_NMO = h_moveout_phases(i_RF, header{ind(ii)}, rayp(ind(ii)), rayp0, vp, ref_k, 'PpPs')';
% PsPs_NMO = h_moveout_phases(i_RF, header{ind(ii)}, rayp(ind(ii)), rayp0, vp, ref_k, 'PsPs')';
% NMO_RF = [i_RF(1:ind_4); Ps_NMO(ind_4+1:ind_8); i_RF(ind_8+1:ind_16); PpPs_NMO(ind_16+1:ind_20); i_RF(ind_20+1:ind_22); PsPs_NMO(ind_22+1:ind_26); i_RF(ind_26+1:end)];
% single_wig7(time, NMO_RF, ii, color_moveout(1,:), color_moveout(2,:), 'yes', 'yes');
% hold on
single_wig7(time, RF(:,ind(ii)), ii, color(1,:), color(2,:), 'yes', 'yes');
hold on
end
plot([0 0], [0.5 ii+1.5]*amp_scale, 'r', 'LineWidth', 2)
hold on
plot([tPs tPs], [0.5 ii+1.5]*amp_scale, 'r', 'LineWidth', 2)
hold on
plot([tPpPs tPpPs], [0.5 ii+1.5]*amp_scale, 'r', 'LineWidth', 2)
hold on
plot([tPpSs tPpSs], [0.5 ii+1.5]*amp_scale, 'r', 'LineWidth', 2)
hold on
text(0.5, (ii+1.5)*amp_scale, 'P','FontSize', textsize, 'Color', 'r')
hold on
text(tPs+0.5, (ii+1.5)*amp_scale, 'Ps','FontSize', textsize, 'Color', 'r')
hold on
text(tPpPs+0.5, (ii+1.5)*amp_scale, 'PpPs','FontSize', textsize, 'Color', 'r')
hold on
text(tPpSs+0.5, (ii+1.5)*amp_scale, 'PsPs+PpSs','FontSize', textsize, 'Color', 'r')
ytick = 1:2:ii;
yticklabel = string(ytick);
set(gca, 'YTick', ytick);
set(gca, 'YTickLabel',yticklabel);
set(gca, 'FontSize', tickfontsize2)
xlabel('Time after P (s)', 'FontSize', labelsize2)
ylabel('Trace', 'FontSize', labelsize2)
title(sprintf('%s: T_{Ps}=%0.1f,T_{PpPs}=%0.1f,T_{PsPs}=%0.1f', char(dirlist(i)), tPs, tPpPs, tPpSs), 'FontSize', labelsize2)
axis auto
box on
xlim([-2 30])
ylim([0 ii+2])
size_fig = [-1136 132 821 898];
set(gcf, 'OuterPosition', size_fig)
fig_name_RF_moveout = strcat('RFs_', deblank(dirlist(i)), '.png');
exportgraphics(gcf,fullfile(fig_savedir, fig_name_RF_moveout), 'BackgroundColor', 'white', 'Resolution',600);
close all
end
% fclose(fid1);
% fclose(fid2);
% fclose(fid3);
function [ RFt, rms, nwl ] = decon_waterlevel_matlab_v3_trueamp( numer, denom, tshift, dt, waterlevel, gaussa )
% calculate frequency
NT = length(numer);
Fs = 1/dt;
% fny = Fs/2; % nyquist
df = Fs/NT;
Q = ceil((NT+1)/2);
freq = df*(0:1:Q-1);
w = 2*pi*[freq,-fliplr(freq(2:NT-Q+1))];
w = reshape(w,[],1);
numer = reshape(numer,[],1);
denom = reshape(denom,[],1);
numerf = fft( numer );
denomf = fft( denom );
% denominator
Df = denomf.* conj(denomf);
dmax = max( real( Df ) );
% add water level correction
phi1 = waterlevel*dmax; % water level
nwl = length( find(Df<phi1) ); % number corrected
% Df( real(Df)<phi1 ) = phi1;
Df = Df + phi1;
% numerator
Nf = numerf .* conj(denomf);
% compute RF
RFf = Nf ./ Df;
rff_nofilter_hyy = abs(RFf);
% compute predicted numerator
pnumerf = RFf.*denomf;
% add gauss filter
gfilter = exp(-w.*w/(4*gaussa*gaussa))/dt*sqrt(pi)/gaussa;
RFf = RFf .* gfilter;
rff_filter_hyy = abs(RFf);
% add phase shift
RFf = RFf .* exp(-1i*w*tshift);
RFt = (1+waterlevel)*real(ifft(RFf));
% RFt = real(ifft(RFf));
% %% temp plot by hyy
% % figure
% fontsize = 32;
% tickfontsize = 28;
% t = (0:NT-1)*dt;
% figa = plot(t, RFt, 'LineWidth', 2);
% set(gca, 'Fontsize', tickfontsize)
% xlabel('Time (sec)', 'FontSize', tickfontsize)
% ylabel('Amplitude', 'FontSize', tickfontsize)
% title('RFs calculated by different ways', 'FontSize', fontsize)
% grid on
% box on
% compute the fit
pnumer=real(ifft(pnumerf));
rms = sum( (pnumer - numer).^2 )/sum(numer.^2);
% %% temp plot by hyy
% nf_hyy = abs(Nf);
% df_hyy = abs(Df);
% t = (0:NT-1)*dt;
% fontsize = 22;
% tickfontsize = 18;
% smooth_scale = 5;
% figure
% xi1 = linspace(min(freq), max(freq), numel(freq)*smooth_scale);
% yi1 = interp1(freq, nf_hyy(1:Q), xi1, 'pchip');
% semilogx(xi1, yi1, 'k', 'LineWidth', 2)
% hold on
% xi2 = linspace(min(freq), max(freq), numel(freq)*smooth_scale);
% yi2 = interp1(freq, df_hyy(1:Q), xi2, 'pchip');
% semilogx(xi2, yi2, 'r', 'LineWidth', 1)
% legend('Nf','Df')
% set(gca, 'Fontsize', tickfontsize)
% title(strcat('Nf and Df (waterlevel = ',num2str(waterlevel),')'), 'FontSize', fontsize);
% ylabel('Amplitude', 'FontSize', tickfontsize);
% xlabel('frequency (Hz)', 'FontSize', tickfontsize)
% xlim([freq(2) freq(end)]);
% grid on
% box on
%
% figure
% subplot(3,1,1)
% xi3 = linspace(min(freq), max(freq), numel(freq)*smooth_scale);
% yi3 = interp1(freq, rff_nofilter_hyy(1:Q), xi3, 'pchip');
% semilogx(xi3, yi3, 'k', 'LineWidth', 2);
% set(gca, 'Fontsize', tickfontsize)
% title(strcat('RFf (waterlevel = ', num2str(waterlevel), ')'), 'FontSize', fontsize);
% ylabel('Amplitude', 'FontSize', tickfontsize);
% xlabel('Frequency (Hz)', 'FontSize', tickfontsize)
% xlim([freq(2) freq(end)]);
% grid on
% box on
%
% subplot(3,1,2)
% xi4 = linspace(min(freq), max(freq), numel(freq)*smooth_scale);
% yi4 = interp1(freq, rff_filter_hyy(1:Q), xi4, 'pchip');
% semilogx(xi4, yi4, 'k', 'LineWidth', 2);
% set(gca, 'Fontsize', tickfontsize)
% title(strcat('RFf (With guass filter(factor = ', num2str(gaussa), '), waterlevel = ', num2str(waterlevel), ')'), 'FontSize', fontsize);
% ylabel('Amplitude', 'FontSize', tickfontsize);
% xlabel('Frequency (Hz)', 'FontSize', tickfontsize)
% xlim([freq(2) freq(end)]);
% grid on
% box on
%
% subplot(3,1,3)
% % single_wig7(t, RFt, 'k', 'LineWidth', 2);
% single_wig7(t, RFt, 0,'blue',[0.82745 0.82745 0.82745],'yes', 'yes')
% set(gca, 'Fontsize', tickfontsize)
% title(strcat('RFt (waterlevel = ', num2str(waterlevel), ')'), 'FontSize', fontsize);
% ylabel('Amplitude', 'FontSize', tickfontsize);
% xlabel('Time (sec)', 'FontSize', tickfontsize)
% axis tight
% grid on
% box on
% qqq =1;
end
% function [ dat ] = filtering (data, delta, lowf, highf)
% %FILTERING Summary of this function goes here
% % Detailed explanation goes here
%
% % this program is aimed to filter data using a 2-pass butterworth
% % filter. You can also use other filters by changing butter to others
%
%
% fs = 1/delta;
% nyq = fs/2;
% [B,A] = butter(order,[lowf/nyq highf/nyq]);
% dat = filtfilt(B,A,data);
% usage:
% dat = filtering(data, delta, lowf, highf, order) - bandpass filter
% dat = filtering(data, delta, lowf, highf) - bandpass filter
% dat = filtering(data, delta, lowf, 'low', order) - lowpass filter
% dat = filtering(data, delta, lowf, 'low') - lowpass filter
% change 'low' to 'high' for highpass filter
% else no filtering
function [ dat ] = filtering (varargin)
% default butterworth order
order = 2;
if nargin <=3
% fprintf('Number of input parameters less than 4!\n');
return;
else
data = varargin{1};
dat = data;
delta = varargin{2};
f1 = varargin{3};
if ~isnumeric(delta) || ~isnumeric(f1)
% fprintf('Delta or f1 not numeric!\n No filtering\n');
return;
end
fs = 1/delta;
nyq = fs/2;
if nargin == 4
if strcmpi(varargin{4},'high') || strcmpi(varargin{4},'hp')
[B,A] = butter(order,f1/nyq,'high');
elseif strcmpi(varargin{4},'low') || strcmpi(varargin{4},'lp')
[B,A] = butter(order,f1/nyq,'low');
elseif isnumeric(varargin{4})
f2 = varargin{4};
[B,A] = butter(order,[f1/nyq f2/nyq]);
else
% fprintf('Check input para!\n');
return;
end
elseif nargin >=5
if (strcmpi(varargin{4},'high') || strcmpi(varargin{4},'hp')) && isnumeric(varargin{5})
order = varargin{5};
[B,A] = butter(order,f1/nyq,'high');
elseif (strcmpi(varargin{4},'low') || strcmpi(varargin{4},'lp')) && isnumeric(varargin{5})
order = varargin{5};
[B,A] = butter(order,f1/nyq,'low');
elseif isnumeric(varargin{4}) && isnumeric(varargin{5})
f2 = varargin{4};
order = varargin{5};
[B,A] = butter(order,[f1/nyq f2/nyq]);
else
% fprintf('Check input para!\n');
return;
end
end
data = detrend(data);
% taper = tukeywin(length(data),0.1);
% data = data.*reshape(taper,size(data,1),size(data,2));
dat = filtfilt(B,A,double(data));
end
\ No newline at end of file
function [ ] = imksac( sachd, sacdata, sacfile )
% usage: imksac( sachd, sacdata, sacfile )
% imksac generates a binary sac file 'sacfile' from 'sachd' and 'sacdata'.
% sachd is a structure of the sac header which can be generated from an
% exist sac file by irdsac or created by inewsachd(need some change
% before used for imksac, e.g. delta must be set)
% author: taokai@pku.edu.cn (any suggestion is appreciated)
%%
% Default byte-order
% endian = 'big' big-endian byte order (e.g., UNIX)
% = 'lil' little-endian byte order (e.g., LINUX)
endian = 'lil';
if strcmp(endian,'big')
fid = fopen(sacfile,'w','ieee-be');
elseif strcmp(endian,'lil')
fid = fopen(sacfile,'w','ieee-le');
end
%% define empty sac head
h = zeros(302,1);
h(1:110) = -12345*ones(110,1);
h(106) = 1; % leven is set to true
%% read in sachd
% check the sachd
if sachd.leven ~= 1
warning('sachd.leven(equidistant sampling) is not set to 1, changed to 1 !');
sachd.leven = 1;
end
if sachd.delta == -12345
error('sachd.delta is not set!');
end
if length(sacdata) ~= sachd.npts
warning('sachd.npts is not set, changed to the length of sacdata!');
sachd.npts = length(sacdata);
end
% if sachd.b == -12345
% warning('sachd.b is not set, changed to 0 !');
% sachd.b = 0;
% end
ending_time = sachd.b+(sachd.npts-1)*sachd.delta;
if sachd.b ~= -12345 && ~(abs(sachd.e-ending_time) < sachd.delta)
warning('sachd.e is not correctly set, changed accordingly!');
sachd.e = ending_time;
end
if sachd.iftype ~= 1 % time series file
warning('sachd.iftype is set to 1!');
sachd.iftype = 1;
end
if sachd.nvhdr ~= 6 % version number
warning('sachd.nvhdr is set to 6!');
sachd.nvhdr = 6;
end
if (sachd.evla ~= -12345 && sachd.evlo ~= -12345 && sachd.stla ~= -12345 && sachd.stlo ~= -12345)
[sachd.gcarc, sachd.az] = distance(sachd.evla,sachd.evlo,sachd.stla,sachd.stlo);
sachd.baz = azimuth(sachd.stla,sachd.stlo,sachd.evla,sachd.evlo);
sachd.dist = sachd.gcarc * 111.195;
% [ sachd.gcarc, sachd.az, sachd.baz ] = edist(sachd.evla,sachd.evlo,sachd.stla,sachd.stlo);
% sachd.dist = sachd.gcarc * 111.195;
%
% [sachd.dist, sachd.az, sachd.baz, sachd.gcarc] = ical(sachd.stla,sachd.stlo,sachd.evla,sachd.evlo);
end
% read real header variables
%---------------------------------------------------------------------------
h(1) = sachd.delta ;
h(2) = sachd.depmin ;
h(3) = sachd.depmax ;
h(4) = sachd.scale ;
h(5) = sachd.odelta ;
h(6) = sachd.b ;
h(7) = sachd.e ;
h(8) = sachd.o ;
h(9) = sachd.a ;
h(11) = sachd.t0 ;
h(12) = sachd.t1 ;
h(13) = sachd.t2 ;
h(14) = sachd.t3 ;
h(15) = sachd.t4 ;
h(16) = sachd.t5 ;
h(17) = sachd.t6 ;
h(18) = sachd.t7 ;
h(19) = sachd.t8 ;
h(20) = sachd.t9 ;
h(21) = sachd.f ;
h(22) = sachd.resp0 ;
h(23) = sachd.resp1 ;
h(24) = sachd.resp2 ;
h(25) = sachd.resp3 ;
h(26) = sachd.resp4 ;
h(27) = sachd.resp5 ;
h(28) = sachd.resp6 ;
h(29) = sachd.resp7 ;
h(30) = sachd.resp8 ;
h(31) = sachd.resp9 ;
h(32) = sachd.stla ;
h(33) = sachd.stlo ;
h(34) = sachd.stel ;
h(35) = sachd.stdp ;
h(36) = sachd.evla ;
h(37) = sachd.evlo ;
h(38) = sachd.evel ;
h(39) = sachd.evdp ;
h(40) = sachd.mag ;
h(41) = sachd.user0 ;
h(42) = sachd.user1 ;
h(43) = sachd.user2 ;
h(44) = sachd.user3 ;
h(45) = sachd.user4 ;
h(46) = sachd.user5 ;
h(47) = sachd.user6 ;
h(48) = sachd.user7 ;
h(49) = sachd.user8 ;
h(50) = sachd.user9 ;
h(51) = sachd.dist ;
h(52) = sachd.az ;
h(53) = sachd.baz ;
h(54) = sachd.gcarc ;
h(57) = sachd.depmen ;
h(58) = sachd.cmpaz ;
h(59) = sachd.cmpinc ;
h(60) = sachd.xminimum ;
h(61) = sachd.xmaximum ;
h(62) = sachd.yminimum ;
h(63) = sachd.ymaximum ;
% read integer header variables
%---------------------------------------------------------------------------
h(71) = sachd.nzyear ;
h(72) = sachd.nzjday ;
h(73) = sachd.nzhour ;
h(74) = sachd.nzmin ;
h(75) = sachd.nzsec ;
h(76) = sachd.nzmsec ;
h(77) = sachd.nvhdr ;
h(78) = sachd.norid ;
h(79) = sachd.nevid ;
h(80) = sachd.npts ;
h(82) = sachd.nwfid ;
h(83) = sachd.nxsize ;
h(84) = sachd.nysize ;
h(86) = sachd.iftype ;
h(87) = sachd.idep ;
h(88) = sachd.iztype ;
h(90) = sachd.iinst ;
h(91) = sachd.istreg ;
h(92) = sachd.ievreg ;
h(93) = sachd.ievtyp ;
h(94) = sachd.iqual ;
h(95) = sachd.isynth ;
h(96) = sachd.imagtyp ;
h(97) = sachd.imagsrc ;
%read logical header variables
%---------------------------------------------------------------------------
h(106) = sachd.leven ;
h(107) = sachd.lpspol ;
h(108) = sachd.lovrok ;
h(109) = sachd.lcalda ;
%read character header variables
%---------------------------------------------------------------------------
h(111:118) = istrchoppad(sachd.kstnm ,8);
h(119:134) = istrchoppad(sachd.kevnm ,16);
h(135:142) = istrchoppad(sachd.khole ,8);
h(143:150) = istrchoppad(sachd.ko ,8);
h(151:158) = istrchoppad(sachd.ka ,8);
h(159:166) = istrchoppad(sachd.kt0 ,8);
h(167:174) = istrchoppad(sachd.kt1 ,8);
h(175:182) = istrchoppad(sachd.kt2 ,8);
h(183:190) = istrchoppad(sachd.kt3 ,8);
h(191:198) = istrchoppad(sachd.kt4 ,8);
h(199:206) = istrchoppad(sachd.kt5 ,8);
h(207:214) = istrchoppad(sachd.kt6 ,8);
h(215:222) = istrchoppad(sachd.kt7 ,8);
h(223:230) = istrchoppad(sachd.kt8 ,8);
h(231:238) = istrchoppad(sachd.kt9 ,8);
h(239:246) = istrchoppad(sachd.kf ,8);
h(247:254) = istrchoppad(sachd.kuser0 ,8);
h(255:262) = istrchoppad(sachd.kuser1 ,8);
h(263:270) = istrchoppad(sachd.kuser2 ,8);
h(271:278) = istrchoppad(sachd.kcmpnm ,8);
h(279:286) = istrchoppad(sachd.knetwk ,8);
h(287:294) = istrchoppad(sachd.kdatrd ,8);
h(295:302) = istrchoppad(sachd.kinst ,8);
%% write sac head and amplitude data
% write single precision real header variables:
%---------------------------------------------------------------------------
for i=1:70
fwrite(fid,h(i),'single');
end
% write single precision integer header variables:
%---------------------------------------------------------------------------
for i=71:105
fwrite(fid,h(i),'int32');
end
% write logical header variables
%---------------------------------------------------------------------------
for i=106:110
fwrite(fid,h(i),'int32');
end
% write character header variables
%---------------------------------------------------------------------------
for i=111:302
fwrite(fid,h(i),'char');
end
% write out amplitudes
%--------------------------------------------------------------------------
fwrite(fid,sacdata,'single');
fclose(fid);
%% nested funcitons
function [ strout ] = istrchoppad( strin, strlen )
%STRCHOPPAD Summary of this function goes here
% Detailed explanation goes here
nstrin = length(strin);
if nstrin < strlen
strout = strin;
strout(nstrin+1:strlen) = 0;
else
strout = strin(1:strlen);
end
end
% function [dist, az, baz, gcarc] = ical(stla,stlo,evla,evlo)
% R_earth = 6371.009; % mean earth's radius(km)
% radperdeg = pi/180;
% degperrad = 180/pi;
% n_st = [cos(stlo*radperdeg), sin(stlo*radperdeg), sin(stla*radperdeg)];
% n_ev = [cos(evlo*radperdeg), sin(evlo*radperdeg), sin(evla*radperdeg)];
% n_north = [0 0 1];
%
% % calculate epidistance:
% dist = acos(dot(n_st,n_ev))*R_earth;
% % calculate great circle arc:
% gcarc = acos(dot(n_st,n_ev))*degperrad;
% % calculate azimuth:
% evrotnorth = cross(n_ev,n_north);
% evrotst = cross(n_ev,n_st);
% az_pi = acos(dot(evrotnorth,evrotst));
% if dot(cross(evrotnorth,n_ev),evrotst)>0
% az = az_pi*degperrad;
% else
% az = (2*pi-az_pi)*degperrad;
% end
% % calculate back-azimuth:
% strotnorth = cross(n_st,n_north);
% strotev = cross(n_st,n_ev);
% baz_pi = acos(dot(strotnorth,strotev));
% if dot(cross(strotnorth,n_st),strotev)>0
% baz = baz_pi*degperrad;
% else
% baz = (2*pi-baz_pi)*degperrad;
% end
% end
end
function [ sachd, sacdata ] = irdsac( sacfile )
% irdsac generates a structure 'sachd' and a vector 'sacdata' from an
% exist sac file.
%
% 'sachd' contains the following elements
% -------------------------------------------------------------------------
%delta stla evla data(10) iftype dist xminimum trcLen
%b stlo evlo label(3) idep az xmaximum scale
%e stel evel iztype baz yminimum
%o stdp evdp iinst gcarc ymaximum
%a cmpaz nzyear istreg norid
%t0 cmpinc nzjday ievreg nevid
%t1 kstnm nzhour ievtyp nwfid
%t2 kcmpnm nzmin iqual nxsize
%t3 knetwk nzsec isynth nysize
%t4 nzmsec
%t5 kevnm
%t6 mag
%t7 imagtyp
%t8 imagsrc
%t9
%f
%k0
%ka
%kt1
%kt2
%kt3
%kt4
%kt5
%kt6
%kt7
%kt8
%kt9
%kf
%response is a 10-element array, and trcLen is a scalar.
%
% author: taokai@pku.edu.cn (any suggestion is appreciated)
%%
% Default byte-order
% endian = 'big' big-endian byte order (e.g., UNIX)
% = 'lil' little-endian byte order (e.g., LINUX)
sachd = []; sacdata = [];
fid_lil = fopen(sacfile,'r','ieee-le');
fid_big = fopen(sacfile,'r','ieee-be');
if fid_lil < 0 && fid_big < 0
return;
end
% check header version == 6 and the byte order
%--------------------------------------------------------------------------
% If the header version is not NVHDR == 6 then the sacfile is likely of the
% opposite byte order. This will give h(77) some ridiculously large
% number. NVHDR can also be 4 or 5. In this case it is an old SAC file
% and rsac cannot read this file in. To correct, read the SAC file into
% the newest verson of SAC and w over.
if((1+fseek(fid_lil,304,'bof'))&&(1+fseek(fid_big,304,'bof')))
nvhdr_lil = fread(fid_lil,1,'int32');
nvhdr_big = fread(fid_big,1,'int32');
else
return;
% message = 'Failed to read sac file!';
% error(message)
end
if nvhdr_lil == 6
fid = fid_lil;
% disp('little-endian byte order!')
status = fseek(fid,0,'bof');
fclose(fid_big);
elseif nvhdr_big == 6
fid = fid_big;
disp('big-endian byte order!')
status = fseek(fid,0,'bof');
fclose(fid_lil);
else
return;
% message = ['nvhdr ~= 6: nvhdr_lil = ',num2str(nvhdr_lil),', nvhdr_big = ',num2str(nvhdr_big)];
% error(message)
end
%% read in sac header
h = zeros(302,1);
% read in 70*(single precision real) header variables:
h(1:70) = fread(fid,70,'single');
% read in 35*(single precision interger) header variables:
h(71:105) = fread(fid,35,'int32');
% read in 4*logical(single precision interger) header variables
h(106:110) = fread(fid,5,'int32');
% read in 192*char header variables
h(111:302) = fread(fid,192,'char');
% add header signature for testing files for SAC format
%---------------------------------------------------------------------------
% h(303) = 84;
% h(304) = 65;
% h(305) = 79;
%% write the structured sachd
% read real header variables
%---------------------------------------------------------------------------
sachd.delta = h(1);
sachd.depmin = h(2);
sachd.depmax = h(3);
sachd.scale = h(4);
sachd.odelta = h(5);
sachd.b = h(6);
sachd.e = h(7);
sachd.o = h(8);
sachd.a = h(9);
sachd.t0 = h(11);
sachd.t1 = h(12);
sachd.t2 = h(13);
sachd.t3 = h(14);
sachd.t4 = h(15);
sachd.t5 = h(16);
sachd.t6 = h(17);
sachd.t7 = h(18);
sachd.t8 = h(19);
sachd.t9 = h(20);
sachd.f = h(21);
sachd.resp0 = h(22);
sachd.resp1 = h(23);
sachd.resp2 = h(24);
sachd.resp3 = h(25);
sachd.resp4 = h(26);
sachd.resp5 = h(27);
sachd.resp6 = h(28);
sachd.resp7 = h(29);
sachd.resp8 = h(30);
sachd.resp9 = h(31);
sachd.stla = h(32);
sachd.stlo = h(33);
sachd.stel = h(34);
sachd.stdp = h(35);
sachd.evla = h(36);
sachd.evlo = h(37);
sachd.evel = h(38);
sachd.evdp = h(39);
sachd.mag = h(40);
sachd.user0 = h(41);
sachd.user1 = h(42);
sachd.user2 = h(43);
sachd.user3 = h(44);
sachd.user4 = h(45);
sachd.user5 = h(46);
sachd.user6 = h(47);
sachd.user7 = h(48);
sachd.user8 = h(49);
sachd.user9 = h(50);
sachd.dist = h(51);
sachd.az = h(52);
sachd.baz = h(53);
sachd.gcarc = h(54);
sachd.depmen = h(57);
sachd.cmpaz = h(58);
sachd.cmpinc = h(59);
sachd.xminimum = h(60);
sachd.xmaximum = h(61);
sachd.yminimum = h(62);
sachd.ymaximum = h(63);
% read integer header variables
%---------------------------------------------------------------------------
sachd.nzyear = round(h(71));
sachd.nzjday = round(h(72));
sachd.nzhour = round(h(73));
sachd.nzmin = round(h(74));
sachd.nzsec = round(h(75));
sachd.nzmsec = round(h(76));
sachd.nvhdr = round(h(77));
sachd.norid = round(h(78));
sachd.nevid = round(h(79));
sachd.npts = round(h(80));
sachd.nwfid = round(h(82));
sachd.nxsize = round(h(83));
sachd.nysize = round(h(84));
sachd.iftype = round(h(86));
sachd.idep = round(h(87));
sachd.iztype = round(h(88));
sachd.iinst = round(h(90));
sachd.istreg = round(h(91));
sachd.ievreg = round(h(92));
sachd.ievtyp = round(h(93));
sachd.iqual = round(h(94));
sachd.isynth = round(h(95));
sachd.imagtyp = round(h(96));
sachd.imagsrc = round(h(97));
%read logical header variables
%---------------------------------------------------------------------------
sachd.leven = round(h(106));
sachd.lpspol = round(h(107));
sachd.lovrok = round(h(108));
sachd.lcalda = round(h(109));
%read character header variables
%---------------------------------------------------------------------------
sachd.kstnm = char(h(111:118));
sachd.kevnm = char(h(119:134));
sachd.khole = char(h(135:142));
sachd.ko = char(h(143:150));
sachd.ka = char(h(151:158));
sachd.kt0 = char(h(159:166));
sachd.kt1 = char(h(167:174));
sachd.kt2 = char(h(175:182));
sachd.kt3 = char(h(183:190));
sachd.kt4 = char(h(191:198));
sachd.kt5 = char(h(199:206));
sachd.kt6 = char(h(207:214));
sachd.kt7 = char(h(215:222));
sachd.kt8 = char(h(223:230));
sachd.kt9 = char(h(231:238));
sachd.kf = char(h(239:246));
sachd.kuser0 = char(h(247:254));
sachd.kuser1 = char(h(255:262));
sachd.kuser2 = char(h(263:270));
sachd.kcmpnm = char(h(271:278));
sachd.knetwk = char(h(279:286));
sachd.kdatrd = char(h(287:294));
sachd.kinst = char(h(295:302));
%% read in amplitudes
if nargout == 2
sacdata = fread(fid,sachd.npts,'single');
end
fclose(fid);
end
\ No newline at end of file
function h = single_wig7(time,data,offset,upcolor,dncolor,isupfill,isdnfill )
%SINGLE_WIG2 Summary of this function goes here
% Detailed explanation goes here
dark = [0 0 0];
gray = [0.7 0.7 0.7];
if nargin <= 3
upcolor = dark;
dncolor = gray;
isupfill = 'yes';
isdnfill = 'yes';
elseif nargin == 4
dncolor = gray;
isupfill = 'yes';
isdnfill = 'yes';
end
data = reshape(data,[],1);
time = reshape(time,[],1);
[t0,d0] = curveintersect(time, data, time, zeros(size(time)));
datatmp = [zeros(size(d0));data];
[timetmp,indx] = sort([t0;time],'ascend');
datatmp = datatmp(indx);
timetmp = [timetmp(1);timetmp;timetmp(end)];
datatmp = [0;datatmp;0];
dataup = datatmp;
dataup(find(dataup<0)) = 0;
dataup(1) = -max(abs(dataup))*1e-4;
dataup(end) = -max(abs(dataup))*1e-4;
datadn = datatmp;
datadn(find(datadn>0)) = 0;
datadn(1) = max(abs(datadn))*1e-4;
datadn(end) = max(abs(datadn))*1e-4;
if strcmpi(isupfill,'yes') || strcmpi(isupfill,'y')
h(1) = patch(timetmp,dataup + offset,upcolor,'Facecolor',upcolor,'Edgecolor','none','LineWidth',0.1);
else
h(1) = plot(timetmp,dataup+offset,'color',upcolor,'Linewidth',0.1);
end
if strcmpi(isdnfill,'yes') || strcmpi(isdnfill,'y')
h(2) = patch(timetmp,datadn + offset,dncolor,'Facecolor',dncolor,'Edgecolor','none','LineWidth',0.1);
else
h(2) = plot(timetmp,datadn+offset,'color',dncolor,'Linewidth',0.1);
end
end
%% This shell convert the waveform from time domain to depth domain
%% Written by Heyaoyao on 2025/7/4
function [H, amp] = time2depth(time, data, tshift, vp, k, rayp, minH, maxH)
vs = vp/k;
delta = time(2)-time(1);
time_cut = time(round(tshift/delta)+1:end);
data_cut = data(round(tshift/delta)+1:end);
nt = length(time_cut);
H_temp = zeros(1, nt);
amp_temp = zeros(1, nt);
for ii = 1:nt
diff_t = time_cut(ii);
H_temp(ii) = diff_t/(sqrt(vs^(-2)-rayp^2)-sqrt(vp^(-2)-rayp^2));
amp_temp(ii) = data_cut(ii);
end
H = linspace(minH, maxH, 2501);
amp = interp1(H_temp, amp_temp, H, 'linear');
% def time_to_depth_Ps(t0,time,data,rayp,arfa,beta,hmin=0,hmax=600):
% dt = time[1] - time[0]
% nt = len(time)
% it0 = int((t0-time[0]) /dt + 1 )
% index = np.arange(it0,nt)
% H = []
% amp = []
% for i,tnumber in enumerate(index):
% thist = (tnumber - it0) *dt
% H.append(thist/(np.sqrt(beta**-2 - rayp**2)-np.sqrt(arfa**-2 - rayp**2)))
% amp.append(data[tnumber])
% H,amp = np.array(H),np.array(amp)
% newH = np.linspace(0,600,6000)
% f = interp1d(H,amp,kind='linear',bounds_error=False,fill_value=0)
% newamp = f(newH)
% return newH,newamp
end
\ No newline at end of file
function [ Hk ] = y_Hkappa_modified( RF, time, rayp, H, k, vp, weight )
% H-kappa search for P-receiver functions
% Chunquan Yu, @MIT-EAPS, 06/13
% RF: nt * ntrace matrix
% time: nt * 1 vector
% rayp: ntrace * 1 vector
% % H k range
% H = 20:0.1:80; % crustal thickness for searching
% k = 1.5:0.01:2.0; % kappa = Vp/Vs for searching
% vp = 6.3; % assumed crustal P-wave speed
% % weight for 3 phases: Ps, PpPs, PpSs+PsPs
% weight = [2/5 2/5 1/5];
% normalize data
for i = 1:size(RF,2)
RF(:,i) = RF(:,i)/(max(RF(:,i))-min(RF(:,i)));
end
delta = time(2)-time(1);
r1 = zeros(length(k),length(H));
r2 = zeros(length(k),length(H));
r3 = zeros(length(k),length(H));
for m = 1:length(H)
for n = 1:length(k)
% if H(m) < 40 || k(n) < 1.6 || k(n) > 1.9 || H(m) > 49
% continue
% end
vs = vp/k(n);
for i = 1:size(RF,2) % loop for all receiver functions
partP = sqrt(vp^(-2) - rayp(i)^2);
partS = sqrt(vs^(-2) - rayp(i)^2);
tPs = H(m)*(partS-partP);
tPpPs = H(m)*(partP+partS);
tPpSs = 2*H(m)*partS;
% if tPs < 5 || tPpPs < 18 || tPpPs > 18.5
% continue
% end
RFi = RF(:,i);
r1(n,m) = r1(n,m) + RFi(round((tPs-time(1))/delta) + 1);
r2(n,m) = r2(n,m) + RFi(round((tPpPs-time(1))/delta) + 1);
r3(n,m) = r3(n,m) + RFi(round((tPpSs-time(1))/delta) + 1);
end
end
end
% % Hk, r1, r2 should be positive, and r3 should be negative, otherwise
% % setting them to be zero
% r1(find(r1<0))=0;
% r2(find(r2<0))=0;
% r3(find(r3>0))=0;
Hk = weight(1)*r1 + weight(2)*r2 - weight(3)*r3;
% Hk(find(Hk<0)) = 0;
end
%% calculating the receiver function in time domain by Yaoyao He, 2024/7/6
clear; clc; close all;
% %% convert event set to station set
% evset_dir = "D:\SUSTech businesse\observational_seismology\XE_work\sac_eventset";
% staset_dir = "D:\SUSTech businesse\observational_seismology\XE_work\sac_stationset";
% if ~exist(staset_dir, 'dir')
% mkdir(staset_dir);
% end
% evlist = string(ls(fullfile(evset_dir,'2*')));
% for i = 1:length(evlist)
% % list_r_Decon_PF = textscan(fopen(fullfile(evset_dir, evlist(i), 'list_r_Decon_PF.txt'), 'r'),...
% % '%s %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f\n', 'HeaderLines', 1);
% % decon_filename = char(list_r_Decon_PF{1});
% saclist = char(ls(fullfile(evset_dir,evlist(i),'*.SAC')));
% for j = 1:size(saclist, 1)
% parts = split(saclist(j,:), '.');
% sta_no = parts{2};
% if ~exist(fullfile(staset_dir,sta_no),'dir')
% mkdir(fullfile(staset_dir,sta_no));
% end
% copyfile(fullfile(evset_dir,evlist(i),saclist(j, :)), fullfile(staset_dir,sta_no));
% end
% end
%% show the raw data
% I/O dir
sacdir= "D:\YB\yunnan2\F0_6.0_waterlevel_0.01\3_selected_stationset_v2";
stlist = string(ls(fullfile(sacdir,'NK*')));
outputdir = fullfile(fileparts(sacdir), '3_selected_stationset_v2_multiband_RFs');
if ~exist(outputdir, 'dir')
mkdir(outputdir);
end
% basic parameters
new_delta = 0.1;
timewin = [-30 60];
time_cut = reshape(timewin(1):new_delta:timewin(2),[],1);
fl = 0.02; fh = 1; order = 2;
np = 1000;
mod = 'ak135'; thmax = 15;
em = refinemodel(set_vmodel_v2(mod), thmax);
R = 6371;
% decon parameters
deconwin = [-30 60];
time_decon = reshape(deconwin(1):new_delta:deconwin(2),[],1);
F0 = 6; TDEL = 30; itmax = 100; minerr = 10^(-2); waterlevel = 0.001 ;
sourcedir = "D:\YB\yunnan2\F0_6.0_waterlevel_0.01\2_z_seis_cutdata_180s_1st_selection";
for i = 1:length(stlist)
fid = fopen(fullfile(sacdir, stlist(i), 'list_r_Decon_PF.txt'), 'r');
if fid == -1
continue
end
list_r_Decon_PF = textscan(fid, '%s %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f %f %f \n', ...
'Commentstyle', 'shell', 'HeaderLines', 1);
fclose(fid);
if isempty(list_r_Decon_PF{1})
continue
end
if ~exist(fullfile(outputdir, stlist(i)), 'dir')
mkdir(fullfile(outputdir, stlist(i)));
end
sacfiles = list_r_Decon_PF{1};
num_file = length(sacfiles);
for j = 1:num_file
parts = string(split(sacfiles(j), '.'));
file_R = strcat(parts(1), '.', parts(2), '.', parts(3), '.', parts(4), '.', 'R', '.', parts(6));
file_Z = strcat(parts(1), '.', parts(2), '.', parts(3), '.', parts(4), '.', 'Z', '.', parts(6));
[sachdr, data_raw_r] = irdsac(fullfile(sourcedir, strcat(parts(3), '.', parts(4)), file_R));
[sachdz, data_raw_z] = irdsac(fullfile(sourcedir, strcat(parts(3), '.', parts(4)), file_Z));
stla = sachdr.stla; stlo = sachdr.stlo;
evla = sachdr.evla; evlo = sachdr.evlo; evdp = sachdr.evdp;
% modified by Chunquan Yu (2019/11/09) to take into account
[dist,baz] = distance(stla,stlo, evla,evlo, [6378.137*180/pi/6371 0.0818191908426215]);
[rayp, taup, Xp]= y_get_p_P_Pdiff (evdp, np, em);
tt = taup + rayp.*Xp;
dd = Xp*180/pi;
theo_tt = interp1db(dist, dd,tt);
time_raw = [0:sachdr.npts-1]' * sachdr.delta + sachdr.b - sachdr.o - theo_tt;
data_cut_r = interp1(time_raw, data_raw_r, time_cut, 'linear', nan);
data_cut_z = interp1(time_raw, data_raw_z, time_cut, 'linear', nan);
% filtered data
data_cut_r_filter = filtering(data_cut_r, new_delta, fl, fh, order);
data_cut_z_filter = filtering(data_cut_z, new_delta, fl, fh, order);
%% Decon part
data_decon_r = interp1(time_cut, data_cut_r, time_decon, 'linear', 0);
data_decon_z = interp1(time_cut, data_cut_z, time_decon, 'linear', 0);
data_decon_r = detrend(data_decon_r) .* tukeywin(length(time_decon),new_delta);
data_decon_z = detrend(data_decon_z) .* tukeywin(length(time_decon),new_delta);
% Frequency domian
[eqr, rms_r, nwl_r] = decon_waterlevel_matlab_v3_trueamp( data_decon_r, data_decon_z, TDEL, new_delta, waterlevel, F0);
[aftn, rms_z, nwl_z] = decon_waterlevel_matlab_v3_trueamp( data_decon_z, data_decon_z, TDEL, new_delta, waterlevel, F0);
newsachdr = sachdr;
newsachdr.a = sachdr.b + theo_tt;
newsachdr.b = newsachdr.a + timewin(1);
newsachdr.e = newsachdr.a + timewin(2);
newsachdr.npts = length(time_decon);
newsachdr.delta = new_delta;
newsachdz = sachdz;
newsachdz.a = sachdz.b + theo_tt;
newsachdz.b = newsachdz.a + timewin(1);
newsachdz.e = newsachdz.a + timewin(2);
newsachdz.npts = length(time_decon);
newsachdz.delta = new_delta;
deconR_filename = strcat('gaussa_', num2str(F0), '_', file_R, '.PF.Decon');
deconZ_filename = strcat('gaussa_', num2str(F0), '_', file_Z, '.PF.Decon');
imksac(newsachdr, eqr, fullfile(outputdir, stlist(i), deconR_filename));
% imksac(newsachdz, aftn, fullfile(outputdir, stalist(i), deconZ_filename));
end
end
NK.S0001.20210530Z133329.37T.R.sac.PF.Decon
NK.S0001.20210603Z100958.29T.R.sac.PF.Decon
NK.S0001.20210604Z134513.27T.R.sac.PF.Decon
NK.S0001.20210605Z225738.23T.R.sac.PF.Decon
NK.S0001.20210608Z050032.30T.R.sac.PF.Decon
NK.S0001.20210608Z105637.58T.R.sac.PF.Decon
NK.S0001.20210608Z152901.05T.R.sac.PF.Decon
NK.S0001.20210611Z022343.04T.R.sac.PF.Decon
NK.S0001.20210613Z092759.72T.R.sac.PF.Decon
NK.S0001.20210614Z024459.14T.R.sac.PF.Decon
NK.S0001.20210616Z044307.45T.R.sac.PF.Decon
NK.S0001.20210620Z110824.06T.R.sac.PF.Decon
NK.S0001.20210621Z221416.82T.R.sac.PF.Decon
NK.S0001.20210624Z022456.11T.R.sac.PF.Decon
NK.S0001.20210624Z144956.44T.R.sac.PF.Decon
NK.S0001.20210703Z170427.76T.R.sac.PF.Decon
NK.S0001.20210704Z161847.79T.R.sac.PF.Decon
NK.S0001.20210709Z133110.14T.R.sac.PF.Decon
NK.S0001.20210710Z004358.95T.R.sac.PF.Decon
NK.S0001.20210710Z005110.81T.R.sac.PF.Decon
NK.S0001.20210718Z000935.15T.R.sac.PF.Decon
NK.S0001.20210718Z143419.28T.R.sac.PF.Decon
NK.S0001.20210719Z152231.00T.R.sac.PF.Decon
NK.S0001.20210719Z203049.87T.R.sac.PF.Decon
NK.S0001.20210719Z230210.92T.R.sac.PF.Decon
NK.S0001.20210721Z142559.55T.R.sac.PF.Decon
NK.S0001.20210721Z174402.86T.R.sac.PF.Decon
NK.S0001.20210726Z035205.18T.R.sac.PF.Decon
NK.S0001.20210726Z120910.01T.R.sac.PF.Decon
NK.S0001.20210729Z061549.19T.R.sac.PF.Decon
NK.S0001.20210729Z203244.85T.R.sac.PF.Decon
NK.S0001.20210801Z043127.10T.R.sac.PF.Decon
NK.S0001.20210802Z050121.98T.R.sac.PF.Decon
NK.S0001.20210802Z150425.06T.R.sac.PF.Decon
NK.S0001.20210803Z203340.53T.R.sac.PF.Decon
NK.S0001.20210803Z204316.36T.R.sac.PF.Decon
NK.S0001.20210803Z221057.60T.R.sac.PF.Decon
NK.S0001.20210804Z025623.23T.R.sac.PF.Decon
NK.S0001.20210804Z044022.78T.R.sac.PF.Decon
NK.S0001.20210804Z055507.92T.R.sac.PF.Decon
NK.S0001.20210805Z050607.47T.R.sac.PF.Decon
NK.S0001.20210806Z110818.99T.R.sac.PF.Decon
NK.S0001.20210807Z145130.90T.R.sac.PF.Decon
NK.S0001.20210810Z212151.79T.R.sac.PF.Decon
NK.S0001.20210811Z150257.46T.R.sac.PF.Decon
NK.S0001.20210811Z174612.73T.R.sac.PF.Decon
NK.S0001.20210812Z155334.33T.R.sac.PF.Decon
NK.S0001.20210814Z012745.16T.R.sac.PF.Decon
NK.S0001.20210814Z115743.45T.R.sac.PF.Decon
NK.S0001.20210818Z101005.24T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0001.20210608Z105637.58T.R.sac.PF.Decon 582.757055 0.000000 582.757055 1 S0001 NK 0.062247 25.587839 99.890030 2.564900 -5.245700 151.316498 134.000000 58.605788 304.168399 114.080331 1.000000 1.000000
NK.S0001.20210719Z152231.00T.R.sac.PF.Decon 564.792477 0.000000 564.792477 1 S0001 NK 0.065775 25.587839 99.890030 2.564900 -3.360000 146.869995 1.000000 53.888271 305.158040 115.263242 1.000000 1.000000
NK.S0001.20210721Z142559.55T.R.sac.PF.Decon 563.195382 0.000000 563.195382 1 S0001 NK 0.065932 25.587839 99.890030 2.564900 -3.340000 146.591202 0.000000 53.649172 305.279949 115.442410 1.000000 1.000000
NK.S0001.20210812Z155334.33T.R.sac.PF.Decon 385.315972 0.000000 385.315972 1 S0001 NK 0.078748 25.587839 99.890030 2.564900 6.206400 127.156502 49.799999 32.441300 309.503417 121.790786 1.000000 1.000000
NK.S0001.20210811Z174612.73T.R.sac.PF.Decon 380.182576 0.000000 380.182576 1 S0001 NK 0.078918 25.587839 99.890030 2.564900 6.442000 126.612297 51.299999 31.874705 309.705282 122.100244 1.000000 1.000000
NK.S0001.20210802Z050121.98T.R.sac.PF.Decon 492.777671 0.000000 492.777671 1 S0001 NK 0.071785 25.587839 99.890030 2.564900 -4.503200 134.009903 10.000000 44.657918 313.857674 127.200690 1.000000 1.000000
NK.S0001.20210604Z134513.27T.R.sac.PF.Decon 419.582391 0.000000 419.582391 1 S0001 NK 0.077128 25.587839 99.890030 2.564900 0.340000 126.289703 8.600000 35.800042 316.624452 130.450297 1.000000 1.000000
NK.S0001.20210616Z044307.45T.R.sac.PF.Decon 462.245898 0.000000 462.245898 1 S0001 NK 0.074181 25.587839 99.890030 2.564900 -3.558000 129.523804 7.000000 40.840774 316.908082 130.927709 1.000000 1.000000
NK.S0001.20210611Z022343.04T.R.sac.PF.Decon 403.715027 0.000000 403.715027 1 S0001 NK 0.077579 25.587839 99.890030 2.564900 0.051900 124.297600 60.099998 34.672379 318.980568 133.345470 1.000000 1.000000
NK.S0001.20210608Z050032.30T.R.sac.PF.Decon 384.525026 0.000000 384.525026 1 S0001 NK 0.077403 25.587839 99.890030 2.564900 0.452600 123.647797 196.800003 33.945468 319.316662 133.756152 1.000000 1.000000
NK.S0001.20210709Z133110.14T.R.sac.PF.Decon 392.780661 0.000000 392.780661 1 S0001 NK 0.077563 25.587839 99.890030 2.564900 0.131200 123.636597 129.800003 34.181129 319.636171 134.142217 1.000000 1.000000
NK.S0001.20210726Z035205.18T.R.sac.PF.Decon 399.555214 0.000000 399.555214 1 S0001 NK 0.078137 25.587839 99.890030 2.564900 -0.713900 121.981903 26.900000 33.791129 322.337394 137.392146 1.000000 1.000000
NK.S0001.20210726Z120910.01T.R.sac.PF.Decon 399.280243 0.000000 399.280243 1 S0001 NK 0.078119 25.587839 99.890030 2.564900 -0.732600 121.993202 30.400000 33.812761 322.340845 137.396475 1.000000 1.000000
NK.S0001.20210703Z170427.76T.R.sac.PF.Decon 470.770438 0.000000 470.770438 1 S0001 NK 0.073504 25.587839 99.890030 2.564900 14.101900 56.839298 10.000000 41.932992 67.327380 262.660311 1.000000 1.000000
NK.S0001.20210614Z024459.14T.R.sac.PF.Decon 533.059179 0.000000 533.059179 1 S0001 NK 0.068415 25.587839 99.890030 2.564900 12.821300 48.600899 10.000000 49.826451 67.272047 265.337197 1.000000 1.000000
NK.S0001.20210801Z043127.10T.R.sac.PF.Decon 620.652688 0.000000 620.652688 1 S0001 NK 0.060376 25.587839 99.890030 2.564900 36.360001 27.049999 10.000000 62.057555 77.508092 299.282072 1.000000 1.000000
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
NK.S0002.20210528Z232104.11T.R.sac.PF.Decon
NK.S0002.20210529Z010241.08T.R.sac.PF.Decon
NK.S0002.20210530Z133329.37T.R.sac.PF.Decon
NK.S0002.20210603Z100958.29T.R.sac.PF.Decon
NK.S0002.20210604Z134513.27T.R.sac.PF.Decon
NK.S0002.20210605Z225738.23T.R.sac.PF.Decon
NK.S0002.20210608Z050032.30T.R.sac.PF.Decon
NK.S0002.20210608Z105637.58T.R.sac.PF.Decon
NK.S0002.20210608Z152901.05T.R.sac.PF.Decon
NK.S0002.20210611Z022343.04T.R.sac.PF.Decon
NK.S0002.20210613Z092759.72T.R.sac.PF.Decon
NK.S0002.20210614Z024459.14T.R.sac.PF.Decon
NK.S0002.20210616Z044307.45T.R.sac.PF.Decon
NK.S0002.20210619Z115905.54T.R.sac.PF.Decon
NK.S0002.20210620Z110824.06T.R.sac.PF.Decon
NK.S0002.20210621Z014411.86T.R.sac.PF.Decon
NK.S0002.20210624Z022456.11T.R.sac.PF.Decon
NK.S0002.20210624Z144956.44T.R.sac.PF.Decon
NK.S0002.20210625Z182838.30T.R.sac.PF.Decon
NK.S0002.20210628Z015640.29T.R.sac.PF.Decon
NK.S0002.20210701Z150634.87T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0002.20210604Z134513.27T.R.sac.PF.Decon 419.545912 0.000000 419.545912 1 S0002 NK 0.077130 25.595501 99.903458 3.121000 0.340000 126.289703 8.600000 35.795766 316.647847 130.475058 1.000000 1.000000
NK.S0002.20210616Z044307.45T.R.sac.PF.Decon 462.211621 0.000000 462.211621 1 S0002 NK 0.074184 25.595501 99.903458 3.121000 -3.558000 129.523804 7.000000 40.836611 316.929063 130.949367 1.000000 1.000000
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
NK.S0003.20210530Z133329.37T.R.sac.PF.Decon
NK.S0003.20210603Z100958.29T.R.sac.PF.Decon
NK.S0003.20210604Z134513.27T.R.sac.PF.Decon
NK.S0003.20210605Z225738.23T.R.sac.PF.Decon
NK.S0003.20210608Z105637.58T.R.sac.PF.Decon
NK.S0003.20210611Z022343.04T.R.sac.PF.Decon
NK.S0003.20210614Z024459.14T.R.sac.PF.Decon
NK.S0003.20210616Z044307.45T.R.sac.PF.Decon
NK.S0003.20210619Z115905.54T.R.sac.PF.Decon
NK.S0003.20210620Z110824.06T.R.sac.PF.Decon
NK.S0003.20210621Z221416.82T.R.sac.PF.Decon
NK.S0003.20210624Z024159.25T.R.sac.PF.Decon
NK.S0003.20210701Z150634.87T.R.sac.PF.Decon
NK.S0003.20210702Z173824.28T.R.sac.PF.Decon
NK.S0003.20210703Z170427.76T.R.sac.PF.Decon
NK.S0003.20210709Z133110.14T.R.sac.PF.Decon
NK.S0003.20210710Z004358.95T.R.sac.PF.Decon
NK.S0003.20210712Z012801.28T.R.sac.PF.Decon
NK.S0003.20210713Z003014.84T.R.sac.PF.Decon
NK.S0003.20210718Z000935.15T.R.sac.PF.Decon
NK.S0003.20210718Z143419.28T.R.sac.PF.Decon
NK.S0003.20210719Z005545.91T.R.sac.PF.Decon
NK.S0003.20210719Z152231.00T.R.sac.PF.Decon
NK.S0003.20210719Z203049.87T.R.sac.PF.Decon
NK.S0003.20210719Z230210.92T.R.sac.PF.Decon
NK.S0003.20210720Z202649.22T.R.sac.PF.Decon
NK.S0003.20210721Z142559.55T.R.sac.PF.Decon
NK.S0003.20210721Z174402.86T.R.sac.PF.Decon
NK.S0003.20210726Z035205.18T.R.sac.PF.Decon
NK.S0003.20210726Z120910.01T.R.sac.PF.Decon
NK.S0003.20210729Z061549.19T.R.sac.PF.Decon
NK.S0003.20210729Z203244.85T.R.sac.PF.Decon
NK.S0003.20210730Z035214.10T.R.sac.PF.Decon
NK.S0003.20210801Z043127.10T.R.sac.PF.Decon
NK.S0003.20210802Z050121.98T.R.sac.PF.Decon
NK.S0003.20210802Z150425.06T.R.sac.PF.Decon
NK.S0003.20210803Z102919.10T.R.sac.PF.Decon
NK.S0003.20210803Z203340.53T.R.sac.PF.Decon
NK.S0003.20210803Z204316.36T.R.sac.PF.Decon
NK.S0003.20210803Z221057.60T.R.sac.PF.Decon
NK.S0003.20210804Z025623.23T.R.sac.PF.Decon
NK.S0003.20210804Z044022.78T.R.sac.PF.Decon
NK.S0003.20210804Z055507.92T.R.sac.PF.Decon
NK.S0003.20210805Z050607.47T.R.sac.PF.Decon
NK.S0003.20210806Z110818.99T.R.sac.PF.Decon
NK.S0003.20210807Z145130.90T.R.sac.PF.Decon
NK.S0003.20210810Z212151.79T.R.sac.PF.Decon
NK.S0003.20210811Z174612.73T.R.sac.PF.Decon
NK.S0003.20210812Z155334.33T.R.sac.PF.Decon
NK.S0003.20210814Z115743.45T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0003.20210729Z203244.85T.R.sac.PF.Decon 705.630312 0.000000 705.630312 1 S0003 NK 0.051052 25.618860 99.921974 2.354600 55.366901 -157.000107 30.299999 76.265674 295.292979 34.805907 1.000000 1.000000
NK.S0003.20210729Z061549.19T.R.sac.PF.Decon 702.353828 0.000000 702.353828 1 S0003 NK 0.051350 25.618860 99.921974 2.354600 55.363499 -157.887604 35.000000 75.808249 294.617196 35.028866 1.000000 1.000000
NK.S0003.20210814Z115743.45T.R.sac.PF.Decon 705.587375 0.000000 705.587375 1 S0003 NK 0.051234 25.618860 99.921974 2.354600 55.176701 -157.644104 20.740000 76.012920 294.845632 35.143830 1.000000 1.000000
NK.S0003.20210702Z173824.28T.R.sac.PF.Decon 514.806604 0.000000 514.806604 1 S0003 NK 0.070130 25.618860 99.921974 2.354600 46.769402 153.742706 0.000000 47.252768 262.919799 48.998440 1.000000 1.000000
NK.S0003.20210713Z003014.84T.R.sac.PF.Decon 499.336240 0.000000 499.336240 1 S0003 NK 0.071075 25.618860 99.921974 2.354600 46.158501 151.604797 21.600000 45.707704 261.757790 49.561426 1.000000 1.000000
NK.S0003.20210620Z110824.06T.R.sac.PF.Decon 431.914508 0.000000 431.914508 1 S0003 NK 0.074757 25.618860 99.921974 2.354600 43.526001 142.687302 147.000000 38.993848 257.012823 51.656063 1.000000 1.000000
NK.S0003.20210803Z102919.10T.R.sac.PF.Decon 429.947831 0.000000 429.947831 1 S0003 NK 0.076306 25.618860 99.921974 2.354600 36.189499 141.812195 19.400000 37.211137 265.577970 63.237582 1.000000 1.000000
NK.S0003.20210804Z044022.78T.R.sac.PF.Decon 433.322118 0.000000 433.322118 1 S0003 NK 0.076337 25.618860 99.921974 2.354600 36.177898 141.867096 0.000000 37.254532 265.630049 63.262286 1.000000 1.000000
NK.S0003.20210803Z203340.53T.R.sac.PF.Decon 425.985977 0.000000 425.985977 1 S0003 NK 0.076305 25.618860 99.921974 2.354600 36.156502 141.669495 44.200001 37.093474 265.525251 63.277115 1.000000 1.000000
NK.S0003.20210608Z105637.58T.R.sac.PF.Decon 582.661694 0.000000 582.661694 1 S0003 NK 0.062255 25.618860 99.921974 2.354600 -5.245700 151.316498 134.000000 58.592065 304.215291 114.118501 1.000000 1.000000
NK.S0003.20210719Z152231.00T.R.sac.PF.Decon 564.697764 0.000000 564.697764 1 S0003 NK 0.065783 25.618860 99.921974 2.354600 -3.360000 146.869995 1.000000 53.875379 305.207921 115.306388 1.000000 1.000000
NK.S0003.20210719Z203049.87T.R.sac.PF.Decon 554.881906 0.000000 554.881906 1 S0003 NK 0.065880 25.618860 99.921974 2.354600 -3.397300 146.374207 53.299999 53.492640 305.469553 115.699851 1.000000 1.000000
NK.S0003.20210811Z174612.73T.R.sac.PF.Decon 380.112198 0.000000 380.112198 1 S0003 NK 0.078921 25.618860 99.921974 2.354600 6.442000 126.612297 51.299999 31.866712 309.783935 122.180810 1.000000 1.000000
NK.S0003.20210710Z004358.95T.R.sac.PF.Decon 398.521847 0.000000 398.521847 1 S0003 NK 0.077824 25.618860 99.921974 2.354600 2.927700 126.561897 68.199997 34.161109 313.840468 127.024984 1.000000 1.000000
NK.S0003.20210802Z050121.98T.R.sac.PF.Decon 492.743721 0.000000 492.743721 1 S0003 NK 0.071788 25.618860 99.921974 2.354600 -4.503200 134.009903 10.000000 44.653639 313.917551 127.257033 1.000000 1.000000
NK.S0003.20210802Z150425.06T.R.sac.PF.Decon 405.083740 0.000000 405.083740 1 S0003 NK 0.076815 25.618860 99.921974 2.354600 1.785200 127.436897 126.699997 35.579970 314.176265 127.390695 1.000000 1.000000
NK.S0003.20210605Z225738.23T.R.sac.PF.Decon 419.508250 0.000000 419.508250 1 S0003 NK 0.077035 25.618860 99.921974 2.354600 0.246600 126.383499 16.299999 35.930153 316.690772 130.514749 1.000000 1.000000
NK.S0003.20210616Z044307.45T.R.sac.PF.Decon 462.233271 0.000000 462.233271 1 S0003 NK 0.074182 25.618860 99.921974 2.354600 -3.558000 129.523804 7.000000 40.839241 316.972721 130.990366 1.000000 1.000000
NK.S0003.20210611Z022343.04T.R.sac.PF.Decon 403.717221 0.000000 403.717221 1 S0003 NK 0.077579 25.618860 99.921974 2.354600 0.051900 124.297600 60.099998 34.672634 319.054912 133.420376 1.000000 1.000000
NK.S0003.20210709Z133110.14T.R.sac.PF.Decon 392.787914 0.000000 392.787914 1 S0003 NK 0.077562 25.618860 99.921974 2.354600 0.131200 123.636597 129.800003 34.181972 319.711436 134.218246 1.000000 1.000000
NK.S0003.20210726Z120910.01T.R.sac.PF.Decon 399.308472 0.000000 399.308472 1 S0003 NK 0.078117 25.618860 99.921974 2.354600 -0.732600 121.993202 30.400000 33.816003 322.416620 137.473196 1.000000 1.000000
NK.S0003.20210703Z170427.76T.R.sac.PF.Decon 471.038585 0.000000 471.038585 1 S0003 NK 0.073484 25.618860 99.921974 2.354600 14.101900 56.839298 10.000000 41.965565 67.287037 262.644135 1.000000 1.000000
NK.S0003.20210718Z143419.28T.R.sac.PF.Decon 480.989338 0.000000 480.989338 1 S0003 NK 0.072728 25.618860 99.921974 2.354600 29.704901 51.128201 9.000000 43.173452 83.142408 286.944715 1.000000 1.000000
NK.S0003.20210621Z221416.82T.R.sac.PF.Decon 617.632958 0.000000 617.632958 1 S0003 NK 0.060326 25.618860 99.921974 2.354600 36.392502 27.027500 31.000000 62.078296 77.467138 299.314402 1.000000 1.000000
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
NK.S0004.20210530Z133329.37T.R.sac.PF.Decon
NK.S0004.20210531Z220442.35T.R.sac.PF.Decon
NK.S0004.20210603Z100958.29T.R.sac.PF.Decon
NK.S0004.20210604Z134513.27T.R.sac.PF.Decon
NK.S0004.20210605Z225738.23T.R.sac.PF.Decon
NK.S0004.20210608Z050032.30T.R.sac.PF.Decon
NK.S0004.20210608Z152901.05T.R.sac.PF.Decon
NK.S0004.20210611Z022343.04T.R.sac.PF.Decon
NK.S0004.20210616Z044307.45T.R.sac.PF.Decon
NK.S0004.20210619Z115905.54T.R.sac.PF.Decon
NK.S0004.20210620Z110824.06T.R.sac.PF.Decon
NK.S0004.20210621Z014411.86T.R.sac.PF.Decon
NK.S0004.20210621Z221416.82T.R.sac.PF.Decon
NK.S0004.20210624Z022456.11T.R.sac.PF.Decon
NK.S0004.20210624Z024159.25T.R.sac.PF.Decon
NK.S0004.20210628Z015640.29T.R.sac.PF.Decon
NK.S0004.20210629Z031414.34T.R.sac.PF.Decon
NK.S0004.20210703Z170427.76T.R.sac.PF.Decon
NK.S0004.20210709Z133110.14T.R.sac.PF.Decon
NK.S0004.20210710Z004358.95T.R.sac.PF.Decon
NK.S0004.20210713Z003014.84T.R.sac.PF.Decon
NK.S0004.20210718Z000935.15T.R.sac.PF.Decon
NK.S0004.20210719Z005545.91T.R.sac.PF.Decon
NK.S0004.20210719Z152231.00T.R.sac.PF.Decon
NK.S0004.20210719Z203049.87T.R.sac.PF.Decon
NK.S0004.20210719Z230210.92T.R.sac.PF.Decon
NK.S0004.20210720Z202649.22T.R.sac.PF.Decon
NK.S0004.20210721Z142559.55T.R.sac.PF.Decon
NK.S0004.20210721Z174402.86T.R.sac.PF.Decon
NK.S0004.20210726Z035205.18T.R.sac.PF.Decon
NK.S0004.20210726Z120910.01T.R.sac.PF.Decon
NK.S0004.20210729Z061549.19T.R.sac.PF.Decon
NK.S0004.20210729Z203244.85T.R.sac.PF.Decon
NK.S0004.20210730Z035214.10T.R.sac.PF.Decon
NK.S0004.20210801Z043127.10T.R.sac.PF.Decon
NK.S0004.20210802Z050121.98T.R.sac.PF.Decon
NK.S0004.20210802Z150425.06T.R.sac.PF.Decon
NK.S0004.20210803Z203340.53T.R.sac.PF.Decon
NK.S0004.20210803Z204316.36T.R.sac.PF.Decon
NK.S0004.20210803Z221057.60T.R.sac.PF.Decon
NK.S0004.20210804Z025623.23T.R.sac.PF.Decon
NK.S0004.20210804Z044022.78T.R.sac.PF.Decon
NK.S0004.20210804Z055507.92T.R.sac.PF.Decon
NK.S0004.20210805Z050607.47T.R.sac.PF.Decon
NK.S0004.20210806Z110818.99T.R.sac.PF.Decon
NK.S0004.20210807Z145130.90T.R.sac.PF.Decon
NK.S0004.20210810Z212151.79T.R.sac.PF.Decon
NK.S0004.20210811Z174612.73T.R.sac.PF.Decon
NK.S0004.20210812Z155334.33T.R.sac.PF.Decon
NK.S0004.20210814Z012745.16T.R.sac.PF.Decon
NK.S0004.20210814Z115743.45T.R.sac.PF.Decon
NK.S0004.20210818Z101005.24T.R.sac.PF.Decon
NK.S0004.20210824Z144725.06T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0004.20210729Z061549.19T.R.sac.PF.Decon 702.285267 0.000000 702.285267 1 S0004 NK 0.051358 25.616825 99.948318 2.171100 55.363499 -157.887604 35.000000 75.796250 294.595920 35.035016 1.000000 1.000000
NK.S0004.20210814Z115743.45T.R.sac.PF.Decon 705.519275 0.000000 705.519275 1 S0004 NK 0.051242 25.616825 99.948318 2.171100 55.176701 -157.644104 20.740000 76.000879 294.824401 35.150065 1.000000 1.000000
NK.S0004.20210818Z101005.24T.R.sac.PF.Decon 701.340703 0.000000 701.340703 1 S0004 NK 0.050561 25.616825 99.948318 2.171100 -14.881800 167.058502 93.000000 76.787464 301.283817 113.708317 1.000000 1.000000
NK.S0004.20210719Z203049.87T.R.sac.PF.Decon 554.718973 0.000000 554.718973 1 S0004 NK 0.065894 25.616825 99.948318 2.171100 -3.397300 146.374207 53.299999 53.470320 305.480131 115.717523 1.000000 1.000000
NK.S0004.20210812Z155334.33T.R.sac.PF.Decon 385.056228 0.000000 385.056228 1 S0004 NK 0.078757 25.616825 99.948318 2.171100 6.206400 127.156502 49.799999 32.411805 309.600997 121.898296 1.000000 1.000000
NK.S0004.20210811Z174612.73T.R.sac.PF.Decon 379.925390 0.000000 379.925390 1 S0004 NK 0.078927 25.616825 99.948318 2.171100 6.442000 126.612297 51.299999 31.845494 309.804710 122.209837 1.000000 1.000000
NK.S0004.20210710Z004358.95T.R.sac.PF.Decon 398.346207 0.000000 398.346207 1 S0004 NK 0.077835 25.616825 99.948318 2.171100 2.927700 126.561897 68.199997 34.140894 313.863123 127.055112 1.000000 1.000000
NK.S0004.20210604Z134513.27T.R.sac.PF.Decon 419.400828 0.000000 419.400828 1 S0004 NK 0.077140 25.616825 99.948318 2.171100 0.340000 126.289703 8.600000 35.778758 316.720504 130.553344 1.000000 1.000000
NK.S0004.20210603Z100958.29T.R.sac.PF.Decon 416.992310 0.000000 416.992310 1 S0004 NK 0.077092 25.616825 99.948318 2.171100 0.316500 126.291100 26.000000 35.796732 316.741306 130.579000 1.000000 1.000000
NK.S0004.20210616Z044307.45T.R.sac.PF.Decon 462.074440 0.000000 462.074440 1 S0004 NK 0.074194 25.616825 99.948318 2.171100 -3.558000 129.523804 7.000000 40.819952 316.994268 131.018044 1.000000 1.000000
NK.S0004.20210611Z022343.04T.R.sac.PF.Decon 403.556581 0.000000 403.556581 1 S0004 NK 0.077589 25.616825 99.948318 2.171100 0.051900 124.297600 60.099998 34.653961 319.081096 133.453288 1.000000 1.000000
NK.S0004.20210709Z133110.14T.R.sac.PF.Decon 392.629119 0.000000 392.629119 1 S0004 NK 0.077572 25.616825 99.948318 2.171100 0.131200 123.636597 129.800003 34.163508 319.738410 134.251938 1.000000 1.000000
NK.S0004.20210726Z035205.18T.R.sac.PF.Decon 399.430340 0.000000 399.430340 1 S0004 NK 0.078144 25.616825 99.948318 2.171100 -0.713900 121.981903 26.900000 33.776793 322.442297 137.504468 1.000000 1.000000
NK.S0004.20210726Z120910.01T.R.sac.PF.Decon 399.155457 0.000000 399.155457 1 S0004 NK 0.078126 25.616825 99.948318 2.171100 -0.732600 121.993202 30.400000 33.798429 322.445691 137.508727 1.000000 1.000000
NK.S0004.20210729Z061549.19T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210814Z115743.45T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210818Z101005.24T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210719Z203049.87T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210812Z155334.33T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210811Z174612.73T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210710Z004358.95T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210604Z134513.27T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210603Z100958.29T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210616Z044307.45T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210611Z022343.04T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210709Z133110.14T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210726Z035205.18T.R.sac.PF.Decon.PF.STACK
NK.S0004.20210726Z120910.01T.R.sac.PF.Decon.PF.STACK
#filename theo_tt tshift obs_tt polarity stnm netwk rayp
NK.S0004.20210729Z061549.19T.R.sac.PF.Decon.PF.STACK 702.285267 0.000000 702.285267 1 S0004 NK 0.051358
NK.S0004.20210814Z115743.45T.R.sac.PF.Decon.PF.STACK 705.519275 0.000000 705.519275 1 S0004 NK 0.051242
NK.S0004.20210818Z101005.24T.R.sac.PF.Decon.PF.STACK 701.340703 0.000000 701.340703 1 S0004 NK 0.050561
NK.S0004.20210719Z203049.87T.R.sac.PF.Decon.PF.STACK 554.718973 0.000000 554.718973 1 S0004 NK 0.065894
NK.S0004.20210812Z155334.33T.R.sac.PF.Decon.PF.STACK 385.056228 0.000000 385.056228 1 S0004 NK 0.078757
NK.S0004.20210811Z174612.73T.R.sac.PF.Decon.PF.STACK 379.925390 0.000000 379.925390 1 S0004 NK 0.078927
NK.S0004.20210710Z004358.95T.R.sac.PF.Decon.PF.STACK 398.346207 0.000000 398.346207 1 S0004 NK 0.077835
NK.S0004.20210604Z134513.27T.R.sac.PF.Decon.PF.STACK 419.400828 0.000000 419.400828 1 S0004 NK 0.077140
NK.S0004.20210603Z100958.29T.R.sac.PF.Decon.PF.STACK 416.992310 0.000000 416.992310 1 S0004 NK 0.077092
NK.S0004.20210616Z044307.45T.R.sac.PF.Decon.PF.STACK 462.074440 0.000000 462.074440 1 S0004 NK 0.074194
NK.S0004.20210611Z022343.04T.R.sac.PF.Decon.PF.STACK 403.556581 0.000000 403.556581 1 S0004 NK 0.077589
NK.S0004.20210709Z133110.14T.R.sac.PF.Decon.PF.STACK 392.629119 0.000000 392.629119 1 S0004 NK 0.077572
NK.S0004.20210726Z035205.18T.R.sac.PF.Decon.PF.STACK 399.430340 0.000000 399.430340 1 S0004 NK 0.078144
NK.S0004.20210726Z120910.01T.R.sac.PF.Decon.PF.STACK 399.155457 0.000000 399.155457 1 S0004 NK 0.078126
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
NK.S0005.20210530Z133329.37T.R.sac.PF.Decon
NK.S0005.20210531Z220442.35T.R.sac.PF.Decon
NK.S0005.20210603Z100958.29T.R.sac.PF.Decon
NK.S0005.20210604Z134513.27T.R.sac.PF.Decon
NK.S0005.20210605Z225738.23T.R.sac.PF.Decon
NK.S0005.20210608Z050032.30T.R.sac.PF.Decon
NK.S0005.20210608Z105637.58T.R.sac.PF.Decon
NK.S0005.20210609Z130555.86T.R.sac.PF.Decon
NK.S0005.20210611Z022343.04T.R.sac.PF.Decon
NK.S0005.20210613Z092759.72T.R.sac.PF.Decon
NK.S0005.20210614Z024459.14T.R.sac.PF.Decon
NK.S0005.20210616Z044307.45T.R.sac.PF.Decon
NK.S0005.20210619Z115905.54T.R.sac.PF.Decon
NK.S0005.20210620Z110824.06T.R.sac.PF.Decon
NK.S0005.20210621Z014411.86T.R.sac.PF.Decon
NK.S0005.20210621Z221416.82T.R.sac.PF.Decon
NK.S0005.20210624Z024159.25T.R.sac.PF.Decon
NK.S0005.20210625Z182838.30T.R.sac.PF.Decon
NK.S0005.20210629Z031414.34T.R.sac.PF.Decon
NK.S0005.20210701Z150634.87T.R.sac.PF.Decon
NK.S0005.20210702Z173824.28T.R.sac.PF.Decon
NK.S0005.20210703Z170427.76T.R.sac.PF.Decon
NK.S0005.20210707Z123047.60T.R.sac.PF.Decon
NK.S0005.20210709Z133110.14T.R.sac.PF.Decon
NK.S0005.20210709Z202344.64T.R.sac.PF.Decon
NK.S0005.20210710Z004358.95T.R.sac.PF.Decon
NK.S0005.20210710Z005110.81T.R.sac.PF.Decon
NK.S0005.20210712Z012801.28T.R.sac.PF.Decon
NK.S0005.20210713Z003014.84T.R.sac.PF.Decon
NK.S0005.20210716Z041957.26T.R.sac.PF.Decon
NK.S0005.20210718Z000935.15T.R.sac.PF.Decon
NK.S0005.20210719Z152231.00T.R.sac.PF.Decon
NK.S0005.20210719Z203049.87T.R.sac.PF.Decon
NK.S0005.20210719Z230210.92T.R.sac.PF.Decon
NK.S0005.20210720Z202649.22T.R.sac.PF.Decon
NK.S0005.20210721Z142559.55T.R.sac.PF.Decon
NK.S0005.20210721Z174402.86T.R.sac.PF.Decon
NK.S0005.20210722Z022455.71T.R.sac.PF.Decon
NK.S0005.20210726Z120910.01T.R.sac.PF.Decon
NK.S0005.20210729Z061549.19T.R.sac.PF.Decon
NK.S0005.20210729Z203244.85T.R.sac.PF.Decon
NK.S0005.20210730Z035214.10T.R.sac.PF.Decon
NK.S0005.20210801Z043127.10T.R.sac.PF.Decon
NK.S0005.20210802Z050121.98T.R.sac.PF.Decon
NK.S0005.20210802Z150425.06T.R.sac.PF.Decon
NK.S0005.20210803Z204316.36T.R.sac.PF.Decon
NK.S0005.20210803Z221057.60T.R.sac.PF.Decon
NK.S0005.20210804Z025623.23T.R.sac.PF.Decon
NK.S0005.20210804Z044022.78T.R.sac.PF.Decon
NK.S0005.20210804Z055507.92T.R.sac.PF.Decon
NK.S0005.20210805Z050607.47T.R.sac.PF.Decon
NK.S0005.20210806Z110818.99T.R.sac.PF.Decon
NK.S0005.20210807Z145130.90T.R.sac.PF.Decon
NK.S0005.20210810Z212151.79T.R.sac.PF.Decon
NK.S0005.20210811Z150257.46T.R.sac.PF.Decon
NK.S0005.20210811Z174612.73T.R.sac.PF.Decon
NK.S0005.20210812Z155334.33T.R.sac.PF.Decon
NK.S0005.20210814Z012745.16T.R.sac.PF.Decon
NK.S0005.20210814Z115743.45T.R.sac.PF.Decon
NK.S0005.20210818Z101005.24T.R.sac.PF.Decon
NK.S0005.20210824Z053750.87T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0005.20210730Z035214.10T.R.sac.PF.Decon 706.651481 0.000000 706.651481 1 S0005 NK 0.051218 25.636482 99.953720 2.226200 55.537899 -157.147003 16.600000 76.086355 295.128368 34.693581 1.000000 1.000000
NK.S0005.20210729Z203244.85T.R.sac.PF.Decon 705.456279 0.000000 705.456279 1 S0005 NK 0.051071 25.636482 99.953720 2.226200 55.366901 -157.000107 30.299999 76.234891 295.279078 34.816319 1.000000 1.000000
NK.S0005.20210814Z115743.45T.R.sac.PF.Decon 705.412826 0.000000 705.412826 1 S0005 NK 0.051254 25.636482 99.953720 2.226200 55.176701 -157.644104 20.740000 75.982058 294.831903 35.154225 1.000000 1.000000
NK.S0005.20210824Z053750.87T.R.sac.PF.Decon 518.984583 0.000000 518.984583 1 S0005 NK 0.069369 25.636482 99.953720 2.226200 48.723900 154.992599 26.400000 48.309231 262.176248 46.537837 1.000000 1.000000
NK.S0005.20210713Z003014.84T.R.sac.PF.Decon 499.072337 0.000000 499.072337 1 S0005 NK 0.071097 25.636482 99.953720 2.226200 46.158501 151.604797 21.600000 45.674493 261.750478 49.570049 1.000000 1.000000
NK.S0005.20210609Z130555.86T.R.sac.PF.Decon 434.419546 0.000000 434.419546 1 S0005 NK 0.075750 25.636482 99.953720 2.226200 40.121300 142.365402 42.500000 38.072801 260.930583 56.952217 1.000000 1.000000
NK.S0005.20210818Z101005.24T.R.sac.PF.Decon 701.359806 0.000000 701.359806 1 S0005 NK 0.050559 25.636482 99.953720 2.226200 -14.881800 167.058502 93.000000 76.790872 301.304278 113.715284 1.000000 1.000000
NK.S0005.20210812Z155334.33T.R.sac.PF.Decon 385.110934 0.000000 385.110934 1 S0005 NK 0.078755 25.636482 99.953720 2.226200 6.206400 127.156502 49.799999 32.418017 309.636827 121.930864 1.000000 1.000000
NK.S0005.20210811Z174612.73T.R.sac.PF.Decon 379.981003 0.000000 379.981003 1 S0005 NK 0.078925 25.636482 99.953720 2.226200 6.442000 126.612297 51.299999 31.851811 309.841043 122.243021 1.000000 1.000000
NK.S0005.20210710Z004358.95T.R.sac.PF.Decon 398.414952 0.000000 398.414952 1 S0005 NK 0.077831 25.636482 99.953720 2.226200 2.927700 126.561897 68.199997 34.148806 313.896210 127.084814 1.000000 1.000000
NK.S0005.20210605Z225738.23T.R.sac.PF.Decon 419.419798 0.000000 419.419798 1 S0005 NK 0.077041 25.636482 99.953720 2.226200 0.246600 126.383499 16.299999 35.919777 316.745291 130.572597 1.000000 1.000000
NK.S0005.20210603Z100958.29T.R.sac.PF.Decon 417.069852 0.000000 417.069852 1 S0005 NK 0.077087 25.636482 99.953720 2.226200 0.316500 126.291100 26.000000 35.805770 316.772162 130.606345 1.000000 1.000000
NK.S0005.20210616Z044307.45T.R.sac.PF.Decon 462.149997 0.000000 462.149997 1 S0005 NK 0.074189 25.636482 99.953720 2.226200 -3.558000 129.523804 7.000000 40.829128 317.021775 131.041174 1.000000 1.000000
NK.S0005.20210703Z170427.76T.R.sac.PF.Decon 471.291186 0.000000 471.291186 1 S0005 NK 0.073465 25.636482 99.953720 2.226200 14.101900 56.839298 10.000000 41.996250 67.266489 262.642603 1.000000 1.000000
NK.S0005.20210614Z024459.14T.R.sac.PF.Decon 533.527232 0.000000 533.527232 1 S0005 NK 0.068375 25.636482 99.953720 2.226200 12.821300 48.600899 10.000000 49.887736 67.214964 265.327974 1.000000 1.000000
NK.S0005.20210801Z043127.10T.R.sac.PF.Decon 620.831372 0.000000 620.831372 1 S0005 NK 0.060358 25.636482 99.953720 2.226200 36.360001 27.049999 10.000000 62.084039 77.428404 299.272299 1.000000 1.000000
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
NK.S0006.20210530Z133329.37T.R.sac.PF.Decon
NK.S0006.20210531Z065954.26T.R.sac.PF.Decon
NK.S0006.20210603Z100958.29T.R.sac.PF.Decon
NK.S0006.20210604Z134513.27T.R.sac.PF.Decon
NK.S0006.20210605Z225738.23T.R.sac.PF.Decon
NK.S0006.20210608Z105637.58T.R.sac.PF.Decon
NK.S0006.20210608Z152901.05T.R.sac.PF.Decon
NK.S0006.20210611Z022343.04T.R.sac.PF.Decon
NK.S0006.20210614Z024459.14T.R.sac.PF.Decon
NK.S0006.20210616Z044307.45T.R.sac.PF.Decon
NK.S0006.20210619Z115905.54T.R.sac.PF.Decon
NK.S0006.20210620Z110824.06T.R.sac.PF.Decon
NK.S0006.20210621Z014411.86T.R.sac.PF.Decon
NK.S0006.20210624Z024159.25T.R.sac.PF.Decon
NK.S0006.20210625Z182838.30T.R.sac.PF.Decon
NK.S0006.20210628Z015640.29T.R.sac.PF.Decon
NK.S0006.20210701Z150634.87T.R.sac.PF.Decon
NK.S0006.20210703Z170427.76T.R.sac.PF.Decon
NK.S0006.20210704Z161847.79T.R.sac.PF.Decon
NK.S0006.20210709Z133110.14T.R.sac.PF.Decon
NK.S0006.20210710Z004358.95T.R.sac.PF.Decon
NK.S0006.20210716Z041957.26T.R.sac.PF.Decon
NK.S0006.20210718Z010453.91T.R.sac.PF.Decon
NK.S0006.20210718Z143419.28T.R.sac.PF.Decon
NK.S0006.20210719Z152231.00T.R.sac.PF.Decon
NK.S0006.20210719Z203049.87T.R.sac.PF.Decon
NK.S0006.20210721Z142559.55T.R.sac.PF.Decon
NK.S0006.20210721Z174402.86T.R.sac.PF.Decon
NK.S0006.20210722Z022455.71T.R.sac.PF.Decon
NK.S0006.20210726Z035205.18T.R.sac.PF.Decon
NK.S0006.20210726Z120910.01T.R.sac.PF.Decon
NK.S0006.20210729Z061549.19T.R.sac.PF.Decon
NK.S0006.20210730Z035214.10T.R.sac.PF.Decon
NK.S0006.20210801Z043127.10T.R.sac.PF.Decon
NK.S0006.20210802Z150425.06T.R.sac.PF.Decon
NK.S0006.20210803Z203340.53T.R.sac.PF.Decon
NK.S0006.20210803Z204316.36T.R.sac.PF.Decon
NK.S0006.20210803Z221057.60T.R.sac.PF.Decon
NK.S0006.20210804Z025623.23T.R.sac.PF.Decon
NK.S0006.20210804Z044022.78T.R.sac.PF.Decon
NK.S0006.20210804Z055507.92T.R.sac.PF.Decon
NK.S0006.20210805Z050607.47T.R.sac.PF.Decon
NK.S0006.20210806Z110818.99T.R.sac.PF.Decon
NK.S0006.20210807Z145130.90T.R.sac.PF.Decon
NK.S0006.20210810Z212151.79T.R.sac.PF.Decon
NK.S0006.20210811Z150257.46T.R.sac.PF.Decon
NK.S0006.20210811Z174612.73T.R.sac.PF.Decon
NK.S0006.20210812Z155334.33T.R.sac.PF.Decon
NK.S0006.20210814Z115743.45T.R.sac.PF.Decon
NK.S0006.20210818Z101005.24T.R.sac.PF.Decon
NK.S0006.20210824Z053750.87T.R.sac.PF.Decon
NK.S0006.20210824Z144725.06T.R.sac.PF.Decon
NK.S0006.20210826Z021424.75T.R.sac.PF.Decon
NK.S0006.20210827Z102228.24T.R.sac.PF.Decon
NK.S0006.20210828Z122723.14T.R.sac.PF.Decon
#filename theo_tt tshift obs_tt polarity stnm netwk rayp stla stlo stel evla evlo evdp dist az baz snr0 xcoeff0
NK.S0006.20210729Z061549.19T.R.sac.PF.Decon 702.087145 0.000000 702.087145 1 S0006 NK 0.051381 25.639706 99.979195 1.783100 55.363499 -157.887604 35.000000 75.761574 294.585879 35.045894 1.000000 1.000000
NK.S0006.20210804Z044022.78T.R.sac.PF.Decon 432.848290 0.000000 432.848290 1 S0006 NK 0.076368 25.639706 99.979195 1.783100 36.177898 141.867096 0.000000 37.199033 265.622288 63.280858 1.000000 1.000000
NK.S0006.20210803Z203340.53T.R.sac.PF.Decon 425.512673 0.000000 425.512673 1 S0006 NK 0.076336 25.639706 99.979195 1.783100 36.156502 141.669495 44.200001 37.037973 265.517484 63.295670 1.000000 1.000000
NK.S0006.20210530Z133329.37T.R.sac.PF.Decon 373.207643 0.000000 373.207643 1 S0006 NK 0.074632 25.639706 99.979195 1.783100 27.228001 139.807999 526.299988 35.613351 276.731031 78.403182 1.000000 1.000000
NK.S0006.20210811Z150257.46T.R.sac.PF.Decon 490.319000 0.000000 490.319000 1 S0006 NK 0.071422 25.639706 99.979195 1.783100 15.907300 147.159897 50.099998 44.993228 290.505260 92.828650 1.000000 1.000000
NK.S0006.20210818Z101005.24T.R.sac.PF.Decon 701.249000 0.000000 701.249000 1 S0006 NK 0.050572 25.639706 99.979195 1.783100 -14.881800 167.058502 93.000000 76.771101 301.316823 113.729147 1.000000 1.000000
NK.S0006.20210608Z105637.58T.R.sac.PF.Decon 582.393008 0.000000 582.393008 1 S0006 NK 0.062279 25.639706 99.979195 1.783100 -5.245700 151.316498 134.000000 58.553400 304.262306 114.167700 1.000000 1.000000
NK.S0006.20210719Z152231.00T.R.sac.PF.Decon 564.419898 0.000000 564.419898 1 S0006 NK 0.065808 25.639706 99.979195 1.783100 -3.360000 146.869995 1.000000 53.837554 305.258579 115.360956 1.000000 1.000000
NK.S0006.20210719Z203049.87T.R.sac.PF.Decon 554.607854 0.000000 554.607854 1 S0006 NK 0.065904 25.639706 99.979195 1.783100 -3.397300 146.374207 53.299999 53.455097 305.520783 115.755032 1.000000 1.000000
NK.S0006.20210828Z122723.14T.R.sac.PF.Decon 524.587194 0.000000 524.587194 1 S0006 NK 0.069261 25.639706 99.979195 1.783100 -3.549700 140.117096 2.800000 48.568665 309.062202 120.785583 1.000000 1.000000
NK.S0006.20210812Z155334.33T.R.sac.PF.Decon 384.953982 0.000000 384.953982 1 S0006 NK 0.078761 25.639706 99.979195 1.783100 6.206400 127.156502 49.799999 32.400194 309.664630 121.965347 1.000000 1.000000
NK.S0006.20210811Z174612.73T.R.sac.PF.Decon 379.824804 0.000000 379.824804 1 S0006 NK 0.078931 25.639706 99.979195 1.783100 6.442000 126.612297 51.299999 31.834070 309.869472 122.278181 1.000000 1.000000
NK.S0006.20210710Z004358.95T.R.sac.PF.Decon 398.272361 0.000000 398.272361 1 S0006 NK 0.077840 25.639706 99.979195 1.783100 2.927700 126.561897 68.199997 34.132394 313.925509 127.120072 1.000000 1.000000
NK.S0006.20210603Z100958.29T.R.sac.PF.Decon 416.937980 0.000000 416.937980 1 S0006 NK 0.077096 25.639706 99.979195 1.783100 0.316500 126.291100 26.000000 35.790399 316.801945 130.641507 1.000000 1.000000
NK.S0006.20210616Z044307.45T.R.sac.PF.Decon 462.024511 0.000000 462.024511 1 S0006 NK 0.074198 25.639706 99.979195 1.783100 -3.558000 129.523804 7.000000 40.813889 317.048604 131.072479 1.000000 1.000000
NK.S0006.20210726Z120910.01T.R.sac.PF.Decon 399.137982 0.000000 399.137982 1 S0006 NK 0.078127 25.639706 99.979195 1.783100 -0.732600 121.993202 30.400000 33.796422 322.510357 137.575786 1.000000 1.000000
#Parameters used for processing
#filter
filter_type = Two-Pass
fl = 0.020000
fh = 1.000000
order = 2
%% This shell aims to display the stacked RFs, grouped by event clusters, on profiles
%% Written by Yaoyao He, on 2026/2/3
clear; clc; close all
%% Profiles
profiles{1} = [125 115 105 95 75 66 55 46 35];
% N-E
% profiles{1} = 141:150;
% profiles{2} = 131:140;
% profiles{3} = 121:130;
% profiles{4} = 111:120;
% profiles{5} = 101:110;
% profiles{6} = [91:94, 96:100];
% profiles{7} = [83:84, 95, 86:90];
% profiles{8} = 71:80;
% profiles{9} = [61:63, 65:70];
% profiles{10} = 51:60;
% profiles{11} = [41:50];
% profiles{12} = [156, 31:40];
% profiles{13} = [157, 152, 21:30];
% profiles{14} = [159, 154, 11:13, 15:19];
% profiles{15} = [160, 155, 1:10];
% profiles{16} = [171:176 178:180];
% profiles{17} = [141 132 122 113 104 94 84 75 67 57 48 38 29 20 10];
% N-S
% profiles{18} = [141:-10:91, 71:-10:1];
% profiles{19} = [132:-10:72, 62:-10:2, 170];
% profiles{20} = [142, 133:-10:83, 72, 63:-10:3, 168, 172];
% profiles{21} = [144:-10:54, 45, 34, 15, 14, 4, 172];
% profiles{22} = [143, 134:-10:74, 65, 55, 46, 35, 25, 16, 5, 173,];
% profiles{23} = [135:-10:95, 75, 66, 56, 47, 36, 27, 17, 6, 177, 165, 166, 175];
% profiles{24} = [146:-10:96, 85, 86, 76, 67, 57, 37, 27, 17, 7, 164, 176];
% profiles{25} = [147:-10:77, 68:-10:8, 162, 178];
% profiles{26} = [138:-10:88, 79:-10:9, 161, 163, 179, 180];
% profiles{27} = [148, 139:-10:89, 80:-10:10];
% profiles{28} = [150, 149, 140:-10:90];
%% I/O
inputdir = "D:\YB\yunnan2\F0_6.0_waterlevel_0.01\3_selected_stationset_v2";
subdir = string(ls(fullfile(inputdir, 'NK*')));
%% Basic parameters
% Range of BAZ
min_baz = 200;
max_baz = 300;
outputdir = fullfile("D:\YB\yunnan2\F0_6.0_waterlevel_0.01\profiles", strcat('BAZ_', num2str(min_baz), '_', num2str(max_baz)));
if ~exist(outputdir, 'dir')
mkdir(outputdir);
end
% Topography
[N25E099, R1] = readgeoraster("D:\YB\NASADEM_HGT_1arcsecond_YB\ASTGTMV003_N25E099_N27E101\ASTGTMV003_N25E099_dem.tif");
[N25E100, R2] = readgeoraster("D:\YB\NASADEM_HGT_1arcsecond_YB\ASTGTMV003_N25E099_N27E101\ASTGTMV003_N25E100_dem.tif");
elev_YB = double([N25E099 N25E100(:, 2:end)]);
lonlim = linspace(98.9999, 101.0001, size(elev_YB, 2));
latlim = linspace(26.0001, 24.9999 , size(elev_YB, 1));
[lonmig, latmig] = meshgrid(lonlim, latlim);
% stations' location
sta_info = textscan(fopen("D:\YB\yunnan2\station.txt", 'r'), '%f %f %s %s %s %s %f', 'Commentstyle', 'shell', 'Headerlines', 1);
lon = (sta_info{1})';
lat = (sta_info{2})';
scale = 1;
% filter
fl = 0.02;
fh = 1;
order = 2;
% figures
labelsize = 24;
ticklabelsize = 20;
textfontsize = 12;
fontsize = 20;
color = [0,0,0;0.7451,0.7451,0.7451];
color_stack = [1,0,0;0.7451,0.7451,0.7451];
fig_size = [-1454 483 743 463];
b_height = 0.15;
t_height = 0.07;
l_width = 0.14;
width = 0.8;
l_xlim = -5;
r_xlim = 20;
set(0,'DefaultAxesFontName','Calibri')
set(0,'DefaultTextFontName','Calibri')
%% main progress
for i_prof = [1 2 10 16]%1:length(profiles)
i_profile = profiles{i_prof};
Ps_arrivaltimes_of_prof = zeros(length(i_profile), 1);
stacked_RFs_on_prof = zeros(901, length(i_profile));
for i_sta = 1:length(i_profile)
no_sta = i_profile(i_sta);
fid = fopen(fullfile(inputdir, subdir(no_sta), 'list_r_Decon_PF.txt'), 'r');
saclist_info = textscan(fid, '%s %f %f %f %f %s %s %f %f %f %f %f %f %f %f %f %f %f %f \n', 'CommentStyle', 'shell', 'HeaderLines', 1);
fclose(fid);
if isempty(saclist_info{1,1})
continue
end
filename = string(saclist_info{1});
file_num = length(filename);
rayp = saclist_info{1,8};
stla = saclist_info{1,9}(1);
stlo = saclist_info{1,10}(1);
evla = saclist_info{1,12};
evlo = saclist_info{1,13};
dist = saclist_info{15};
baz = saclist_info{17};
clus_data = zeros(901, file_num);
clus_dist = zeros(file_num, 1);
clus_baz = zeros(file_num, 1);
clus_rayp = zeros(file_num, 1);
for i_file = 1:length(filename)
[hdr, data] = irdsac(fullfile(inputdir, subdir(no_sta), filename(i_file)));
tshift = hdr.a - hdr.b;
time = (0:hdr.npts-1)'*hdr.delta - tshift;
% filtering and normalization
data = filtering(data, hdr.delta, fl, fh, order);
data = data./max(abs(data));
% assign data to cluster
if baz(i_file) > min_baz && baz(i_file) < max_baz
clus_data(:, i_file) = data;
clus_dist(i_file) = dist(i_file);
clus_baz(i_file) = baz(i_file);
clus_rayp(i_file) = rayp(i_file);
end
end
% delete zero column
clus_data = clus_data(:, any(clus_data ~= 0, 1));
clus_dist = clus_dist(clus_dist ~= 0);
clus_baz = clus_baz(clus_baz ~= 0);
clus_rayp = clus_rayp(clus_rayp ~= 0);
% sort by BAZ
[clus_baz, ind1] = sort(clus_baz);
clus_data = clus_data(:, ind1);
clus_dist = clus_dist(ind1);
clus_rayp = clus_rayp(ind1);
% stacking RFs
stacked_data = mean(clus_data, 2);
stacked_RFs_on_prof(:, i_sta) = stacked_data;
if isempty(find(stacked_data,1))
flag1 = 0;
else
flag1 = 1;
end
Ps_timewin_ind = find(roundn(time, -1)==5):find(roundn(time, -1)==7);
[~, Ps_arrivaltime] = max(stacked_data(Ps_timewin_ind)); Ps_arrivaltime = 5+(Ps_arrivaltime-1)/10;
Ps_arrivaltimes_of_prof(no_sta, 1) = Ps_arrivaltime;
end
% plot profiles
figure
axes('Position', [0.17, 0.85, 0.75, 0.1])
profile_lon = lon(i_profile);
profile_lat = lat(i_profile);
distances = [0 distance(profile_lat(1:end-1),profile_lon(1:end-1), profile_lat(2:end),profile_lon(2:end))*pi*6371/180];
profile_len = sum(distances);
cumsum_dist = cumsum(distances)/scale;
% topography on stations
lo_idx = zeros(1, length(profile_lon));
la_idx = zeros(1, length(profile_lon));
for i_point = 1:length(profile_lon)
[~, lo_idx(i_point)] = min(abs(lonlim - profile_lon(i_point)));
[~, la_idx(i_point)] = min(abs(latlim - profile_lat(i_point)));
end
% splicing segments
diff_lo = diff(lo_idx);
diff_la = diff(la_idx);
profile_ele_interp = [];
cumsum_dist_interp = [];
for i_seg = 1:length(diff_lo)
interp_points = abs(max(diff_lo(i_seg), diff_la(i_seg)))+1;
lon_temp = linspace(lonlim(lo_idx(i_seg)), lonlim(lo_idx(i_seg+1)), interp_points);
lat_temp = linspace(latlim(la_idx(i_seg)), latlim(la_idx(i_seg+1)), interp_points);
profile_ele_temp = interp2(lonmig, latmig, elev_YB, lon_temp, lat_temp, 'linear');
profile_ele_interp = [profile_ele_interp profile_ele_temp];
cumsum_dist_interp = [cumsum_dist_interp linspace(cumsum_dist(i_seg), cumsum_dist(i_seg+1), interp_points)];
end
show_minelve = (round(min(profile_ele_interp)/100)-1)*100;
show_maxelve = (round(max(profile_ele_interp)/100)+1)*100;
fill([0 cumsum_dist_interp cumsum_dist_interp(end)], [show_minelve profile_ele_interp show_minelve], [.7 .7 .7], 'LineStyle', 'none')
hold on
plot(cumsum_dist_interp, profile_ele_interp, 'k-', 'LineWidth', 0.1)
set(gca, 'FontSize', 14)
xticks([])
xticklabels([])
ylabel('Elevation (m)', 'FontSize', 16)
xlim([-1 (profile_len+2)/scale])
ylim([show_minelve show_maxelve])
ytick1 = show_minelve:400:show_maxelve;
set(gca, 'YTick', ytick1)
set(gca, 'YTickLabel', string(ytick1))
titlestr = strcat('p', num2str(i_prof));
title(titlestr, 'FontSize', fontsize);
axes('Position', [0.17, 0.15, 0.75, 0.7])
for i_trace = 1:length(i_profile)
if ~any(stacked_RFs_on_prof(:,i_trace))
plot([-10 30], [cumsum_dist(i_trace) cumsum_dist(i_trace)], 'k--', 'LineWidth', 1.5);
hold on
end
single_wig7(time, stacked_RFs_on_prof(:, i_trace), cumsum_dist(i_trace), color(1,:), color(2,:), 'yes', 'yes');
hold on
end
% P phase
plot([0 0], [-0.5 (profile_len+1)/scale], 'r', 'LineWidth', 1.5)
hold on
text(-1, (profile_len+0.5)/scale, 'P', 'Color', 'r', 'FontSize', 20)
box on
grid on
set(gca, 'YGrid', 'off');
xlim([-2 r_xlim])
ylim([-1 (profile_len+2)/scale])
set(gca, 'FontSize', 16)
xlabel('Time(sec)', 'FontSize', fontsize);
ylabel('Distance (km)', 'FontSize', fontsize);
xtick = 0:2:20;
xticklabel = string(xtick);
set(gca, 'XTick', xtick);
set(gca, 'XTickLabel',xticklabel);
ytick = cumsum_dist(1):5:cumsum_dist(end);
yticklabel = string(ytick);
set(gca, 'YTick', ytick);
set(gca, 'YTickLabel',yticklabel);
ytickangle(-60);
view(90,90)
fig_size2 = [-1921 178 475 767];
set(gcf, 'OuterPosition', fig_size2)
fig_name = strcat('BAZ_', num2str(min_baz), '_', num2str(max_baz), '_profile_', num2str(i_prof), '.png');
exportgraphics(gcf, fullfile(outputdir, fig_name), 'BackgroundColor', 'white', 'Resolution', 2000); % 设置分辨率
% close all
end
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论