-
Notifications
You must be signed in to change notification settings - Fork 1
/
ranges_and_probabilities.m
277 lines (216 loc) · 10.4 KB
/
ranges_and_probabilities.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
function [LAC_qc,LAS_qc,MC_qc,LBU_qc,LBC_qc]=ranges_and_probabilities (Stage_Type,Stage_Lnrd_A_Carb, ...
Stage_Lnrd_A_Shale,Stage_Massive_Carb, Stage_Lnrd_B_UpperShale,Stage_Lnrd_B_Carb,filename);
%input expected ranges for each formation from a document
normal_ranges=xlsread('Ranges_and_Probabilities.xlsx');
%create empty variables to fill with results
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%stresses
LAC_app=NaN(size(Stage_Lnrd_A_Carb,1),6);
LA_stat=NaN(size(Stage_Lnrd_A_Carb,1),6);
LAS_app=NaN(size(Stage_Lnrd_A_Shale,1),6);
LAS_stat=NaN(size(Stage_Lnrd_A_Shale,1),6);
MC_app=NaN(size(Stage_Massive_Carb,1),6);
MC_stat=NaN(size(Stage_Massive_Carb,1),6);
LBU_app=NaN(size(Stage_Lnrd_B_UpperShale,1),6);
LBU_stat=NaN(size(Stage_Lnrd_B_UpperShale,1),6);
LBC_app=NaN(size(Stage_Lnrd_B_Carb,1),6);
LBC_stat=NaN(size(Stage_Lnrd_B_Carb,1),6);
for i =1:size(Stage_Lnrd_A_Carb,1)
if log(Stage_Lnrd_A_Carb(i,8))<(normal_ranges(1,1)-normal_ranges(1,2)) || log(Stage_Lnrd_A_Carb(i,8))> normal_ranges(1,1)+normal_ranges(1,2)
LAC_app(i,1:3)=Stage_Lnrd_A_Carb(i,1:3);
LAC_app(i,4:6)=Stage_Lnrd_A_Carb(i,13:15);
else
LAC_app(i,1)=NaN;
end
if log(Stage_Lnrd_A_Carb(i,11))<(normal_ranges(2,1)-normal_ranges(2,2)) || log(Stage_Lnrd_A_Carb(i,11))> normal_ranges(2,1)+normal_ranges(2,2)
LA_stat(i,1:3)=Stage_Lnrd_A_Carb(i,1:3);
LA_stat(i,4:6)=Stage_Lnrd_A_Carb(i,13:15);
else
LA_stat(i,1)=NaN;
end
end
for i =1:size(Stage_Lnrd_A_Shale,1)
if log(Stage_Lnrd_A_Shale(i,8))<(normal_ranges(1,3)-normal_ranges(1,4)) && log(Stage_Lnrd_A_Shale(i,8))> normal_ranges(1,3)+normal_ranges(1,4)
LAS_app(i,1)=Stage_Lnrd_A_Shale(i,1);
LAS_app(i,2)=Stage_Lnrd_A_Shale(i,2);
LAS_app(i,3)=Stage_Lnrd_A_Shale(i,3);
LAS_app(i,4)=Stage_Lnrd_A_Shale(i,13);
LAS_app(i,5)=Stage_Lnrd_A_Shale(i,14);
LAS_app(i,6)=Stage_Lnrd_A_Shale(i,15);
else
LAS_app(i,1)=NaN;
end
if log(Stage_Lnrd_A_Shale(i,11))<(normal_ranges(2,3)-normal_ranges(2,4)) && log(Stage_Lnrd_A_Shale(i,11))> normal_ranges(2,3)+normal_ranges(2,4)
LAS_stat(i,1)=Stage_Lnrd_A_Shale(i,1);
LAS_stat(i,2)=Stage_Lnrd_A_Shale(i,2);
LAS_stat(i,3)=Stage_Lnrd_A_Shale(i,3);
LAS_stat(i,4)=Stage_Lnrd_A_Shale(i,13);
LAS_stat(i,5)=Stage_Lnrd_A_Shale(i,14);
LAS_stat(i,6)=Stage_Lnrd_A_Shale(i,15);
else
LAS_stat(i,1)=NaN;
end
end
for i =1:size(Stage_Massive_Carb,1)
if log(Stage_Massive_Carb(i,8))<(normal_ranges(1,5)-normal_ranges(1,6)) || log(Stage_Massive_Carb(i,8))> normal_ranges(1,5)+normal_ranges(1,6)
MC_app(i,1)=Stage_Massive_Carb(i,1);
MC_app(i,2)=Stage_Massive_Carb(i,2);
MC_app(i,3)=Stage_Massive_Carb(i,3);
MC_app(i,4)=Stage_Massive_Carb(i,13);
MC_app(i,5)=Stage_Massive_Carb(i,14);
MC_app(i,6)=Stage_Massive_Carb(i,15);
else
MC_app(i,1)=NaN;
end
if log(Stage_Massive_Carb(i,11))<(normal_ranges(2,5)-normal_ranges(2,6)) || log(Stage_Massive_Carb(i,11))> normal_ranges(2,5)+normal_ranges(2,6)
MC_stat(i,1)=Stage_Massive_Carb(i,1);
MC_stat(i,2)=Stage_Massive_Carb(i,2);
MC_stat(i,3)=Stage_Massive_Carb(i,3);
MC_stat(i,4)=Stage_Massive_Carb(i,13);
MC_stat(i,5)=Stage_Massive_Carb(i,14);
MC_stat(i,6)=Stage_Massive_Carb(i,15);
else
MC_stat(i,1)=NaN;
end
end
for i =1:size(Stage_Lnrd_B_UpperShale,1)
if log(Stage_Lnrd_B_UpperShale(i,8))<(normal_ranges(1,6)-normal_ranges(1,7)) ||log(Stage_Lnrd_B_UpperShale (i,8))> normal_ranges(1,6)+normal_ranges(1,7)
LBU_app(i,1)=Stage_Lnrd_B_UpperShale(i,1);
LBU_app(i,2)=Stage_Lnrd_B_UpperShale(i,2);
LBU_app(i,3)=Stage_Lnrd_B_UpperShale(i,3);
LBU_app(i,4)=Stage_Lnrd_B_UpperShale(i,13);
LBU_app(i,5)=Stage_Lnrd_B_UpperShale(i,14);
LBU_app(i,6)=Stage_Lnrd_B_UpperShale(i,15);
else
LBU_app(i,1)=NaN;
end
if log(Stage_Lnrd_B_UpperShale(i,11))<(normal_ranges(2,6)-normal_ranges(2,7)) ||log(Stage_Lnrd_B_UpperShale (i,11))> normal_ranges(2,6)+normal_ranges(2,7)
LBU_stat(i,1)=Stage_Lnrd_B_UpperShale(i,1);
LBU_stat(i,2)=Stage_Lnrd_B_UpperShale(i,2);
LBU_stat(i,3)=Stage_Lnrd_B_UpperShale(i,3);
LBU_stat(i,4)=Stage_Lnrd_B_UpperShale(i,13);
LBU_stat(i,5)=Stage_Lnrd_B_UpperShale(i,14);
LBU_stat(i,6)=Stage_Lnrd_B_UpperShale(i,15);
else
LBU_stat(i,1)=NaN;
end
end
for i =1:size(Stage_Lnrd_B_Carb,1)
if log(Stage_Lnrd_B_Carb(i,8))<(normal_ranges(1,8)-normal_ranges(1,9)) && iflog(Stage_Lnrd_B_Carb(i,8))> normal_ranges(1,8)+normal_ranges(1,9)
LBC_app(i,1)=Stage_Lnrd_B_Carb(i,1);
LBC_app(i,2)=Stage_Lnrd_B_Carb(i,2);
LBC_app(i,3)=Stage_Lnrd_B_Carb(i,3);
LBC_app(i,4)=Stage_Lnrd_B_Carb(i,13);
LBC_app(i,5)=Stage_Lnrd_B_Carb(i,14);
LBC_app(i,6)=Stage_Lnrd_B_Carb(i,15);
else
LBC_app(i,1)=NaN;
end
if log(Stage_Lnrd_B_Carb(i,11))<(normal_ranges(2,8)-normal_ranges(2,9)) && log(Stage_Lnrd_B_Carb(i,11))> normal_ranges(2,8)+normal_ranges(2,9)
LBC_stat(i,1)=Stage_Lnrd_B_Carb(i,1);
LBC_stat(i,2)=Stage_Lnrd_B_Carb(i,2);
LBC_stat(i,3)=Stage_Lnrd_B_Carb(i,3);
LBC_stat(i,4)=Stage_Lnrd_B_Carb(i,13);
LBC_stat(i,5)=Stage_Lnrd_B_Carb(i,14);
LBC_stat(i,6)=Stage_Lnrd_B_Carb(i,15);
else
LBC_stat(i,1)=NaN;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%B Values of source radius
if Stage_Type==3
%first compare shale and carb above
Well_Type=[Stage_Type,1];
Plot_B_Vals(Stage_Lnrd_A_Shale(:,6),Stage_Massive_Carb(:,6),Well_Type)
%then shale and carb below
Well_Type=[Stage_Type,2];
Plot_B_Vals(Stage_Lnrd_A_Shale(:,6),Stage_Lnrd_A_Carb(:,6),Well_Type)
else
%first compare shale and carb above
Well_Type=[Stage_Type,1];
Plot_B_Vals(Stage_Lnrd_B_UpperShale(:,6),Stage_Massive_Carb(:,6),Well_Type)
%then shale and carb below
Well_Type=[Stage_Type,2];
Plot_B_Vals(Stage_Lnrd_B_UpperShale(:,6),Stage_Lnrd_B_Carb(:,6),Well_Type)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Plot Log normal CDP
for j=1:2
xx=[];
if j==1
xx=8;
end
if j==2
xx=11;
end
if Stage_Type==3
%first compare shale and carb above
Well_Type=[Stage_Type,1];
[mean_val1] = Plot_Log_Norm_PDFS(Stage_Lnrd_A_Shale(:,xx),Stage_Massive_Carb(:,xx),Well_Type,normal_ranges,xx);
%then shale and carb below
Well_Type=[Stage_Type,2];
[mean_val2] = Plot_Log_Norm_PDFS(Stage_Lnrd_A_Shale(:,xx),Stage_Lnrd_A_Carb(:,xx),Well_Type,normal_ranges,xx);
else
%first compare shale and carb above
Well_Type=[Stage_Type,1];
[mean_val1] = Plot_Log_Norm_PDFS(Stage_Lnrd_B_UpperShale(:,xx),Stage_Massive_Carb(:,xx),Well_Type,normal_ranges,xx);
%then shale and carb below
Well_Type=[Stage_Type,2];
[mean_val2] = Plot_Log_Norm_PDFS(Stage_Lnrd_B_UpperShale(:,xx),Stage_Lnrd_B_Carb(:,xx),Well_Type,normal_ranges,xx);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LAC_qc= [LAC_app LA_stat];
LAC_qc=LAC_qc(any(LAC_qc,2),:);
LAS_qc= [LAS_app LAS_stat ];
LAS_qc=LAS_qc(any(LAS_qc,2),:);
MC_qc= [MC_app MC_stat];
MC_qc=MC_qc(any(MC_qc,2),:);
LBU_qc= [LBU_app LBU_stat];
LBU_qc=LBU_qc(any(LBU_qc,2),:);
LBC_qc= [LBC_app LBC_stat];
LBC_qc=LBC_qc(any(LBC_qc,2),:);
if size(LAC_qc,1)>0
sprintf('consider QCing %d event(s) in Leonard A Carb. Locations saved in Excel.',size(LAC_qc,1))
else
sprintf('All Leonard A Carb events have source paramaters within a reasonable range.')
end
if size(LAS_qc,1)>0
sprintf('consider QCing %d event(s) in Leonard A Shale. Locations saved in Excel.',size(LAS_qc,1))
else
sprintf('All Leonard A Shale events have source paramaters within a reasonable range.')
end
if size(MC_qc,1)>0
sprintf('consider QCing %d event(s) in Massive Carbonate. Locations saved in Excel.',size(MC_qc,1))
else
sprintf('All Massic Carbonate events have source paramaters within a reasonable range.')
end
if size(LBU_qc,1)>0
sprintf('consider QCing %d event(s) in Leonard B Upper Shale. Locations saved in Excel.',size(LBU_qc,1))
else
sprintf('All Leonard B Upper Shale events have source paramaters within a reasonable range.')
end
if size(LBC_qc,1)>0
sprintf('consider QCing %d event(s) in Leonard B Carb. Locations saved in Excel.',size(LBC_qc,1))
else
sprintf('All Leonard B Carb events have source paramaters within a reasonable range.')
end
columns={'Northing app stress','Easting app stress','Depth app stress','N error','E error', 'D error',...
'Northing stat stress','Easting stat stress','Depth stat stress','N error','E error', 'D error'};
%
%
xlswrite (['Leonard A Carb events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
xlswrite (['Leonard A Shale events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
% xlswrite (['Massive Carb events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
% xlswrite (['Leonard B Upper Shale events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
% xlswrite (['Leonard B Carb events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
% xlswrite (['All events to QC from Source Paramaters ' sprintf('%s',filename)],LAC_qc,'sheet1','A2')
%
% xlswrite (['Leonard A Carb events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
% xlswrite (['Leonard A Shale events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
% xlswrite (['Massive Carb events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
% xlswrite (['Leonard B Upper Shale events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
% xlswrite (['Leonard B Carb events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
% xlswrite (['All events to QC from Source Paramaters ' sprintf('%s',filename)],columns,'sheet1','A1')
end