-
Notifications
You must be signed in to change notification settings - Fork 5
/
plot_slip_rates_along_faults.m
executable file
·132 lines (96 loc) · 3.5 KB
/
plot_slip_rates_along_faults.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
%this script plots slip rates along faults
%Note: run sample_posterior first
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT SECTION
%list of fault names to plot (note, only part of the name needs to be in
%the list to include the fault
plot_names = {'San Andreas','Bartlett Springs','Maacama'};
%END INPUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%number of slip patches
numslip = size(pms,1);
all_slip_Ms = all_Ms(1:numslip,:); %extract slip rates (exclude moment sources)
for k=1:length(FaultInfo)
FaultID(k) = FaultInfo{k}.FaultID;
FaultNames{k} = FaultInfo{k}.FaultName;
end
%need to assign fault names to segments
for k=1:size(SegEnds,1)
ind = segid(k) == FaultID;
fault_name{k} = FaultNames{ind};
end
%compute depth-averaged slip rate samples
top_row_samples_s = all_slip_Ms(1:end/nve,:);
bottom = all_slip_Ms(1+end/nve:end,:);
sum_bottom_rows = zeros(size(top_row_samples_s));
for k=1:nve-1
sum_bottom_rows = sum_bottom_rows + bottom(k:nve-1:end,:);
end
depth_averaged_samples_s = 1/nve*(top_row_samples_s + sum_bottom_rows);
if variable_rake
bs = sqrt(mhat_rake.^2 + mhat_perp.^2);
else
bs = mhat_rake;
end
%plot depth-averaged slip deficit rate
top_row_s = bs(1:end/nve);
bottom = bs(1+end/nve:end);
for k=1:nve-1
bottom_rows_s(:,k) = bottom(k:nve-1:end,:);
end
depth_averaged_s = 1/nve*(top_row_s + sum(bottom_rows_s,2));
if variable_rake
depth_averaged_samples_s = sqrt(depth_averaged_samples_s(1:end/2,:).^2 + depth_averaged_samples_s(1+end/2:end,:).^2);
end
%get 95% range of depth-averaged slip deficit
s = depth_averaged_s*1000; %convert to mm/yr
sorted = sort(depth_averaged_samples_s*1000,2); %convert to mm/yr
discard = round(.025*size(sorted,2));
sorted(:,1:discard) = [];
sorted(:,end-discard+1:end) = [];
upper_95 = sorted(:,end)-s;
lower_95 = s-sorted(:,1);
%because of poor sampling lower 95 can slip below zero -- fix that
lower_95(lower_95<0)=0;
for loop=1:length(plot_names)
name = plot_names{loop};
i=strmatch(name,fault_name);
j=ismember(pm_top_seg_num,i);
srate = s(j);
upper_bound = UB(j);
L95 = lower_95(j);
U95 = upper_95(j);
upper_bound_cfm = ub_top_patches(j);
% pref = mean_s_prior(j);
pm_x = pm_top(j,6);
pm_y = pm_top(j,7);
[y,i] = max(pm_y);
first_x = pm_x(i);
first_y = pm_y(i);
distance_along_fault = sqrt((pm_x-first_x).^2 + (pm_y-first_y).^2);
[y,i] = sort(distance_along_fault);
figure
subplot(121)
phand(1) = errorbar(distance_along_fault(i),srate(i),L95(i),U95(i),'k','linewidth',2);
ax = gca;
ax.XAxis.FontSize = 15;
ax.YAxis.FontSize = 15;
xlabel('distance from north end of fault, km')
ylabel('depth-averaged slip deficit rate, mm/yr')
title([name ', depth-averaged slip deficit'],'fontsize',15)
hold on
plot(distance_along_fault(i),upper_bound_cfm(i),'b','linewidth',3)
plot(distance_along_fault(i),upper_bound(i),'r','linewidth',3)
% plot(distance_along_fault(i),pref(i),'r:','linewidth',3)
grid on
legend('estimated','upper bound','lower bound')
set(gca,'fontsize',15)
subplot(122)
hold on
plot(SegEnds(:,[1 3])',SegEnds(:,[2 4])','k')
plot(pm_x(i),pm_y(i),'r','linewidth',3)
set(gca,'fontsize',15)
set(gcf, 'Position', get(0, 'Screensize'));
end