forked from kajjohns/SliDeFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_best_fitting.m
278 lines (225 loc) · 8.21 KB
/
plot_best_fitting.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INPUT SECTION
%select plots to make (true/false)
%map-view plots of observed and model strain rates
plot_max_shear = true;
plot_dilatation = true;
%plot slip deficit on slip patches
plot_slip_deficit = true;
%plot rake on slip patches
plot_rake = true;
%plot depth-averaged slip rates along fault traces
plot_depth_averaged = true;
%plot recurrence times and times since last earthquake
plot_earthquake_timing = true;
%END INPUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if plot_max_shear
%plot maximum shear strain rate
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(max_shear,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,max_shear,'fill')
end
colormap(jet)
colorbar
set(gca,'colorscale','log')
caxis([1e-3 1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('observed mean maximum shear strain rate')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(max_shear_bs,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,max_shear_bs,'fill')
end
colormap(jet)
colorbar
set(gca,'colorscale','log')
caxis([1e-3 1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('model mean maximum shear strain rate (backslip)')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(max_shear_offfault,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,max_shear_offfault,'fill')
end
colormap(jet)
colorbar
set(gca,'colorscale','log')
caxis([1e-3 1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('observed - model max shear strain rate ')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
end
if plot_dilatation
load cmap
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(dilatation,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,dilatation,'fill')
end
colormap(cmap)
colorbar
caxis([-1e-1 1e-1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('observed dilatation rate')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(dilatation_bs,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,dilatation_bs,'fill')
end
colormap(cmap)
colorbar
caxis([-1e-1 1e-1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('model dilatation rate')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
f=figure;
if regular_grid
X = [obs_llh(:,1)-dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)+dl/2 obs_llh(:,1)-dl/2];
Y = [obs_llh(:,2)-dl/2 obs_llh(:,2)-dl/2 obs_llh(:,2)+dl/2 obs_llh(:,2)+dl/2];
patch(X',Y',repmat(dilatation-dilatation_bs,1,4)','edgecolor','none');
else
scatter(obs_llh(:,1),obs_llh(:,2),80,dilatation-dilatation_bs,'fill')
end
colormap(cmap)
colorbar
caxis([-1e-1 1e-1])
hold on
plot(SegEnds_llh(:,[1 3])',SegEnds_llh(:,[2 4])','k','linewidth',1)
title('observed - model dilatation rate')
f.Position = [154 68 735 758];
set(gca,'fontsize',15)
end
if plot_slip_deficit
%plot slip deficit rate
figure
plotpatchslip3D_noedge(pm_top,bs_top*1000,1)
hold on
plotpatchslip3D_noedge(pm,bs_bot*1000,1)
title('slip deficit rates, mm/yr')
axis tight
view(-35,35)
set(gca,'fontsize',15)
%plot slip deficit rate
figure
plotpatchslip3D_noedge(pm_top,bs_top*1000,1)
hold on
plotpatchslip3D_noedge(pm,bs_bot*1000,1)
title('slip deficit rates, mm/yr')
axis tight
view(-35,35)
set(gca,'colorscale','log')
set(gca,'fontsize',15)
end
if plot_rake
%plot rake
figure
plotpatchslip3D_noedge(pm_top,rake_top,1)
hold on
plotpatchslip3D_noedge(pm,rake_bot,1)
title('rake, degrees')
axis tight
view(-35,35)
set(gca,'fontsize',15)
colormap(pmkmp(128,'IsoAZ'))
caxis([-180 180])
%plot preferred (prior) rake
figure
plotpatchslip3D_noedge(pm_top,rake_top_patches,1)
hold on
plotpatchslip3D_noedge(pm,rake_patches,1)
title('pior (preferred) rake, degrees')
axis tight
view(-35,35)
set(gca,'fontsize',15)
colormap(pmkmp(128,'IsoAZ'))
caxis([-180 180])
end
if plot_depth_averaged
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));
a = 90-pm_top(:,5);
pm_ends = [pm_top(:,6)+pm_top(:,1).*cos(a*pi/180)/2 pm_top(:,7)+pm_top(:,1).*sin(a*pi/180)/2 pm_top(:,6)-pm_top(:,1).*cos(a*pi/180)/2 pm_top(:,7)-pm_top(:,1).*sin(a*pi/180)/2];
figure
hold on
for k=1:size(pm_ends,1)
cline([pm_ends(k,1) pm_ends(k,3)],[pm_ends(k,2) pm_ends(k,4)],[depth_averaged_s(k) depth_averaged_s(k)]*1000) %convert to mm/yr
end
colormap(jet)
set(gca,'ColorScale','log')
caxis([0.1 40])
c=colorbar;
axis equal
axis tight
c.FontSize=15
title('depth-averaged slip deficit rates (mm/yr)','fontsize',15)
figure
hold on
for k=1:size(pm_ends,1)
cline([pm_ends(k,1) pm_ends(k,3)],[pm_ends(k,2) pm_ends(k,4)],[depth_averaged_s(k) depth_averaged_s(k)]*1000) %convert to mm/yr
end
colormap(jet)
caxis([0 40])
c=colorbar;
axis equal
axis tight
c.FontSize=15
title('depth-averaged slip deficit rates (mm/yr)','fontsize',15)
end
if plot_earthquake_timing
figure
plotpatchslip3D_noedge(pm_top,Ts_top,1)
hold on
plotpatchslip3D_noedge(pm,Ts,1)
title('earthquake recurrence time, yr')
axis tight
view(-20,60)
figure
plotpatchslip3D_noedge(pm_top,teqs_top,1)
hold on
plotpatchslip3D_noedge(pm,teqs,1)
title('time since last earthquake, yr')
axis tight
view(-20,60)
end