quick-pp 0.1.4__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. {quick_pp-0.1.4 → quick_pp-0.1.6}/HISTORY.rst +5 -1
  2. {quick_pp-0.1.4 → quick_pp-0.1.6}/PKG-INFO +10 -2
  3. quick_pp-0.1.6/docs/source/index.rst +33 -0
  4. quick_pp-0.1.6/docs/source/quick_pp.lithology.rst +42 -0
  5. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/quick_pp.rst +23 -10
  6. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/__init__.py +1 -1
  7. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/config.py +39 -14
  8. quick_pp-0.1.6/quick_pp/core_calibration.py +255 -0
  9. quick_pp-0.1.6/quick_pp/fluid_type.py +63 -0
  10. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/las_handler.py +65 -32
  11. quick_pp-0.1.6/quick_pp/lithology/__init__.py +80 -0
  12. quick_pp-0.1.6/quick_pp/lithology/carbonate.py +176 -0
  13. quick_pp-0.1.6/quick_pp/lithology/multi_mineral.py +142 -0
  14. quick_pp-0.1.6/quick_pp/lithology/sand_shale.py +83 -0
  15. quick_pp-0.1.6/quick_pp/lithology/sand_silt_clay.py +190 -0
  16. quick_pp-0.1.6/quick_pp/objects.py +176 -0
  17. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/permeability.py +70 -4
  18. quick_pp-0.1.6/quick_pp/plotter.py +582 -0
  19. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/porosity.py +23 -12
  20. quick_pp-0.1.6/quick_pp/qaqc.py +382 -0
  21. quick_pp-0.1.6/quick_pp/ressum.py +165 -0
  22. quick_pp-0.1.6/quick_pp/rock_type.py +65 -0
  23. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp/saturation.py +81 -13
  24. quick_pp-0.1.6/quick_pp/utils.py +177 -0
  25. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp.egg-info/PKG-INFO +10 -2
  26. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp.egg-info/SOURCES.txt +9 -2
  27. quick_pp-0.1.6/quick_pp.egg-info/requires.txt +5 -0
  28. {quick_pp-0.1.4 → quick_pp-0.1.6}/setup.py +9 -9
  29. quick_pp-0.1.4/docs/source/index.rst +0 -20
  30. quick_pp-0.1.4/quick_pp/lithology.py +0 -394
  31. quick_pp-0.1.4/quick_pp/plotter.py +0 -379
  32. quick_pp-0.1.4/quick_pp/qaqc.py +0 -203
  33. quick_pp-0.1.4/quick_pp/ressum.py +0 -82
  34. quick_pp-0.1.4/quick_pp/rock_type.py +0 -24
  35. quick_pp-0.1.4/quick_pp/utils.py +0 -67
  36. quick_pp-0.1.4/quick_pp.egg-info/entry_points.txt +0 -2
  37. quick_pp-0.1.4/quick_pp.egg-info/requires.txt +0 -1
  38. {quick_pp-0.1.4 → quick_pp-0.1.6}/AUTHORS.rst +0 -0
  39. {quick_pp-0.1.4 → quick_pp-0.1.6}/CONTRIBUTING.rst +0 -0
  40. {quick_pp-0.1.4 → quick_pp-0.1.6}/LICENSE +0 -0
  41. {quick_pp-0.1.4 → quick_pp-0.1.6}/MANIFEST.in +0 -0
  42. {quick_pp-0.1.4 → quick_pp-0.1.6}/README.rst +0 -0
  43. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/Makefile +0 -0
  44. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/_build/html/_static/file.png +0 -0
  45. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/_build/html/_static/minus.png +0 -0
  46. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/_build/html/_static/plus.png +0 -0
  47. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/make.bat +0 -0
  48. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/authors.rst +0 -0
  49. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/conf.py +0 -0
  50. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/contributing.rst +0 -0
  51. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/history.rst +0 -0
  52. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/installation.rst +0 -0
  53. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/modules.rst +0 -0
  54. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/readme.rst +0 -0
  55. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/source/usage.rst +0 -0
  56. {quick_pp-0.1.4 → quick_pp-0.1.6}/docs/static/quick_pp_demo.gif +0 -0
  57. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp.egg-info/dependency_links.txt +0 -0
  58. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp.egg-info/not-zip-safe +0 -0
  59. {quick_pp-0.1.4 → quick_pp-0.1.6}/quick_pp.egg-info/top_level.txt +0 -0
  60. {quick_pp-0.1.4 → quick_pp-0.1.6}/setup.cfg +0 -0
  61. {quick_pp-0.1.4 → quick_pp-0.1.6}/tests/__init__.py +0 -0
  62. {quick_pp-0.1.4 → quick_pp-0.1.6}/tests/test_quick_pp.py +0 -0
@@ -16,4 +16,8 @@ History
16
16
 
17
17
  0.1.4 (2024-02-04)
18
18
  ------------------
19
- * Update docstrings.
19
+ * Update docstrings.
20
+
21
+ 0.1.5 (2024-06-05)
22
+ ------------------
23
+ * Add core calibration module.
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quick_pp
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
5
5
  Home-page: https://github.com/imranfadhil/quick_pp
6
6
  Author: Imran Fadhil
7
7
  Author-email: imranfadhil@gmail.com
8
8
  License: MIT license
9
- Keywords: quick_pp
9
+ Keywords: quick_pp,petrophysics,geoscience,well log analysis
10
10
  Classifier: Development Status :: 2 - Pre-Alpha
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
@@ -16,6 +16,10 @@ Requires-Python: >=3.6
16
16
  License-File: LICENSE
17
17
  License-File: AUTHORS.rst
18
18
  Requires-Dist: Click>=7.0
19
+ Requires-Dist: ruptures>=1.1.8
20
+ Requires-Dist: welly>=0.5.2
21
+ Requires-Dist: pandas>=2.1.1
22
+ Requires-Dist: numpy>=1.26.0
19
23
 
20
24
  ========
21
25
  quick_pp
@@ -64,3 +68,7 @@ History
64
68
  0.1.4 (2024-02-04)
65
69
  ------------------
66
70
  * Update docstrings.
71
+
72
+ 0.1.5 (2024-06-05)
73
+ ------------------
74
+ * Add core calibration module.
@@ -0,0 +1,33 @@
1
+ quick_pp: Petrophysics quick-look interpretation in Python
2
+ ===========================================================
3
+
4
+ quick_pp is a Python package for petrophysical quick-look interpretation. It is designed to be a simple and easy-to-use
5
+ tool for petrophysicists and geoscientists to perform quick-look interpretation of well log data. It is built on top of
6
+ the popular scientific computing libraries in Python, such as NumPy, SciPy, and Matplotlib.
7
+
8
+ .. toctree::
9
+ :maxdepth: 2
10
+ :caption: User Guide:
11
+
12
+ installation
13
+ usage
14
+
15
+ .. toctree::
16
+ :maxdepth: 2
17
+ :caption: API Reference:
18
+
19
+ quick_pp
20
+
21
+ .. toctree::
22
+ :maxdepth: 2
23
+ :caption: Other Information:
24
+
25
+ authors
26
+ contributing
27
+ history
28
+
29
+ Indices and tables
30
+ ==================
31
+ * :ref:`genindex`
32
+ * :ref:`modindex`
33
+ * :ref:`search`
@@ -0,0 +1,42 @@
1
+ quick\_pp.lithology package
2
+ ===========================
3
+
4
+ quick\_pp.lithology.carbonate module
5
+ ------------------------------------
6
+
7
+ .. automodule:: quick_pp.lithology.carbonate
8
+ :members:
9
+ :undoc-members:
10
+ :show-inheritance:
11
+
12
+ quick\_pp.lithology.multi\_mineral module
13
+ -----------------------------------------
14
+
15
+ .. automodule:: quick_pp.lithology.multi_mineral
16
+ :members:
17
+ :undoc-members:
18
+ :show-inheritance:
19
+
20
+ quick\_pp.lithology.sand\_shale module
21
+ --------------------------------------
22
+
23
+ .. automodule:: quick_pp.lithology.sand_shale
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
28
+ quick\_pp.lithology.sand\_silt\_clay module
29
+ -------------------------------------------
30
+
31
+ .. automodule:: quick_pp.lithology.sand_silt_clay
32
+ :members:
33
+ :undoc-members:
34
+ :show-inheritance:
35
+
36
+ Module contents
37
+ ---------------
38
+
39
+ .. automodule:: quick_pp.lithology
40
+ :members:
41
+ :undoc-members:
42
+ :show-inheritance:
@@ -1,21 +1,34 @@
1
- quick\_pp package
2
- =================
1
+ Docstrings for quick_pp package
2
+ ===============================
3
3
 
4
- Submodules
5
- ----------
4
+ quick\_pp.lithology module
5
+ --------------------------
6
6
 
7
- quick\_pp.las\_handler module
8
- -----------------------------
7
+ .. toctree::
8
+ :maxdepth: 4
9
9
 
10
- .. automodule:: quick_pp.las_handler
10
+ quick_pp.lithology
11
+
12
+ quick\_pp.core\_calibration module
13
+ ----------------------------------
14
+
15
+ .. automodule:: quick_pp.core_calibration
11
16
  :members:
12
17
  :undoc-members:
13
18
  :show-inheritance:
14
19
 
15
- quick\_pp.lithology module
16
- --------------------------
20
+ quick\_pp.fluid\_type module
21
+ ----------------------------
17
22
 
18
- .. automodule:: quick_pp.lithology
23
+ .. automodule:: quick_pp.fluid_type
24
+ :members:
25
+ :undoc-members:
26
+ :show-inheritance:
27
+
28
+ quick\_pp.las\_handler module
29
+ -----------------------------
30
+
31
+ .. automodule:: quick_pp.las_handler
19
32
  :members:
20
33
  :undoc-members:
21
34
  :show-inheritance:
@@ -1,3 +1,3 @@
1
1
  __author__ = """Imran Fadhil"""
2
2
  __email__ = 'imranfadhil@gmail.com'
3
- __version__ = '0.1.4'
3
+ __version__ = '0.1.6'
@@ -41,27 +41,52 @@ class Config(object):
41
41
  SILT_LINE_ANGLE=119 # Deg angle from horizontal
42
42
  )
43
43
 
44
+ CARB_NEU_DEN_ENDPOINTS = dict(
45
+ FLUID_POINT=(.93, 1.0),
46
+ DRY_CALC_POINT=(0.0, 2.71),
47
+ DRY_DOLO_POINT=(0.01, 2.87),
48
+ DRY_CLAY_POINT=(0.24, 2.78),
49
+ )
50
+
51
+ CARB_DEN_PEF_ENDPOINTS = dict(
52
+ FLUID_POINT=(1.0, 1.0),
53
+ DRY_CALC_POINT=(5.08, 2.71),
54
+ DRY_DOLO_POINT=(3.14, 2.87),
55
+ DRY_CLAY_POINT=(2.2, 2.78),
56
+ )
57
+
44
58
  MINERALS_LOG_VALUE = {
45
- 'GR_QUARTZ': 30.0,
46
- 'NPHI_QUARTZ': -0.04,
47
- 'RHOB_QUARTZ': 2.65,
48
- 'DTC_QUARTZ': 55.0,
59
+ 'GR_QUARTZ': 0.0,
60
+ 'NPHI_QUARTZ': -0.02,
61
+ 'RHOB_QUARTZ': 2.64,
62
+ 'DTC_QUARTZ': 52.9,
49
63
  'PEF_QUARTZ': 1.8,
64
+
50
65
  'GR_CALCITE': 0.0,
51
66
  'NPHI_CALCITE': 0.0,
52
67
  'RHOB_CALCITE': 2.71,
53
- 'DTC_CALCITE': 47.6,
54
- 'PEF_CALCITE': 5.08,
68
+ 'DTC_CALCITE': 49.7,
69
+ 'PEF_CALCITE': 5.1,
70
+
55
71
  'GR_DOLOMITE': 0.0,
56
- 'NPHI_DOLOMITE': 0.009,
57
- 'RHOB_DOLOMITE': 2.87,
72
+ 'NPHI_DOLOMITE': 0.01,
73
+ 'RHOB_DOLOMITE': 2.85,
58
74
  'DTC_DOLOMITE': 43.5,
59
- 'PEF_DOLOMITE': 3.14,
60
- 'GR_SH': 110.0,
61
- 'NPHI_SH': 0.3,
62
- 'RHOB_SH': 2.5,
63
- 'DTC_SH': 110.0,
64
- 'PEF_SH': 2.2,
75
+ 'PEF_DOLOMITE': 3.1,
76
+
77
+ 'GR_SILT': 80.0,
78
+ 'NPHI_SILT': 0.1,
79
+ 'RHOB_SILT': 2.68,
80
+ 'DTC_SILT': 100.0,
81
+ 'PEF_SILT': 2.0,
82
+
83
+ # Kaolinite
84
+ 'GR_SH': 130.0,
85
+ 'NPHI_SH': 0.34,
86
+ 'RHOB_SH': 2.41,
87
+ 'DTC_SH': 143.0,
88
+ 'PEF_SH': 1.8,
89
+
65
90
  'GR_MUD': 0.0,
66
91
  'NPHI_MUD': 1.0,
67
92
  'RHOB_MUD': 1.3,
@@ -0,0 +1,255 @@
1
+ from scipy.optimize import curve_fit
2
+ import matplotlib.pyplot as plt
3
+ import numpy as np
4
+
5
+ from .utils import power_law_func as func
6
+
7
+ plt.style.use('seaborn-v0_8-paper')
8
+ plt.rcParams.update(
9
+ {
10
+ 'axes.labelsize': 10,
11
+ 'xtick.labelsize': 10,
12
+ 'legend.fontsize': 'small'
13
+ }
14
+ )
15
+
16
+
17
+ # Cross plots
18
+ def poroperm_xplot(poro, perm, a=None, b=None, label='', log_log=False):
19
+ """Generate porosity-permeability cross plot.
20
+
21
+ Args:
22
+ poro (float): Core porosity (frac).
23
+ perm (float): Core permeability (mD).
24
+ a (float, optional): a constant in perm=a*poro^b. Defaults to None.
25
+ b (float, optional): b constant in perm=a*poro^b. Defaults to None.
26
+ label (str, optional): Label for the data group. Defaults to ''.
27
+ log_log (bool, optional): Whether to plot log-log or not. Defaults to False.
28
+ """
29
+ sc = plt.scatter(poro, perm, marker='o', label=label)
30
+ if a and b:
31
+ line_color = sc.get_facecolors()[0]
32
+ line_color[-1] = 0.5
33
+ cpore = np.geomspace(0.05, 0.5, 30)
34
+ plt.plot(cpore, func(cpore, a, b), color=line_color, linestyle='dashed')
35
+ plt.xlabel('CPORE (frac)')
36
+ plt.xlim(0, 0.5)
37
+ plt.ylabel('CPERM (mD)')
38
+ plt.yscale('log')
39
+ plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
40
+ if log_log:
41
+ plt.xscale('log')
42
+
43
+
44
+ def bvw_xplot(bvw, pc, a=None, b=None, label='', ylim=None, log_log=False):
45
+ """Generate bulk volume water-capillary pressure cross plot.
46
+
47
+ Args:
48
+ bvw (float): Calculated bulk volume water (frac) from core.
49
+ pc (float): Capillary pressure (psi) from core.
50
+ a (float, optional): a constant in pc=a*bvw^b. Defaults to None.
51
+ b (float, optional): b constant in pc=a*bvw^b. Defaults to None.
52
+ label (str, optional): Label for the data group. Defaults to ''.
53
+ ylim (tuple, optional): Range for the y axis in (min, max) format. Defaults to None.
54
+ log_log (bool, optional): Whether to plot log-log or not. Defaults to False.
55
+ """
56
+ sc = plt.plot(bvw, pc, marker='s', label=label)
57
+ if a and b:
58
+ line_color = sc[0].get_color() + '66' # Set opacity to 0
59
+ cbvw = np.linspace(0.05, 0.35, 30)
60
+ plt.scatter(cbvw, func(cbvw, a, b), marker='x', color=line_color)
61
+ plt.xlabel('BVW (frac)')
62
+ plt.ylabel('Pc (psi)')
63
+ plt.ylim(ylim) if ylim else plt.ylim(0.01, plt.gca().get_lines()[-1].get_ydata().max())
64
+ plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
65
+ if log_log:
66
+ plt.xscale('log')
67
+ plt.yscale('log')
68
+
69
+
70
+ def j_xplot(sw, j, a=None, b=None, label='', ylim=None, log_log=False):
71
+ """Generate J-Sw cross plot.
72
+
73
+ Args:
74
+ sw (float): Core water saturation (frac).
75
+ j (float): Calculated J value (unitless).
76
+ a (float, optional): a constant in j=a*sw^b. Defaults to None.
77
+ b (float, optional): b constant in j=a*sw^b. Defaults to None.
78
+ label (str, optional): Label for the data group. Defaults to ''.
79
+ ylim (tuple, optional): Range for the y axis in (min, max) format. Defaults to None.
80
+ log_log (bool, optional): Whether to plot log-log or not. Defaults to False.
81
+ """
82
+ sc = plt.plot(sw, j, marker='s', label=label)
83
+ if a and b:
84
+ line_color = sc[0].get_color() + '80' # Set opacity to 0.5
85
+ csw = np.geomspace(0.1, 1.0, 30)
86
+ plt.plot(csw, func(csw, a, b), color=line_color, linestyle='dashed')
87
+ plt.xlabel('Sw (frac)')
88
+ plt.xlim(0.01, 1)
89
+ plt.ylabel('J')
90
+ plt.ylim(ylim) if ylim else plt.ylim(0.01, plt.gca().get_lines()[-1].get_ydata().max())
91
+ plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
92
+ if log_log:
93
+ plt.xscale('log')
94
+ plt.yscale('log')
95
+
96
+
97
+ # Best-fit functions
98
+ def fit_j_curve(sw, j):
99
+ """Estimate a and b constants of best fit given core water saturation and J value.
100
+
101
+ Args:
102
+ sw (float): Core water saturation (frac).
103
+ j (float): Calculated J value (unitless).
104
+
105
+ Returns:
106
+ tuple: a and b constants from the best-fit curve.
107
+ """
108
+ try:
109
+ popt, _ = curve_fit(func, sw, j)
110
+ a = [round(c, 3) for c in popt][0]
111
+ b = [round(c, 3) for c in popt][1]
112
+ return a, b
113
+ except Exception as e:
114
+ print(e)
115
+ return 1, 1
116
+
117
+
118
+ def fit_poroperm_curve(poro, perm):
119
+ """Estimate a and b constants of best fit given core porosity and permeability values.
120
+
121
+ Args:
122
+ poro (float): Core porosity (frac).
123
+ perm (float): Core permeability (mD).
124
+
125
+ Returns:
126
+ tuple: a and b constants from the best-fit curve.
127
+ """
128
+ try:
129
+ popt, _ = curve_fit(func, poro, perm)
130
+ a = [round(c) for c in popt][0]
131
+ b = [round(c, 3) for c in popt][1]
132
+ return a, b
133
+ except Exception as e:
134
+ print(e)
135
+ return 1, 1
136
+
137
+
138
+ def leverett_j(pc, ift, perm, phit):
139
+ """ Estimate Leverett J.
140
+
141
+ Args:
142
+ pc (float): Capillary pressure.
143
+ ift (float): Interfacial tension.
144
+ perm (float): Permeability.
145
+ phit (float): Total porosity.
146
+
147
+ Returns:
148
+ float: Leverett J value.
149
+ """
150
+ return 0.216 * (pc / ift) * (perm / phit)**(0.5)
151
+
152
+
153
+ def pseudo_leverett_j():
154
+ """Generate Pseudo-Leverett J based on .
155
+
156
+ Args:
157
+ pc (float): Capillary pressure.
158
+ ift (float): Interfacial tension.
159
+ perm (float): Permeability.
160
+ phit (float): Total porosity.
161
+
162
+ Returns:
163
+ float: Pseudo-Leverett J function.
164
+ """
165
+ pass
166
+
167
+
168
+ def sw_skelt_harrison():
169
+ pass
170
+
171
+
172
+ def sw_cuddy(phit, h, a, b):
173
+ """Cuddy's saturation model.
174
+
175
+ Args:
176
+ sw (float): Water saturation.
177
+ phit (float): Total porosity.
178
+ h (float): True vertical depth.
179
+ a (float): Cementation exponent.
180
+ b (float): Saturation exponent.
181
+
182
+ Returns:
183
+ float: Water saturation.
184
+ """
185
+ return a / phit * h**b
186
+
187
+
188
+ def sw_shf_leverett_j(perm, phit, depth, fwl, ift, gw, ghc, a, b, phie=None):
189
+ """Estimate water saturation based on Leverett J function.
190
+
191
+ Args:
192
+ perm (float): Permeability (mD).
193
+ phit (float): Total porosity (frac).
194
+ depth (float): True vertical depth (ft).
195
+ fwl (float): Free water level in true vertical depth (ft).
196
+ ift (float): Interfacial tension (dynes/cm).
197
+ gw (float): Gas density (psi/ft).
198
+ ghc (float): Gas height (psi/ft).
199
+ a (float): A constant from J function.
200
+ b (float): B constant from J function.
201
+ phie (float): Effective porosity (frac), required for clay bound water calculation. Defaults to None.
202
+
203
+ Returns:
204
+ float: Water saturation from saturation height function.
205
+ """
206
+ h = fwl - depth
207
+ pc = h * (gw - ghc)
208
+ shf = ((0.216 * (pc / ift) * (perm / phit)**(0.5)) / a)**(1 / b)
209
+ # return np.where(shf > 1, 1, shf)
210
+ return shf if not phie else shf * (1 - (phie / phit)) + (phie / phit)
211
+
212
+
213
+ def sw_shf_cuddy(phit, depth, fwl, gw, ghc, a, b):
214
+ """Estimate water saturation based on Cuddy's saturation height function.
215
+
216
+ Args:
217
+ phit (float): Porosity (frac).
218
+ depth (float): True vertical depth (ft).
219
+ fwl (float): Free water level in true vertical depth (ft).
220
+ a (float): Cementation exponent.
221
+ b (float): Saturation exponent.
222
+
223
+ Returns:
224
+ float: Water saturation from saturation height function.
225
+ """
226
+ h = fwl - depth
227
+ shf = (h * (gw - ghc) / a)**(1 / b) / phit
228
+ # return np.where(shf > 1, 1, shf)
229
+ return shf
230
+
231
+
232
+ def sw_shf_choo(perm, phit, phie, depth, fwl, ift, gw, ghc, b0=0.4):
233
+ """Estimate water saturation based on Choo's saturation height function.
234
+
235
+ Args:
236
+ perm (float): Permeability (mD).
237
+ phit (float): Total porosity (frac).
238
+ phie (float): Effective porosity (frac).
239
+ depth (float): True vertical depth (ft).
240
+ fwl (float): Free water level in true vertical depth (ft).
241
+ ift (float): Interfacial tension (dynes/cm).
242
+ gw (float): Gas density (psi/ft).
243
+ ghc (float): Gas height (psi/ft).
244
+ b0 (float): _description_. Defaults to 0.4.
245
+
246
+ Returns:
247
+ float: Water saturation from saturation height function.
248
+ """
249
+ swb = 1 - (phie / phit)
250
+ h = fwl - depth
251
+ pc = h * (gw - ghc)
252
+ shf = 10**((2 * b0 - 1) * np.log10(1 + swb**-1) + np.log10(1 + swb)) / (
253
+ (0.2166 * (pc / ift) * (perm / phit)**(0.5))**(b0 * np.log10(1 + swb**-1) / 3))
254
+ # return np.where(shf > 1, 1, shf)
255
+ return shf
@@ -0,0 +1,63 @@
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from scipy.optimize import curve_fit
4
+
5
+ from .utils import straight_line_func as func
6
+
7
+ plt.style.use('seaborn-v0_8-paper')
8
+ plt.rcParams.update(
9
+ {
10
+ 'axes.labelsize': 10,
11
+ 'xtick.labelsize': 10,
12
+ 'legend.fontsize': 'small'
13
+ }
14
+ )
15
+
16
+
17
+ def fit_pressure_gradient(tvdss, formation_pressure):
18
+ """Fit pressure gradient from formation pressure and true vertical depth subsea.
19
+
20
+ Args:
21
+ tvdss (float): True vertical depth subsea.
22
+ formation_pressure (float): Formation pressure.
23
+
24
+ Returns:
25
+ tuple: Gradient and intercept of the best-fit line.
26
+ """
27
+ popt, _ = curve_fit(func, tvdss, formation_pressure)
28
+ return round(popt[0], 3), round(popt[1], 3)
29
+
30
+
31
+ def fluid_contact_plot(tvdss, formation_pressue, m, c, fluid_type: str = 'WATER',
32
+ ylim: tuple = (5000, 3000), xlim: tuple = (1000, 5000),
33
+ goc: float = 0, owc: float = 0, gwc: float = 0):
34
+ """Generate fluid contact plot which is used to determine the fluid contact in a well.
35
+
36
+ Args:
37
+ tvdss (float): True vertical depth subsea.
38
+ formation_pressure (float): Formation pressure.
39
+
40
+ Returns:
41
+ matplotlib.pyplot.Figure: Fluid contact plot.
42
+ """
43
+ color_dict = dict(
44
+ OIL=('green', 'o'),
45
+ GAS=('red', 'x'),
46
+ WATER=('blue', '^'),
47
+ HYDROSTATIC=('brown', 's')
48
+ )
49
+ marker = color_dict.get(fluid_type.upper(), ('black', 'o'))
50
+ label = f'{fluid_type} gradient: {round(m, 3)} psi/ft'
51
+ sc = plt.scatter(formation_pressue, tvdss, label=label, c=marker[0], marker=marker[1])
52
+
53
+ line_color = sc.get_facecolors()[0]
54
+ line_color[-1] = 0.5
55
+ tvd_pts = np.linspace(ylim[0] - 30, ylim[1] + 30, 30)
56
+ plt.plot(func(tvd_pts, m, c), tvd_pts, color=line_color)
57
+
58
+ plt.ylim(ylim)
59
+ plt.ylabel('TVDSS (ft)')
60
+ plt.xlim(xlim)
61
+ plt.xlabel('Formation Pressure (psi)')
62
+ plt.legend()
63
+ plt.title('Fluid Contact Plot')