-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathtriple_combo.py
121 lines (96 loc) · 4.71 KB
/
triple_combo.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
def triple_combo(df, column_depth, column_GR, column_resistivity,
column_NPHI, column_RHOB, min_depth, max_depth,
min_GR=0, max_GR=150, sand_GR_line=60,
min_resistivity=0.01, max_resistivity=1000,
color_GR='black', color_resistivity='green',
color_RHOB='red', color_NPHI='blue',
figsize=(6,10), tight_layout=1,
title_size=15, title_height=1.05):
"""
Producing Triple Combo log
Input:
df is your dataframe
column_depth, column_GR, column_resistivity, column_NPHI, column_RHOB
are column names that appear in your dataframe (originally from the LAS file)
specify your depth limits; min_depth and max_depth
input variables other than above are default. You can specify
the values yourselves.
Output:
Fill colors; gold (sand), lime green (non-sand), blue (water-zone), orange (HC-zone)
"""
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoMinorLocator
import numpy as np
fig, ax=plt.subplots(1,3,figsize=(8,10))
fig.suptitle('Triple Combo Log', size=title_size, y=title_height)
ax[0].minorticks_on()
ax[0].grid(which='major', linestyle='-', linewidth='0.5', color='lime')
ax[0].grid(which='minor', linestyle=':', linewidth='1', color='black')
ax[1].minorticks_on()
ax[1].grid(which='major', linestyle='-', linewidth='0.5', color='lime')
ax[1].grid(which='minor', linestyle=':', linewidth='1', color='black')
ax[2].minorticks_on()
ax[2].grid(which='major', linestyle='-', linewidth='0.5', color='lime')
ax[2].grid(which='minor', linestyle=':', linewidth='1', color='black')
# First track: GR
ax[0].get_xaxis().set_visible(False)
ax[0].invert_yaxis()
gr=ax[0].twiny()
gr.set_xlim(min_GR,max_GR)
gr.set_xlabel('GR',color=color_GR)
gr.set_ylim(max_depth, min_depth)
gr.spines['top'].set_position(('outward',10))
gr.tick_params(axis='x',colors=color_GR)
gr.plot(df[column_GR], df[column_depth], color=color_GR)
gr.minorticks_on()
gr.xaxis.grid(which='major', linestyle='-', linewidth='0.5', color='lime')
gr.xaxis.grid(which='minor', linestyle=':', linewidth='1', color='black')
gr.fill_betweenx(df[column_depth], sand_GR_line, df[column_GR], where=(sand_GR_line>=df[column_GR]), color = 'gold', linewidth=0) # sand
gr.fill_betweenx(df[column_depth], sand_GR_line, df[column_GR], where=(sand_GR_line<df[column_GR]), color = 'lime', linewidth=0) # shale
# Second track: Resistivity
ax[1].get_xaxis().set_visible(False)
ax[1].invert_yaxis()
res=ax[1].twiny()
res.set_xlim(min_resistivity,max_resistivity)
res.set_xlabel('Resistivity',color=color_resistivity)
res.set_ylim(max_depth, min_depth)
res.spines['top'].set_position(('outward',10))
res.tick_params(axis='x',colors=color_resistivity)
res.semilogx(df[column_resistivity], df[column_depth], color=color_resistivity)
res.minorticks_on()
res.xaxis.grid(which='major', linestyle='-', linewidth='0.5', color='lime')
res.xaxis.grid(which='minor', linestyle=':', linewidth='1', color='black')
# Third track: NPHI and RHOB
ax[2].get_xaxis().set_visible(False)
ax[2].invert_yaxis()
## NPHI curve
nphi=ax[2].twiny()
nphi.set_xlim(-0.15,0.45)
nphi.invert_xaxis()
nphi.set_xlabel('NPHI',color='blue')
nphi.set_ylim(max_depth, min_depth)
nphi.spines['top'].set_position(('outward',10))
nphi.tick_params(axis='x',colors='blue')
nphi.plot(df[column_NPHI], df[column_depth], color=color_NPHI)
nphi.minorticks_on()
nphi.xaxis.grid(which='major', linestyle='-', linewidth='0.5', color='lime')
nphi.xaxis.grid(which='minor', linestyle=':', linewidth='1', color='black')
## RHOB curve
rhob=ax[2].twiny()
rhob.set_xlim(1.95,2.95)
rhob.set_xlabel('RHOB',color='red')
rhob.set_ylim(max_depth, min_depth)
rhob.spines['top'].set_position(('outward',50))
rhob.tick_params(axis='x',colors='red')
rhob.plot(df[column_RHOB], df[column_depth], color=color_RHOB)
# solution to produce fill between can be found here:
# https://stackoverflow.com/questions/57766457/how-to-plot-fill-betweenx-to-fill-the-area-between-y1-and-y2-with-different-scal
x2p, _ = (rhob.transData + nphi.transData.inverted()).transform(np.c_[df[column_RHOB], df[column_depth]]).T
nphi.autoscale(False)
nphi.fill_betweenx(df[column_depth], df[column_NPHI], x2p, color="orange", alpha=0.4, where=(x2p > df[column_NPHI])) # hydrocarbon
nphi.fill_betweenx(df[column_depth], df[column_NPHI], x2p, color="blue", alpha=0.4, where=(x2p < df[column_NPHI])) # water
res.minorticks_on()
res.grid(which='major', linestyle='-', linewidth='0.5', color='lime')
res.grid(which='minor', linestyle=':', linewidth='1', color='black')
plt.tight_layout(tight_layout)
plt.show()