-
Notifications
You must be signed in to change notification settings - Fork 6
/
Basic well log interpretation-test_vsh_NMR.py
1221 lines (939 loc) · 43.2 KB
/
Basic well log interpretation-test_vsh_NMR.py
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
"""
Used Spyder Editor
"""
"""
===============================================================================
Import data from text file into a pandas Dataframe called: ``data''.
Null data (-999.00000) will be replace by numpy.nan and M__DEPTH changed
with DEPT (much common abrevation in las files)
===============================================================================
"""
import math
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
data=pd.read_table('GulfCoast_NMR.txt', delim_whitespace=True, index_col='DEPTH')
# The following is from Atibalazs Issues reported on Nov 7, 2018
#data=pd.read_table('WA1.txt', delim_whitespace=True)
#data=data.replace(-999.00000,np.nan)
#data=data.rename(columns=({'M__DEPTH':'DEPT'}))
#data=data.replace('-999.00000',np.nan)
data=data.replace(-999.25,np.nan)
data=data.rename(columns=({'DEPTH':'DEPT'}))
data['DEPT']=data.index
#data['NPHI']=data['NPHI']-0.04 #if Neutron on SS matrix, convert to ls
data['NPHI']=data['NPHI']
"""
===============================================================================
The following are the log parameter inputs for all calculations
===============================================================================
===============================================================================
Shale and Porosity Parameters for many Calculations
Mihai has a 100% clay point that I do not think is possible.
We use a 100% shale point
===============================================================================
"""
gr_clean, gr_shale = 45, 120 # Shale Parmaetrs for GR
sp_clean, sp_shale = -50, 0 # Shale Parameters for SP
neut_shale, den_shale, por_shale = 0.39, 2.48, 0.24 # Shale Parmaters for Neutron-Density
neut_matrix, den_matrix = -0.02, 2.65 # Matrix Parmameters for Neutron-Density
neut_fl, den_fl = 1.0, 1.1 # Fluid Parameters for Neutron-Density
dt_matrix, dt_fluid, dt_shale, cp, alpha = 55.5,188.0,90.0,1,5/8 # Sonic Parameters
"""
===============================================================================
Electrical Properties
===============================================================================
===============================================================================
We need to define first the variables: m_cem, n_sat. You can start with this
pair(m_cem=2,_satn=2) as it works well in most of lithologies. If your
matrix is shaly-mixed, the you can decrease the m_cem to 1.8.
==============================================================================
IMO turtuosity factor 'a' should be 1.0 at 100% porosity where FF = Ro/Rw = 1
==============================================================================
"""
m_cem = 2.0 #cementation factor
n_sat = 2.0 #saturation exponent
# Slope of Swb vs. Mstar apparent for Mstar across all Swb's
mslope = 3.
"""
===============================================================================
Then choose the water resistivity: Rwa. We’ll plot log Resistivity vs.
log Porosity in Pickett plot. Data can be selected just for the reservoir
formations (excluding the shaly intervals) by working with the vsh_limit
(volume of shale) variable.
===============================================================================
"""
T = 150. # Reservoir temperature in DegF
TC=(T-32)/1.8 # Temp DegC
RwT = T # Temperature of Rw measument
rwa=0.03 # water resistivity at RwT
vsh_limit=0.5 # volume of shale upper limit for selction of data for graph
"""
===============================================================================
Calculations used with Saturations
===============================================================================
"""
Rw75=((RwT+6.77)*rwa)/(75+6.77)
# Salinity in KPPM
SAL=(10**((3.562-math.log10(Rw75-0.0123))/0.955))/1000
B = math.exp(7.3-28.242/math.log(T)-0.2266*math.log(rwa))
Bdacy=(1-0.83*math.exp(-math.exp(-2.38+(42.17/TC))/rwa))*(-3.16+1.59*math.log(TC))**2 #SCA Paper SCA2006-29
print('Res temp =', T, 'Rw at Res Temp =',rwa, 'Rw@75 =', Rw75, 'B =',B, 'Bdacy =',Bdacy,'SAL =', SAL)
#CW = (T+7.)/(rwa*(RwT+7.))
##---- CCW FROM COATES
#CCW = 0.000216*(T-16.7)*(T+504.4)
#print('Cw =', CW, 'CCW =', CCW)
"""
===============================================================================
Major Zones of Interest
===============================================================================
===============================================================================
a Main ZONE for analysis will be selected from the entire log. Program displays
the logs again within the choosen interval with triple_combo_plot
function.
=== Select zone of analysis: top and depth
by setting the ``top_depth'' and ``bottom_depth'' variables
===============================================================================
"""
top_depth = 4500
bottom_depth = 4750
"""
===============================================================================
Primary Zone of Interest
===============================================================================
===============================================================================
Summary or Primary Zone of interest depths are required here
===============================================================================
"""
top_summary = 4500
bottom_summary = 4750
"""
===============================================================================
=== 1. Add formation tops & depths
===============================================================================
"""
tops = ('TOP of ZONE','BOTTOM of ZONE','TD')
tops_depths=(4500,4750,5000)
"""
===============================================================================
=== 2. Display the logs in Triple Combo Plot
A triple-combo display will be created in matplotlib in order to
visualize the curves. The template will be incorporated into the triple
combo_plot function dependent on the selection of top and bottom depths
of the graph.
The triple combo display will consist in: - First track: GR, SP, CALI -
Second track: Resistivities - Third Track: Density, Sonic and Neutronic
In the next code lines, we will set the template.
===============================================================================
"""
# Create the TRIPLE COMBO figure and subplots
def triple_combo_plot(top_depth,bottom_depth):
logs=data[(data.DEPT >= top_depth) & (data.DEPT <= bottom_depth)]
fig, ax = plt.subplots(nrows=1, ncols=4, figsize=(12,16), sharey=True)
fig.suptitle("Well Composite", fontsize=22)
fig.subplots_adjust(top=0.75,wspace=0.1)
#General setting for all axis
for axes in ax:
axes.set_ylim (top_depth,bottom_depth)
axes.invert_yaxis()
axes.yaxis.grid(True)
axes.get_xaxis().set_visible(False)
for (i,j) in zip(tops_depths,tops):
if ((i>=top_depth) and (i<=bottom_depth)):
axes.axhline(y=i, linewidth=1.0, color='red')
axes.text(0.1, i ,j, horizontalalignment='center',verticalalignment='center', color = 'red')
#1st track: GR, CALI, SP track
ax01=ax[0].twiny()
ax01.set_xlim(-100,10)
ax01.spines['top'].set_position(('outward',0))
ax01.set_xlabel("SP [mV]")
ax01.plot(logs.SP, logs.DEPT, label='SP[mV]', color='black',linewidth=3.0)
ax01.set_xlabel('SP[mV]',color='black')
ax01.tick_params(axis='x', colors='black')
ax01.grid(True)
ax02=ax[0].twiny()
ax02.set_xlim(6,36)
ax02.plot(logs.CALI, logs.DEPT, '--', label='CALN[in]', color='blue')
ax02.spines['top'].set_position(('outward',40))
ax02.set_xlabel('CALI[in]',color='blue')
ax02.tick_params(axis='x', colors='blue')
ax03=ax[0].twiny()
ax03.set_xlim(0,150)
ax03.plot(logs.GR, logs.DEPT, label='GR[api]', color='green')
ax03.spines['top'].set_position(('outward',80))
ax03.set_xlabel('GR[api]',color='green')
ax03.tick_params(axis='x', colors='green')
#2nd track: Resistivities
ax11=ax[1].twiny()
ax11.set_xlim(0.1,100)
ax11.set_xscale('log')
ax11.grid(True)
ax11.spines['top'].set_position(('outward',80))
ax11.set_xlabel('ILD[ohmm]', color='red')
ax11.plot(logs.ILD, logs.DEPT, label='ILD[ohmm]', color='red', linewidth=2.0)
ax11.tick_params(axis='x', colors='red')
ax12=ax[1].twiny()
ax12.set_xlim(0.1,100)
ax12.set_xscale('log')
ax12.plot(logs.ILM, logs.DEPT, label='ILM[ohmm]', color='purple')
ax12.spines['top'].set_position(('outward',40))
ax12.set_xlabel('ILM[ohmm]', color='purple')
ax12.tick_params(axis='x', colors='purple')
ax13=ax[1].twiny()
ax13.set_xlim(0.1,100)
ax13.set_xscale('log')
ax13.plot(logs.LL8, logs.DEPT, '--',label='LL8[ohmm]', color='blue')
ax13.spines['top'].set_position(('outward',0))
ax13.set_xlabel('LL8[ohmm]',color='blue')
ax13.tick_params(axis='x', colors='blue')
#3rd track: DT, RHOB, NPHI track
ax21=ax[2].twiny()
ax21.grid(True)
ax21.set_xlim(115,36)
ax21.spines['top'].set_position(('outward',0))
ax21.set_xlabel('DT[us/ft]')
ax21.plot(logs.DT, logs.DEPT, label='DT[us/ft]', color='blue')
ax21.set_xlabel('DT[us/ft]', color='blue')
ax21.tick_params(axis='x', colors='blue')
ax22=ax[2].twiny()
ax22.set_xlim(-0.15,0.45)
ax22.invert_xaxis()
ax22.plot(logs.NPHI, logs.DEPT, label='NPHI[v/v]', color='green')
ax22.spines['top'].set_position(('outward',40))
ax22.set_xlabel('NPHI[v/v]', color='green')
ax22.tick_params(axis='x', colors='green')
ax23=ax[2].twiny()
ax23.set_xlim(1.95,2.95)
ax23.plot(logs.RHOB, logs.DEPT ,label='RHOB[g/cc]', color='red')
ax23.spines['top'].set_position(('outward',80))
ax23.set_xlabel('RHOB[g/cc]',color='red')
ax23.tick_params(axis='x', colors='red')
ax24=ax[2].twiny()
ax24.set_xlim(-0.15,0.45)
ax24.invert_xaxis()
ax24.plot(logs.PHIX, logs.DEPT, label='PHIX[v/v]', color='cyan')
ax24.spines['top'].set_position(('outward',120))
ax24.set_xlabel('PHIX[v/v]', color='cyan')
ax24.tick_params(axis='x', colors='cyan')
#plt.savefig ('triple_combo_plot.png', dpi=200, format='png')
#4th track: NMR
ax31=ax[3].twiny()
ax31.grid(True)
ax31.set_xlim(0.5,0)
ax31.spines['top'].set_position(('outward',0))
ax31.set_xlabel('MPHI[v/v]')
ax31.plot(logs.MPHI, logs.DEPT, label='MPHI[v/v]', color='black')
ax31.set_xlabel('MPHI[v/v]', color='black')
ax31.tick_params(axis='x', colors='black')
ax32=ax[3].twiny()
ax32.grid(True)
ax32.set_xlim(0.5,0)
ax32.spines['top'].set_position(('outward',40))
ax32.set_xlabel('MBVI[v/v]')
ax32.plot(logs.MBVI, logs.DEPT, label='MBVI[v/v]', color='black')
ax32.set_xlabel('MBVI[v/v]', color='black')
ax32.tick_params(axis='x', colors='black')
ax32.fill_betweenx(logs.DEPT,logs.MBVI, 0,color='blue',label= 'MBVI')
ax32.fill_betweenx(logs.DEPT,logs.MPHI, logs.MBVI,color='yellow',label= 'Free Fluid')
# =============================================================================
# Display the logs for the whole well
# =============================================================================
triple_combo_plot(data.DEPT.min(),data.DEPT.max())
# =============================================================================
# a ZONE for analysis will be selected from the entire log. Let’s display
# again the logs within the choosen interval with triple_combo_plot
# function.
# =============================================================================
#Plot again using new Top and Bottom Depths. Could you do this with tops?
triple_combo_plot(top_depth,bottom_depth)
"""
===============================================================================
=== 3. Calculate Volume of Shale
The first step of a basic well log analysis will begin with the volume
of Shale calculation.
There are several methods used to perform that, clasified as: - Single
methods: Gamma Ray Log, Spontaneous Potential, vshrt or by - Dual
Methods: Neutron-Density, it is based on a N-D Crossplot, where a clean
line and a clay point will be defined, as you will see in the graphs
below.
===============================================================================
"""
#vshgr
#---the setup below is correction = None or linear GR as recommended by Heslep
def vshgr(gr_log, gr_clean, gr_shale, correction=None):
igr=(gr_log-gr_clean)/(gr_shale-gr_clean) #Linear Gamma Ray
vshgr_larionov_young=0.083*(2**(3.7*igr)-1) #Larionov (1969) - Tertiary rocks
vshgr_larionov_old=0.33*(2**(2*igr)-1) #Larionov (1969) - Older rocks
vshgr_clavier=1.7-(3.38-(igr+0.7)**2)**0.5 #Clavier (1971)
vshgr_steiber=0.5*igr/(1.5-igr) #Steiber (1969) - Tertiary rocks
if correction == "young":
vshgr=vshgr_larionov_young
elif correction == "older":
vshgr=vshgr_larionov_old
elif correction=="clavier":
vshgr=vshgr_clavier
elif correction=="steiber":
vshgr=vshgr_steiber
else:
vshgr=igr
return vshgr
#vshsp
def vshsp(sp_log, sp_clean, sp_shale):
vshsp=(sp_log-sp_clean)/(sp_shale-sp_clean)
return vshsp
#vshrt
def vshrt(rt_log, rt_clean,rt_shale):
vrt=(rt_shale/rt_log)*(rt_clean-rt_log)/(rt_clean-rt_shale)
if (rt_log > 2* rt_shale):
vshrt = 0.5 * (2 * vrt)** (0.67*(vrt+1))
else:
vshrt = vrt
return vshrt
##vshnd
#def vshnd(neut_log,den_log,neut_matrix,den_matrixtrix,neut_fl,den_fl,neut_shale,den_shaleale):
# term1 = (den_fl-den_matrixtrix)*(neut_log-neut_matrix)-(den_log-den_matrixtrix)*(neut_fl-neut_matrix)
# term2 =(den_fl-den_matrixtrix)*(neut_shale-neut_matrix)-(den_shaleale-den_matrixtrix)*(neut_fl-neut_matrix)
# vshnd=term1/term2
# return vshnd
#vshnd
def vshnd(neut_log,den_log,neut_matrix,den_matrix,neut_fl,den_fl,neut_shale,den_shale):
term1 = (den_fl-den_matrix)*(neut_log-neut_matrix)-(den_log-den_matrix)*(neut_fl-neut_matrix)
term2 =(den_fl-den_matrix)*(neut_shale-neut_matrix)-(den_shale-den_matrix)*(neut_fl-neut_matrix)
vshnd=term1/term2
return vshnd
# =============================================================================
# #vshnd with Neutron on limestone matrix
# def vshnd(neut_log,den_log,neut_shale,den_shaleale, den_fl):
# term1 =(neut_shale*(den_log-2.710)-(den_shaleale-2.710)*neut_log) / (neut_shale*(den_fl-2.710)-(den_shaleale-2.710))
# vshnd=(neut_log - term1)/neut_shale
# return vshnd
# =============================================================================
# ======= This was the original from Mahai and I do not use clay ==============
# neut_matrix, den_matrixtrix = 15, 2.6 #Define clean sand line
# neut_fl, den_fl = 40, 2
#
# #there is no 100% clay point so a clay pointon the RBOB vs. NPHI xplot is not possible.
# # CP needs to fix this
# neut_clay, den_clay = 47.5, 2.8
# =============================================================================
# Input parameters for Top and Bottom depths
logs=data[(data.DEPT >= top_depth) & (data.DEPT <= bottom_depth)]
# calculate the vsh functions, by looping with pandas series values through vsh functions defined above
# without looping - the function will throw an error
#initialize various Vsh
vshgr_temp,vshnd_temp, vshrt_temp, vshsp_temp =[],[],[],[]
# ===== this is an example of for a,b in zip(alist,blist): ====================
# alist = ['a1', 'a2', 'a3']
# blist = ['b1', 'b2', 'b3']
#
# for a, b in zip(alist, blist):
# print a, b
#
# =============================================================================
# =============================================================================
# This is key for the input of log data to be used in Vsh calculations
# =============================================================================
for (i,j,k,l,m) in zip(logs.GR,logs.NPHI,logs.RHOB,logs.ILD,logs.SP):
vshgr_temp.append(vshgr(i, gr_clean, gr_shale))
vshnd_temp.append(vshnd(j,k,neut_matrix,den_matrix,neut_fl,den_fl,neut_shale,den_shale))
vshsp_temp.append(vshsp(m, sp_clean, sp_shale))
# =============================================================================
# This is key for the input of log data to be used in Vsh calculations
# =============================================================================
#======== test this as it prints GR, NPHI, RHOB, ILD, SP =====================
# print(i,j,k,l,m) #where i=GR, j=NPHI, k=RHOB, l=ILD and m=SP
#==============================================================================
logs.is_copy = False # without will throw an exception
logs['vshgr']=vshgr_temp
logs['vshnd']=vshnd_temp
logs['vshsp']=vshsp_temp
del vshgr_temp, vshnd_temp, vshsp_temp #remove the arrays to free-up memory
# =============================================================================
# We will create several displays (GR,SP vs DEPTH track, histograms, N-D
# crossplot, vsh track) in order to see and choose the right parameters
# for our clay/clean formations as well as to compare the results of all
# vsh methods calculated above.
# =============================================================================
from matplotlib import gridspec
#logs=data.iloc[[top_depth],[bottom_depth]]
#logs=data[(data.DEPT >= top_depth) & (data.DEPT <= bottom_depth)]
#print (logs.GR,logs.LLD)
#Setting GRAPH ELEMENTS
fig = plt.figure(figsize=(12,10))
fig.suptitle('Volume of Shale from Different Methods',fontsize=18)
fig.subplots_adjust(top=0.90,wspace=0.3, hspace =0.3)
gs = gridspec.GridSpec(4, 3)
ax1 = fig.add_subplot(gs[:,0])
ax2 = fig.add_subplot(gs[0,1])
ax3 = fig.add_subplot(gs[1,1])
ax4 = fig.add_subplot(gs[2,1])
ax5 = fig.add_subplot(gs[3,1])
ax6 = fig.add_subplot(gs[:,2],sharey = ax1)
# Graph for GR,SP
ax1.invert_yaxis()
ax1.grid(True)
ax1.set_ylabel('DEPTH')
ax1.plot(logs.GR, logs.DEPT, color='green')
ax1.set_xlabel('GR [api]', color='green')
ax11=ax1.twiny()
ax11.plot(logs.SP, logs.DEPT, color='black', linewidth = 3.0)
ax11.set_xlabel("SP [mV]",color='black')
#The graph of GR histogram
ax2.hist(logs.GR.dropna(),bins=30,color='green')
ax2.set_xlabel('GR [api]')
ax2.set_ylabel('Frequency')
ax3.hist(logs.SP.dropna(),bins=30, color='black')
ax3.set_xlabel('SP [mV]')
ax3.set_ylabel('Frequency')
ax4.hist(logs.ILD.dropna(),bins=30, color='gray')
ax4.set_xlabel('ILD [ohmm]')
ax4.set_ylabel('Frequency')
# N-D XPlot for Volume of Shale
ax5.plot(logs.NPHI, logs.RHOB,'ro',markersize=4)
ax5.set_xlabel('NPHI [v/v]')
ax5.set_xlim(-.05,1.0)
ax5.set_ylim(3,1.0)
ax5.set_ylabel('RHOB [g/cc]')
ax5.grid(True)
ax5.text(0.05, 2.1, 'clean line', color='red', fontsize=8)
ax5.text(0.350, 2.95, 'shale point',color='red', fontsize=8)
ax5.text(0.6, 1.2, 'fluid point',color='red', fontsize=8)
# Plot Shale Triangle
ax5.plot([neut_matrix,neut_fl],[den_matrix,den_fl], marker='o', color='blue') # this is clean line
#ax5.plot([neut_matrix,1],[den_shaleale,1], marker='o', color='blue') #this is the clean line
ax5.plot([neut_matrix,neut_shale],[den_matrix,den_shale], marker='o', color='blue') #this is to the shale point
ax5.plot([neut_shale,1],[den_shale,den_fl], marker='o', color='blue') #this is from the shale point to 100% porosity line
ax5.plot(neut_shale,den_shale,'ro',color='blue')
#plt.title("Volume of Shale")
ax6.plot(logs.vshgr, logs.DEPT, label ='Vshgr',color="green")
ax6.plot(logs.vshnd, logs.DEPT,label ='Vshnd',color="red")
ax6.plot(logs.vshsp, logs.DEPT,label ='Vshsp',color="black")
ax6.legend(loc='best',fontsize='x-small')
ax6.set_xlim(0,1)
ax6.set_ylim(top_depth,bottom_depth)
ax6.invert_yaxis()
ax6.grid(True)
ax6.set_xlabel('Vsh [v.v]')
#plt.savefig ('vsh_plot.png', dpi=200, format='png')
# =============================================================================
# Use the histrograms to re-evaluate: - GR min, max (clean, clay) - SP
# min, max (clean, clay) - RT min, max (clean, clay) From ND Xplot extract
# the clean line and clay point.
#
# All vshgr (you can apply any correction here), vshsp, vshrt and vshnd
# curves are plotted in the same track for comparison. It is obvious that
# the vshgr and vshnd match very well, comparing with the rest.
#
# To simplify the intepretation we will accept the vshgr as the vsh.
# Another approch is to consider vsh as the minimum value obtained through
# several methods (vsh = min (vshgr,vshsp,vshnd)) or Hodges-Lehman Median Filter
# =============================================================================
logs['vsh']=(logs['vshnd']).clip(0,1)
"""
===============================================================================
=== 4. The Porosity:
Three logs are available for porosity estimation: sonic, density and
neutron. Porosity can be evaluated by single or dual combinations of
any three types mentioned: neutron-density, neutron-sonic and
sonic-density. Basic porosity formulas are: - Sonic: Willie,
Raymer-Hunt-Gardner; - Density; - Neutronic;
The NEUTRON-DENSITY gives best result in any type of lithology
===============================================================================
"""
#Willie-TimeAverage
def phis_shale(dt_shale, dt_matrix, dt_fluid):
phis_shale = (dt_shale-dt_matrix)/(dt_fluid-dt_matrix)
return phis_shale
def phis_w(dt_log, dt_matrix, dt_fluid, cp):
phis_w=(1/cp)*(dt_log-dt_matrix)/(dt_fluid-dt_matrix)
return phis_w
def phis_w_sh_corr(dt_log, dt_matrix, dt_fluid, cp, dt_shale, vsh):
phis_w=(1/cp)*(dt_log-dt_matrix)/(dt_fluid-dt_matrix)
phis_w_sh = (dt_shale-dt_matrix)/(dt_fluid-dt_matrix)
phis_w_sh_corr = phis_w - vsh * phis_w_sh
return phis_w_sh_corr
#Raymer-Hunt-Gardner (the alpha(5/8) ranges from 0.625-0.70, 0.67-most, 0.60-gas reservoirs)
def phis_rhg(dt_log, dt_matrix, alpha):
phis_rhg=(alpha)*(dt_log-dt_matrix)/(dt_log)
return phis_rhg
def phis_rhg_sh_corr(dt_log, dt_matrix, dt_shale, vsh):
phis_rhg=(5/8)*(dt_log-dt_matrix)/(dt_log)
phis_rhg_sh = (dt_shale-dt_matrix)/(dt_fluid-dt_matrix)
phis_rhg_sh_corr = phis_rhg - vsh * phis_rhg_sh
return phis_rhg_sh_corr
#Density
def phid(den_log, den_matrix, den_fl, den_shale, vsh):
phid = (den_log - den_matrix) / (den_fl - den_matrix)
return phid
def phid_shale(den_shale, den_matrix, den_fl):
phid_shale = (den_shale - den_matrix) / (den_fl - den_matrix)
return phid_shale
def phid_sh_corr(den, den_matrix, den_fl, den_shale, vsh):
phid = (den - den_matrix) / (den_fl - den_matrix)
phid_sh = (den_shale - den_matrix) / (den_fl - den_matrix)
phid_sh_corr = phid - vsh * phid_sh
return phid_sh_corr
# NEUTRON:
def phin_sh_corr(neut, neut_sh, vsh):
phin_sh_corr = (neut-vsh*neut_sh)
return phin_sh_corr
#Neutron-Density
def phixnd(phinshc, phidshc):
phixnd= (phinshc + phidshc) / 2
return phixnd
def phixnd_gas_corr(phin, phid, phin_sh, phid_sh):
phixnd_gas_corr= ((phin**2+phin**2)/2)**(0.5) #for gas intervals (nphi<dphi = crossover)
return phixnd_gas_corr
phis_sh=phis_shale(dt_shale, dt_matrix, dt_fluid)
#phid_sh=phis_shale(den_shale, den_matrix, den_fl) is this a type using phis_shale and not phid_shale???
phid_sh=phid_shale(den_shale, den_matrix, den_fl)
######phin_sh=45
phin_sh=neut_shale
#calculate the vsh functions, by looping with pandas series values through vsh functions defined above
logs['PHISw']=phis_w(logs.DT, dt_matrix, dt_fluid, cp)
logs['PHISwshc']=phis_w_sh_corr(logs.DT, dt_matrix, dt_fluid, cp, dt_shale, logs.vsh).clip(0,1)
logs['PHISrhg']=phis_rhg(logs.DT, dt_matrix, alpha)
logs['PHISrhgshc']=phis_rhg_sh_corr(logs.DT, dt_matrix, dt_shale, logs.vsh).clip(0,1)
logs['PHID']=phid(logs.RHOB, den_matrix, den_fl, den_shale, logs.vsh)
logs['PHIDshc']=phid_sh_corr(logs.RHOB, den_matrix, den_fl, den_shale, logs.vsh).clip(0,1)
logs['PHIN']=logs.NPHI
logs['PHINshc']=phin_sh_corr(logs.NPHI, phin_sh, logs.vsh).clip(0,1)
logs['PHIxND']=phixnd(logs.PHINshc,logs.PHIDshc).clip(0,1)
# A PHIxND porosity is a good estimation of effective porosity. Calculated
# porosities above are similar with core porosities (see
# http://certmapper.cr.usgs.gov/data/PubArchives/OF00-200/WELLS/WALAKPA1/LAS/WA1LOG.JPG)
######logs['PHIE']=logs['PHIxND']
#logs['PHIT']=logs['PHIxND']
logs['PHIT']=((logs['PHID']+logs['NPHI'])/2).clip(0,1)
#logs['PHIT']=logs['Phixnd_chartbook']
#logs['PHIE']=logs['PHIT'] - por_shale*logs['vsh']
logs['CBW'] = (por_shale*logs['vsh']).clip(0,1)
logs['PHIE']=(logs['PHIT'] - por_shale*logs['vsh']).clip(0,1)
# Calculations for Swb used in Dual Water and WaxSmits
logs['Swb'] =( 1 - logs['PHIE']/logs['PHIT']).clip(0,1)
# Qv from Swb using Hill, Shirley and Klein
logs['Qv'] = (logs['Swb']/(0.6425/((den_fl*SAL)**0.5) +0.22)).clip(0,5)
# MBVI in Total Porosity System
#logs['BVIT'] = logs['MBVI'] + logs['CBW']
#logs['SWBI'] = logs['CBW']/logs['PHIT']
#----- COMPUTE DCW ------------------------------
#ALPHA = 1 #for now with Salinity > 40,000 ppm
#logs['DCWW'] = CW + ALPHA*logs['Swb'] *(CCW-CW)
#logs['DCWI'] = CW + ALPHA*logs['SWBI']*(CCW-CW)
#logs['Ct'] = 1/logs['ILD']
#logs['logPHIT'] = math.log10(logs['PHIT'])
#----- W @ Sw = 1 -----------------------------------
#logs['WW'] = math.log10(1/logs['ILD']/logs['DCWW'])/(math.log10(logs['PHIT']))
#----- W @ Sw AT BVI --------------------------------
#logs['WI'] = math.log10(1/logs['ILD']/logs['DCWI'])/(math.log10(logs['BVIT']))
# =============================================================================
#
# This is not working
#
# Mstarapp=LOG10(RWG*A/(RT*(1+RWG*B*QV)))/LOG10(TPOR)
# logs['Mstarapp'] = math.log10( rwa/logs['ILD']*(1+rwa*B*logs['Qv']) ) / math.log10(logs['PHIT'])
# logs['Mstarapp'] = math.log10( rwa/logs['ILD']*(1+rwa*B*logs['Qv']) ) / 10**(logs['PHIT'])
#
# =============================================================================
#logs['term1'] =( rwa/logs['ILD']*(1+rwa*B*logs['Qv']) )
#logs['term2'] = (logs['PHIT'])
#logs['Mstarapp']=math.log(10,logs['term1'])/math.log(10,logs['term2'])
logs['Mstarapp'] = m_cem + mslope*logs['Swb']
"""
===============================================================================
=== 5. Water Saturation
Before calculating the water saturation we need a value for the Rw(Resistivity of water)
===== Resistivity of water
It can be determined from: - water catalogs - DST test water analysis -
Rw from SP (needs information about Rmud and … ) - Rwa Method (Rw from a
100% water zone)
Assume that we have no ideea about the Rw of water, then best practice is a
PICKETT plot. This plot is logarithmic plot using Gus Archie’s equation:
===== Archie Water Saturation Eq.
Sw^n_sat = (a * Rw) / (Rt * PHI ^ m_cem)
Equation can be re-write in a logarithm way and plotted in a log graph
RT vs PHI:
log(PHI) = - (1 / m_cem) * log(R_t) - n_sat * log(Sw) + log( a * Rw)
IMO we should use 'a' = 1 since at 100% Porosity Ro/Rw = 1
"""
import matplotlib.ticker as ticker
pickett_figure=plt.figure(figsize=(7,6))
plt.title('Pickett Plot'+ ' for Vsh < '+str(int(vsh_limit*100))+'%', color = 'blue')
plt.loglog(logs.ILD[logs.vsh<vsh_limit],logs.PHIT[logs.vsh<vsh_limit],'ro', label='',color='red')
plt.xlim(0.01,1000)
plt.ylim(0.01,1)
plt.ylabel('PHIT [v/v]', color = 'blue')
plt.xlabel('ILD [ohmm]', color = 'blue')
plt.gca().xaxis.set_major_formatter(ticker.FormatStrFormatter("%.2f"))
plt.gca().yaxis.set_major_formatter(ticker.FormatStrFormatter("%.2f"))
#calculate the saturation lines
sw_plot=(1.0,0.8,0.6,0.4,0.2)
phie_plot=(0.01,1)
rt_plot=np.zeros((len(sw_plot),len(phie_plot)))
for i in range (0,len(sw_plot)):
for j in range (0,len(phie_plot)):
rt_result=((1*rwa)/(sw_plot[i]**n_sat)/(phie_plot[j]**m_cem))
rt_plot[i,j]=rt_result
for i in range(0,len(sw_plot)):
plt.plot(rt_plot[i],phie_plot, label='SW '+str(int(sw_plot[i]*100))+'%')
plt.legend (loc='best')
plt.grid(True, which='both',ls='-',color='gray')
#plt.savefig('pickett.png', dpi=200, format='png')
cbw_figure=plt.figure(figsize=(3,3))
plt.title('Vsh vs.CBW', color = 'blue')
plt.plot(logs.vsh,logs.CBW,'ro', label='',color='red')
plt.xlim(0.0,1)
plt.ylim(0.0,1)
plt.ylabel('CBW [v/v]', color = 'blue')
plt.xlabel('Vsh [v/v]', color = 'blue')
plt.grid(True, which='both',ls='-',color='gray')
mapp_figure=plt.figure(figsize=(3,3))
plt.title('Swb vs.Mstar_Apparent', color = 'blue')
plt.plot(logs.Swb,logs.Mstarapp,'ro', label='',color='red')
plt.xlim(0.0,1)
plt.ylim(1.0,5)
plt.ylabel('Mstar Apparent', color = 'blue')
plt.xlabel('Swb [v/v]', color = 'blue')
plt.grid(True, which='both',ls='-',color='gray')
# =============================================================================
# # From the Picket plot results that we are dealing with two different zone
# # intervals, that need to be divided and interpreted separately. For now,
# # we will choose a resonable Rwa and calculate the Sw curve with Archie.
# =============================================================================
# Add the equation in a function named: sw_archie,
def sw_archie(Rw, Rt, Poro, a, m_cem, n_sat):
F = 1 / (Poro**m_cem)
Sw_archie = (F * Rw/Rt)**(1/n_sat)
return Sw_archie
def sw_dw(Rw, T, RwT, Rt, PHIT, PHIE, Swb, MBVI, MPHI):
'''
dualwater(Rw, Rt, PHIT, por_shale, Vsh, Rsh)
**Dual-Water (clavier, 1977) with later modifications/rearrangements.
Formulas from Doveton "Principles of mathematical petrophysics"
*Input parameters:
- PHIT - total porosity
- por_shale - shale porosity
- Rw - formation water resistivity [ohmm]
- Swb - clay-bound water saturation
- Sw_dw - total water saturation
*Returns:
- Sw_dw - Total water saturation (or water saturation in Total pore space)
- CBVWT - Coates DW CBW in Total Porossity system
1. Coates, G.R., Gardner, J.S., and Miller, D.L., 1994,
Applying pulse-echo NMR to shaly sand formation evaluation,
paper B, 35th Annual SPWLA Logging Symposium Transactions, 22 p.
'''
#--------------------------------------------------
#
# BEGINNING OF MRIAN AS PROPOSED BY COATES, et al
#
#----- COMPUTE BASIC DATA -------------------------
#RwT = T
CW = (T+7.)/(Rw*(RwT+7.))
#---- CCW FROM COATES
CCW = 0.000216*(T-16.7)*(T+504.4)
Ct = 1/Rt
#--------------------------------------------------
#Swb = 1.0 - (PHIE/PHIT)
Swia=MBVI/MPHI
#Swia = Swb #estimate
#--------------------------------------------------
CBW = Swb * PHIT
# MBVI in Total Porosity System
BVIT = MBVI + CBW
SWBI = CBW/PHIT
#----- COMPUTE DCW ------------------------------
ALPHA = 1 #for now with Salinity > 40,000 ppm
DCWW=CW+ALPHA*Swb*(CCW-CW)
DCWI=CW+ALPHA*SWBI*(CCW-CW)
#----- W @ Sw = 1 -----------------------------------
#WW=math.log10(Ct/DCWW)/(math.log10(PHIT))
#----- W @ Sw AT BVI --------------------------------
#WI=math.log10(Ct/DCWI)/(math.log10(BVIT))
#----- THE ACTUAL W ---------------------------------
Wq = 0.4*Swia + 1.65
#Wq = 0.4*Swia + 1.9
#----- WW AND WI CONSTRAN W ------------------------
#----- COMPUTE CBVW TOTAL -----------------------
#AA=CW
#BB=ALPHA*(CBW)*(CW-CCW)
#CC=Ct
#CBVWA = (BB + math.sqrt(BB*BB + 4*AA*CC))/(2*AA)
CBVWA = (ALPHA*(CBW)*(CW-CCW) + ((ALPHA*(CBW)*(CW-CCW))**2 + 4*CW*Ct)**(1/2))/(2*CW)
CBVWT = CBVWA**(2/Wq)
#---- COMPUTE Bulk Volume Water CBVWE in Effective System ----------
#CBVWE = CBVWT-CBW
Sw_dw = CBVWT/PHIT
return Sw_dw
#------------------------------------------------------------
# END OF GEORGE COATES' MRIAN
#-------------------------------------------------------------
def waxmansmits(Rw, T, RwT, Rt, PHIT, PHIE, den_fl, m_cem, mslope, Swb, Rw75, Qv, B):
'''
waxmansmits(Rw, Rt, PhiT, aa, mm, CEC)
**Waxman-Smits CEC method obtains Qv from Hill, Shirley and Klein
Eq solved for n=2
*Input parameters:
- PHIT - total porosity
- m_cem - cementation exponent is adjusted for Swb
- Rw - formation water resistivity ohmm
- B - cation mobility (mho cm2 / meq)
- Qv - concentration of exchange cations per volume unit (meq/ml pore space)
- CEC - cation exchange capacity of shale(meq/100 gm of sample)
- den_ma - mineral graind density (g/cc)
- m_cem - best determined from SCAL
*Returns:
- Sw_Total_WS - total water saturation from Waxman-Smits
- Sw_WS =( ((1/PHIT**mstar)*Rw)/Rt*(1+Rw*B*QV)/Sw )**(1/nstar)
'''
#convert m_cem to mstar with increase in mstar with increase in Swb
mstar = m_cem + mslope*Swb
#Crain's Waxman-Smits in lieu of using iterative.
#Swc = 0.5 * ((- B * Qv * RW2) + ((B * Qv * RW2)**2 + 4 * F * RW@FT / RESD) ^ 0.5)**(2 / N)
swT = 0.5 * ( (- B*Qv*Rw75) + ( (B*Qv*Rw75)**2 + 4*(1/PHIT**mstar)*Rw/Rt)**0.5)**(2/2)
return swT
Rw =rwa
logs['Sw_archie']=(sw_archie(Rw,logs.ILD,logs.PHIT,1,m_cem,n_sat)).clip(0,1)
#Calculate the BVW (bulk volume of water) for Archie:
logs['BVW']=(logs['Sw_archie']*logs['PHIT']).clip(0,1)
logs['Sw_dw'] =(sw_dw(Rw, T, RwT, logs.ILD, logs.PHIT, logs.PHIE,logs.Swb,logs.MBVI,logs.MPHI)).clip(0,1)
#Calculate the BVW Effective for DW:
logs['CBVWE']=(logs['Sw_dw']*logs['PHIT'] - logs['CBW']).clip(0,1)
logs['Sw_ws'] =(waxmansmits(Rw, T, RwT, logs.ILD, logs.PHIT, logs.PHIE, den_fl, m_cem, mslope, logs.Swb, Rw75, logs.Qv, Bdacy)).clip(0,1)
logs['WSCBVWE']=(logs['Sw_ws']*logs['PHIT'] - logs['CBW']).clip(0,1)
logs['matrix']=(1-logs.vsh*por_shale-logs.PHIE).clip(0,1)
"""
===============================================================================
=== 6. Display the ``Interpretation Plot''
Create a plot template and add the results of volume of shale, saturation and porosity.
===============================================================================
"""
import matplotlib.pyplot as plt
# Create the figure and subplots
fig, ax = plt.subplots(nrows=1, ncols=6, figsize=(14,22), sharey=True)
#fig.suptitle("Final Interpretation Depth Plot over Zone of Interest", fontsize=22)
fig.subplots_adjust(top=0.75,wspace=0.1)
##General setting for all axis per Mahai
#for axes in ax:
# axes.set_ylim (top_depth,bottom_depth)
# axes.invert_yaxis()
# axes.yaxis.grid(True)
# axes.get_xaxis().set_visible(False)
# for i in tops_depths:
# if ((i>=top_depth) and (i<=bottom_depth)):
# axes.axhline(y=i, linewidth=1.0, color='red')
#for (i,j) in zip(tops_depths,tops):
# if ((i>=top_depth) and (i<=bottom_depth)):
# ax[0].text(0.2, i ,j, horizontalalignment='right',verticalalignment='center', color='red')
#General setting for all axis concentrating only on the Zone of Interest
for axes in ax:
axes.set_ylim (top_summary,bottom_summary)
#axes.set_ylim (top_depth,bottom_depth)
axes.invert_yaxis()
axes.yaxis.grid(True)
axes.get_xaxis().set_visible(False)
for i in tops_depths:
if ((i>=top_summary) and (i<=bottom_summary)):
axes.axhline(y=i, linewidth=1.0, color='red')
for (i,j) in zip(tops_depths,tops):
if ((i>=top_summary) and (i<=bottom_summary)):
ax[0].text(0.2, i ,j, horizontalalignment='right',verticalalignment='center', color='red')
"""
#1st track: GR, SP, CALI track
"""
ax01=ax[0].twiny()
ax01.set_xlim(-100,10)
ax01.plot(logs.SP, logs.DEPT, label='SP[mV]', color='black',linewidth=3.0)
ax01.set_xlabel('SP[mV]',color='black')
ax01.tick_params(axis='x', colors='black')
ax02=ax[0].twiny()
ax02.set_xlim(6,36)
ax01.grid(True)
ax02.plot(logs.CALI, logs.DEPT, '--', label='CALI[in]', color='blue')
ax02.spines['top'].set_position(('outward',40))
ax02.set_xlabel('CALI[in]',color='blue')
ax02.tick_params(axis='x', colors='blue')
ax03=ax[0].twiny()
ax03.set_xlim(0,150)
ax03.plot(logs.GR, logs.DEPT, label='GR[api]', color='green')
ax03.spines['top'].set_position(('outward',80))
ax03.set_xlabel('GR[api]',color='green')
ax03.tick_params(axis='x', colors='green')
"""
#2nd track: Resistivities
"""
ax11=ax[1].twiny()
ax11.set_xlim(0.1,100)
ax11.set_xscale('log')
ax11.grid(True)
ax11.spines['top'].set_position(('outward',80))