quick-pp 0.1.7__tar.gz → 0.1.9__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 (54) hide show
  1. {quick_pp-0.1.7 → quick_pp-0.1.9}/HISTORY.rst +8 -0
  2. {quick_pp-0.1.7 → quick_pp-0.1.9}/PKG-INFO +10 -1
  3. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/__init__.py +1 -1
  4. quick_pp-0.1.9/quick_pp/lithology/sand_silt_clay.py +133 -0
  5. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/permeability.py +4 -3
  6. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/plotter.py +1 -1
  7. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/qaqc.py +1 -1
  8. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/rock_type.py +3 -4
  9. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/saturation.py +8 -5
  10. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/utils.py +19 -9
  11. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/PKG-INFO +10 -1
  12. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/requires.txt +1 -0
  13. {quick_pp-0.1.7 → quick_pp-0.1.9}/setup.py +1 -1
  14. quick_pp-0.1.7/quick_pp/lithology/sand_silt_clay.py +0 -190
  15. {quick_pp-0.1.7 → quick_pp-0.1.9}/AUTHORS.rst +0 -0
  16. {quick_pp-0.1.7 → quick_pp-0.1.9}/CONTRIBUTING.rst +0 -0
  17. {quick_pp-0.1.7 → quick_pp-0.1.9}/LICENSE +0 -0
  18. {quick_pp-0.1.7 → quick_pp-0.1.9}/MANIFEST.in +0 -0
  19. {quick_pp-0.1.7 → quick_pp-0.1.9}/README.rst +0 -0
  20. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/Makefile +0 -0
  21. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/_build/html/_static/file.png +0 -0
  22. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/_build/html/_static/minus.png +0 -0
  23. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/_build/html/_static/plus.png +0 -0
  24. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/make.bat +0 -0
  25. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/authors.rst +0 -0
  26. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/conf.py +0 -0
  27. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/contributing.rst +0 -0
  28. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/history.rst +0 -0
  29. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/index.rst +0 -0
  30. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/installation.rst +0 -0
  31. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/modules.rst +0 -0
  32. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/quick_pp.lithology.rst +0 -0
  33. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/quick_pp.rst +0 -0
  34. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/readme.rst +0 -0
  35. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/source/usage.rst +0 -0
  36. {quick_pp-0.1.7 → quick_pp-0.1.9}/docs/static/quick_pp_demo.gif +0 -0
  37. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/config.py +0 -0
  38. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/core_calibration.py +0 -0
  39. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/fluid_type.py +0 -0
  40. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/las_handler.py +0 -0
  41. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/lithology/__init__.py +0 -0
  42. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/lithology/carbonate.py +0 -0
  43. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/lithology/multi_mineral.py +0 -0
  44. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/lithology/sand_shale.py +0 -0
  45. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/objects.py +0 -0
  46. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/porosity.py +0 -0
  47. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp/ressum.py +0 -0
  48. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/SOURCES.txt +0 -0
  49. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/dependency_links.txt +0 -0
  50. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/not-zip-safe +0 -0
  51. {quick_pp-0.1.7 → quick_pp-0.1.9}/quick_pp.egg-info/top_level.txt +0 -0
  52. {quick_pp-0.1.7 → quick_pp-0.1.9}/setup.cfg +0 -0
  53. {quick_pp-0.1.7 → quick_pp-0.1.9}/tests/__init__.py +0 -0
  54. {quick_pp-0.1.7 → quick_pp-0.1.9}/tests/test_quick_pp.py +0 -0
@@ -21,3 +21,11 @@ History
21
21
  0.1.5 (2024-06-05)
22
22
  ------------------
23
23
  * Add core calibration module.
24
+
25
+ 0.1.8 (2024-06-24)
26
+ ------------------
27
+ * Update requirements.
28
+
29
+ 0.1.9 (2024-07-12)
30
+ ------------------
31
+ * Refactor SSC module.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quick_pp
3
- Version: 0.1.7
3
+ Version: 0.1.9
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
@@ -20,6 +20,7 @@ Requires-Dist: ruptures
20
20
  Requires-Dist: welly
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: numpy
23
+ Requires-Dist: statsmodels
23
24
 
24
25
  ========
25
26
  quick_pp
@@ -72,3 +73,11 @@ History
72
73
  0.1.5 (2024-06-05)
73
74
  ------------------
74
75
  * Add core calibration module.
76
+
77
+ 0.1.8 (2024-06-24)
78
+ ------------------
79
+ * Update requirements.
80
+
81
+ 0.1.9 (2024-07-12)
82
+ ------------------
83
+ * Refactor SSC module.
@@ -1,3 +1,3 @@
1
1
  __author__ = """Imran Fadhil"""
2
2
  __email__ = 'imranfadhil@gmail.com'
3
- __version__ = '0.1.7'
3
+ __version__ = '0.1.9'
@@ -0,0 +1,133 @@
1
+ import numpy as np
2
+ import math
3
+
4
+ from ..utils import min_max_line, length_a_b, line_intersection
5
+ from ..config import Config
6
+
7
+
8
+ class SandSiltClay:
9
+ """Sand-silt-clay model based on Kuttan's litho-porosity model.
10
+
11
+ The original is a binary model where reservoir sections (left to the silt line) consist of combination of
12
+ sand-silt while non-reservoir sections (right to the silt line) consist of silt-clay combination.
13
+
14
+ This module is modified based on Kuttan, where the reservoir sections consist of combination of sand-silt-clay
15
+ while non-reservoir sections remain a combination of silt-clay only."""
16
+
17
+ def __init__(self, dry_sand_point: tuple = None, dry_silt_point: tuple = None, dry_clay_point: tuple = None,
18
+ fluid_point: tuple = None, wet_clay_point: tuple = None, silt_line_angle: float = None, **kwargs):
19
+ # Initialize the endpoints
20
+ self.dry_sand_point = dry_sand_point or Config.SSC_ENDPOINTS["DRY_SAND_POINT"]
21
+ self.dry_silt_point = dry_silt_point or Config.SSC_ENDPOINTS["DRY_SILT_POINT"]
22
+ self.dry_clay_point = dry_clay_point or Config.SSC_ENDPOINTS["DRY_CLAY_POINT"]
23
+ self.fluid_point = fluid_point or Config.SSC_ENDPOINTS["FLUID_POINT"]
24
+ self.wet_clay_point = wet_clay_point or Config.SSC_ENDPOINTS["WET_CLAY_POINT"]
25
+ self.silt_line_angle = silt_line_angle or Config.SSC_ENDPOINTS["SILT_LINE_ANGLE"]
26
+
27
+ def estimate_lithology(self, nphi, rhob):
28
+ """Estimate sand silt clay lithology volumetrics.
29
+
30
+ Args:
31
+ nphi (float): Neutron Porosity log in v/v
32
+ rhob (float): Bulk Density log in g/cc
33
+
34
+ Returns:
35
+ (float, float, float, boolean): vsand, vsilt, vcld, vclb, cross-plot if xplot True else None
36
+ """
37
+ # Initialize the endpoints
38
+ A = self.dry_sand_point
39
+ B = self.dry_silt_point
40
+ C = self.dry_clay_point
41
+ D = self.fluid_point
42
+
43
+ # Redefine wetclay point
44
+ _, rhob_max_line = min_max_line(rhob, 0.1)
45
+ _, nphi_max_line = min_max_line(nphi, 0.1)
46
+ wetclay_RHOB = np.nanmin(rhob_max_line)
47
+ wetclay_NPHI = np.nanmax(nphi_max_line)
48
+ if not all(self.wet_clay_point):
49
+ self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
50
+ # print(f'#### wet_clay_point: {self.wet_clay_point}')
51
+
52
+ # Redefine drysilt point
53
+ drysilt_NPHI = 1 - 1.68*(math.tan(float(self.silt_line_angle - 90)*math.pi / 180))
54
+ if not all(B):
55
+ B = self.dry_silt_point = (drysilt_NPHI, B[1])
56
+ # print(f'#### drysilt_pt: {drysilt_pt}')
57
+
58
+ # Define dryclay point
59
+ if not all(C):
60
+ # # Calculate dryclay_NPHI given dryclay_RHOB
61
+ # m = (D[1] - self.wet_clay_point[1]) / (D[0] - self.wet_clay_point[0])
62
+ # dryclay_NPHI = ((C[1] - D[1]) / m) + D[0]
63
+ # C = self.dry_clay_point = (dryclay_NPHI, C[1])
64
+
65
+ # Calculate dryclay point, the intersection between rock line and clay line
66
+ drysilt_RHOB = B[1] if B[1] > np.nanmax(rhob) else np.nanmax(rhob)
67
+ updated_drysilt_pt = (B[0], drysilt_RHOB)
68
+ C = self.dry_clay_point = line_intersection((A, updated_drysilt_pt), (D, self.wet_clay_point))
69
+ # print(f'#### dryclay_pt: {C}, {m}')
70
+
71
+ # Calculate lithology fraction
72
+ vsand, vsilt, vcld = self.lithology_fraction_kuttan_modified(nphi, rhob)
73
+
74
+ return vsand, vsilt, vcld, (nphi_max_line, rhob_max_line)
75
+
76
+ def lithology_fraction_kuttan_modified(self, nphi, rhob):
77
+ """Estimate lithology volumetrics based on modified Kuttan's litho-porosity model.
78
+
79
+ Args:
80
+ nphi (float): Neutron Porosity log in v/v.
81
+ rhob (float): Bulk Density log in g/cc.
82
+
83
+ Returns:
84
+ (float, float, float): vsand, vsilt, vcld
85
+ """
86
+ A = self.dry_sand_point
87
+ B = self.dry_silt_point
88
+ C = self.dry_clay_point
89
+ D = self.fluid_point
90
+ E = list(zip(nphi, rhob))
91
+
92
+ rock_len = length_a_b(A, C)
93
+ res_len = length_a_b(A, B)
94
+ res_ratio = res_len / rock_len
95
+
96
+ vsand = np.empty(0)
97
+ vsilt = np.empty(0)
98
+ vcld = np.empty(0)
99
+ for i, point in enumerate(E):
100
+ var_pt = line_intersection((A, C), (D, point))
101
+ proj_len = length_a_b(var_pt, A)
102
+ vsand_pt, vsilt_pt, vcld_pt = self.lithology_chart(proj_len, rock_len, res_ratio)
103
+ vsand = np.append(vsand, vsand_pt)
104
+ vsilt = np.append(vsilt, vsilt_pt)
105
+ vcld = np.append(vcld, vcld_pt)
106
+
107
+ return vsand, vsilt, vcld
108
+
109
+ def lithology_chart(self, proj_len, rock_len, res_ratio):
110
+ """Estimate lithology fraction based on Kuttan's modified chart.
111
+
112
+ Args:
113
+ proj_len (float): Length of projected point from dry sand point.
114
+ rock_len (float): Length of rock line.
115
+ res_ratio (float): Ratio of reservoir length to rock length.
116
+
117
+ Returns:
118
+ (float, float, float): vsand, vsilt, vcld
119
+ """
120
+ siltclayratio = 0.25 # empirical value
121
+ res_len = rock_len * res_ratio
122
+ non_res_len = rock_len * (1 - res_ratio)
123
+ pt_ratio = proj_len / rock_len
124
+ if pt_ratio <= res_ratio:
125
+ vsand = (-proj_len / res_len) + 1
126
+ vsilt = siltclayratio / res_len * proj_len
127
+ vcld = (1 - siltclayratio) / res_len * proj_len
128
+ else:
129
+ vsand = 0
130
+ vsilt = -siltclayratio / non_res_len * proj_len + (rock_len * siltclayratio / non_res_len)
131
+ vcld = siltclayratio / non_res_len * proj_len + (1 - (siltclayratio * rock_len / non_res_len))
132
+
133
+ return vsand, vsilt, vcld
@@ -6,7 +6,7 @@ def choo_permeability(vclw, vsilt, phit, m=2, B=None, A=20e7, C=2):
6
6
  vsilt (float): Volume of silt in fraction.
7
7
  phit (float): Total porosity in fraction.
8
8
  A (float): Constant based on 0.125 * rg**2 / 10. Defaults to 20e7.
9
- B (float): Constant, defaults to m * ((2 / C) + 1) + 2.
9
+ B (float): Constant derived from cementation and compaction factor, defaults to m * ((2 / C) + 1) + 2.
10
10
  C (float): Constant, defaults to 2.
11
11
 
12
12
  Returns:
@@ -75,8 +75,9 @@ def morris_biggs_permeability(phit, C, Swirr):
75
75
 
76
76
  Args:
77
77
  phit (float): Total porosity in fraction.
78
- phie (float): Effective porosity in fraction.
79
- Vbwi (float): Volume of bound water in fraction.
78
+ C (float): A constant which depends on the density of hydrocarbon in the formation.
79
+ 250 for medium oil. 79 for gas.
80
+ Swirr (float): Irreduceable water saturation in fraction.
80
81
 
81
82
  Returns:
82
83
  float: Permeability in mD.
@@ -176,7 +176,7 @@ def plotly_log(well_data, depth_uom=""): # noqa
176
176
 
177
177
  fig = make_subplots(rows=1, cols=track, shared_yaxes=True, horizontal_spacing=0.015,
178
178
  column_widths=[1, 1, 1, 1, 1, 1, .15, 1],
179
- specs=[list([{'secondary_y': True}]*track)])
179
+ specs=[list([{'secondary_y': True}] * track)])
180
180
 
181
181
  i = 0
182
182
  # Add GR trace #1.
@@ -231,7 +231,7 @@ def den_correction(rhob, gr, alpha=0.1):
231
231
  Returns:
232
232
  float: Corrected bulk density.
233
233
  """
234
- rhob_min_line, rhob_max_line = min_max_line(rhob, alpha=alpha, num_bins=1)
234
+ rhob_min_line, rhob_max_line = min_max_line(rhob, alpha=alpha)
235
235
  vsh_gr = estimate_vsh_gr(gr, alpha=alpha)
236
236
  return rhob_min_line + (rhob_max_line - rhob_min_line) * vsh_gr
237
237
 
@@ -29,7 +29,7 @@ def rqi(k, phit):
29
29
  return (0.0314 * (k / phit)**0.5)
30
30
 
31
31
 
32
- def estimate_vsh_gr(gr, alpha=0.1, num_bins=1):
32
+ def estimate_vsh_gr(gr, alpha=0.1):
33
33
  """Estimate volume of shale from gamma ray.
34
34
 
35
35
  Args:
@@ -40,9 +40,8 @@ def estimate_vsh_gr(gr, alpha=0.1, num_bins=1):
40
40
  """
41
41
  gr = np.where(np.isnan(gr), np.nanmedian(gr), gr)
42
42
  dtr_gr = detrend(gr, axis=0) + np.nanmean(gr)
43
- min_gr, max_gr = min_max_line(dtr_gr, alpha, num_bins)
44
- gri = np.where(dtr_gr > max_gr, max_gr, np.where(dtr_gr < min_gr, min_gr, dtr_gr))
45
- gri = (gri - min_gr) / (max_gr - min_gr)
43
+ _, max_gr = min_max_line(dtr_gr, alpha)
44
+ gri = dtr_gr / max_gr
46
45
  # Apply Steiber equation
47
46
  return gri / (3 - 2 * gri)
48
47
 
@@ -210,20 +210,23 @@ def estimate_rw_waxman_smits(phit, rt, a=1, m=2, B=None, Qv=None):
210
210
  return rw
211
211
 
212
212
 
213
- def estimate_rt_water_trend(rt, alpha=0.3, num_bins=1):
214
- """Estimate trend RT of formation water based.
213
+ def estimate_rw_from_shale_trend(rt, phit, m=1.3, alpha=0.1):
214
+ """Estimate Rw from shale trend.
215
215
 
216
216
  Args:
217
217
  rt (float): True resistivity.
218
- sand_flag (int): Sand flag.
218
+ phit (float): Total porosity.
219
+ m (float): Shale cementation or shape factor. Defaults to 1.3.
220
+ alpha (float): Alpha value for percentile calculation. Defaults to 0.1.
219
221
 
220
222
  Returns:
221
223
  float: Formation water resistivity.
222
224
  """
223
225
  rt = np.log(rt)
224
226
  rt = np.where(rt <= 0, 1e-3, rt)
225
- min_rt, _ = min_max_line(rt, alpha, num_bins=num_bins)
226
- return np.exp(min_rt)
227
+ min_rt, _ = min_max_line(rt, alpha=alpha)
228
+ min_phit, _ = min_max_line(phit, alpha=alpha)
229
+ return min_phit ** m * np.exp(min_rt)
227
230
 
228
231
 
229
232
  def estimate_qv(vcld, phit, rho_clay=2.65, cec_clay=.062):
@@ -5,15 +5,17 @@ from scipy.signal import detrend
5
5
  import statsmodels.api as sm
6
6
  from statsmodels.sandbox.regression.predstd import wls_prediction_std
7
7
  import math
8
+ import ruptures.detection as rpt
9
+ import scipy.stats as stats
10
+ from scipy.signal import find_peaks
8
11
 
9
12
 
10
- def min_max_line(feature, alpha: float = 0.05, num_bins: int = 1):
11
- """Calculates the minimum and maximum line of a feature.
13
+ def min_max_line(feature, alpha: float = 0.1):
14
+ """Calculates the minimum and maximum line of a feature, grouped based on change points.
12
15
 
13
16
  Args:
14
17
  feature (float): Input feature to calculate the minimum and maximum line.
15
18
  alpha (float, optional): Confidence interval. Defaults to 0.05.
16
- num_bins (int, optional): Number of bins. Defaults to 1.
17
19
 
18
20
  Returns:
19
21
  (float, float): Minimum and maximum line of a feature.
@@ -21,16 +23,24 @@ def min_max_line(feature, alpha: float = 0.05, num_bins: int = 1):
21
23
  # Fill missing values with the median
22
24
  feature = np.where(np.isnan(feature), np.nanmedian(feature), feature)
23
25
 
24
- # Redefine the bins
25
- window = int(len(feature) / num_bins)
26
- bins = np.arange(0, len(feature), window)
27
- bins = np.append(bins, len(feature))
26
+ # Estimating number of peaks
27
+ signal_data = feature
28
+ kde = stats.gaussian_kde(signal_data[~np.isnan(signal_data)])
29
+ evaluated = kde.evaluate(np.linspace(np.nanmin(signal_data), np.nanmax(signal_data), 100))
30
+ peaks, _ = find_peaks(evaluated, height=np.nanmedian(evaluated))
31
+
32
+ # Detecting change points
33
+ model = "rbf"
34
+ jump = 500
35
+ my_bkps = rpt.BottomUp(model=model, jump=jump).fit_predict(signal_data, n_bkps=len(peaks))
36
+ my_bkps = np.insert(my_bkps, 0, 0)
37
+
38
+ list_of_dfs = [feature[my_bkps[i]:my_bkps[i + 1]] for i in range(len(my_bkps) - 1)]
28
39
 
29
40
  min_lines = np.empty(0)
30
41
  max_lines = np.empty(0)
31
42
  # Enumerate over the bins
32
- for i, bin in enumerate(bins[:-1]):
33
- data = feature[bin: bins[i+1]]
43
+ for data in list_of_dfs:
34
44
  y = np.arange(0, len(data))
35
45
  if y.size > 0:
36
46
  Y = sm.add_constant(y)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: quick_pp
3
- Version: 0.1.7
3
+ Version: 0.1.9
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
@@ -20,6 +20,7 @@ Requires-Dist: ruptures
20
20
  Requires-Dist: welly
21
21
  Requires-Dist: pandas
22
22
  Requires-Dist: numpy
23
+ Requires-Dist: statsmodels
23
24
 
24
25
  ========
25
26
  quick_pp
@@ -72,3 +73,11 @@ History
72
73
  0.1.5 (2024-06-05)
73
74
  ------------------
74
75
  * Add core calibration module.
76
+
77
+ 0.1.8 (2024-06-24)
78
+ ------------------
79
+ * Update requirements.
80
+
81
+ 0.1.9 (2024-07-12)
82
+ ------------------
83
+ * Refactor SSC module.
@@ -3,3 +3,4 @@ ruptures
3
3
  welly
4
4
  pandas
5
5
  numpy
6
+ statsmodels
@@ -16,7 +16,7 @@ with open('README.rst') as readme_file:
16
16
  with open('HISTORY.rst') as history_file:
17
17
  history = history_file.read()
18
18
 
19
- requirements = ['Click>=7.0', 'ruptures', 'welly', 'pandas', 'numpy']
19
+ requirements = ['Click>=7.0', 'ruptures', 'welly', 'pandas', 'numpy', 'statsmodels']
20
20
 
21
21
  test_requirements = []
22
22
 
@@ -1,190 +0,0 @@
1
- import numpy as np
2
- import math
3
-
4
- from ..rock_type import estimate_vsh_gr
5
- from ..utils import min_max_line, length_a_b, line_intersection
6
- from ..porosity import neu_den_xplot_poro_pt, clay_porosity
7
- from ..config import Config
8
-
9
-
10
- class SandSiltClay:
11
- """Sand-silt-clay model based on Kuttan's litho-porosity model.
12
-
13
- The original is a binary model where reservoir sections (left to the silt line) consist of combination of
14
- sand-silt while non-reservoir sections (right to the silt line) consist of silt-clay combination.
15
-
16
- PCSB proposed a model based on Kuttan, where the reservoir sections consist of combination of sand-silt-clay
17
- while non-reservoir sections remain a combination of silt-clay only. This module is a simplified version of the
18
- original PCSB model."""
19
-
20
- def __init__(self, dry_sand_point: tuple = None, dry_silt_point: tuple = None, dry_clay_point: tuple = None,
21
- fluid_point: tuple = None, wet_clay_point: tuple = None, silt_line_angle: float = None, **kwargs):
22
- # Initialize the endpoints
23
- self.dry_sand_point = dry_sand_point or Config.SSC_ENDPOINTS["DRY_SAND_POINT"]
24
- self.dry_silt_point = dry_silt_point or Config.SSC_ENDPOINTS["DRY_SILT_POINT"]
25
- self.dry_clay_point = dry_clay_point or Config.SSC_ENDPOINTS["DRY_CLAY_POINT"]
26
- self.fluid_point = fluid_point or Config.SSC_ENDPOINTS["FLUID_POINT"]
27
- self.wet_clay_point = wet_clay_point or Config.SSC_ENDPOINTS["WET_CLAY_POINT"]
28
- self.silt_line_angle = silt_line_angle or Config.SSC_ENDPOINTS["SILT_LINE_ANGLE"]
29
-
30
- def estimate_lithology(self, nphi, rhob, gr=None, badhole_flag=None, model: str = 'kuttan', normalize: bool = True):
31
- """Estimate sand silt clay lithology volumetrics.
32
-
33
- Args:
34
- nphi (float): Neutron Porosity log in v/v
35
- rhob (float): Bulk Density log in g/cc
36
- model (str, optional): Model to choose from 'kuttan' or 'kuttan_modified'. Defaults to 'kuttan'.
37
- xplot (bool, optional): To plot Neutron Density cross plot. Defaults to False.
38
- normalize (bool, optional): To normalize with porosity. Defaults to True.
39
-
40
- Returns:
41
- (float, float, float, boolean): vsand, vsilt, vcld, vclb, cross-plot if xplot True else None
42
- """
43
- assert model in ['kuttan', 'kuttan_modified'], f"'{model}' model is not available."
44
- # Initialize the endpoints
45
- A = self.dry_sand_point
46
- B = self.dry_silt_point
47
- C = self.dry_clay_point
48
- D = self.fluid_point
49
-
50
- # Estimate vsh_gr for badhole interval
51
- vsh_gr = estimate_vsh_gr(gr) if gr is not None else None
52
-
53
- # Redefine wetclay point
54
- _, rhob_max_line = min_max_line(rhob, 0.1, num_bins=1)
55
- _, nphi_max_line = min_max_line(nphi, 0.1, num_bins=1)
56
- wetclay_RHOB = np.nanmin(rhob_max_line)
57
- wetclay_NPHI = np.nanmax(nphi_max_line)
58
- if not all(self.wet_clay_point):
59
- self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
60
- # print(f'#### wet_clay_point: {self.wet_clay_point}')
61
-
62
- # Redefine drysilt point
63
- drysilt_NPHI = 1 - 1.68*(math.tan(float(self.silt_line_angle - 90)*math.pi / 180))
64
- if not all(B):
65
- B = self.dry_silt_point = (drysilt_NPHI, B[1])
66
- # print(f'#### drysilt_pt: {drysilt_pt}')
67
-
68
- # Define dryclay point
69
- if not all(C):
70
- # # Calculate dryclay_NPHI given dryclay_RHOB
71
- # m = (D[1] - self.wet_clay_point[1]) / (D[0] - self.wet_clay_point[0])
72
- # dryclay_NPHI = ((C[1] - D[1]) / m) + D[0]
73
- # C = self.dry_clay_point = (dryclay_NPHI, C[1])
74
-
75
- # Calculate dryclay point, the intersection between rock line and clay line
76
- drysilt_RHOB = B[1] if B[1] > np.nanmax(rhob) else np.nanmax(rhob)
77
- updated_drysilt_pt = (B[0], drysilt_RHOB)
78
- C = self.dry_clay_point = line_intersection((A, updated_drysilt_pt), (D, self.wet_clay_point))
79
- # print(f'#### dryclay_pt: {C}, {m}')
80
-
81
- if model == 'kuttan':
82
- vsand, vsilt, vcld = self.lithology_fraction_kuttan(nphi, rhob, normalize)
83
- else:
84
- vsand, vsilt, vcld = self.lithology_fraction_kuttan_modified(
85
- nphi, rhob, vsh_gr=vsh_gr, badhole_flag=badhole_flag, normalize=normalize
86
- )
87
-
88
- # Calculate vclb: volume of clay bound water
89
- clay_phit = clay_porosity(rhob, C[1])
90
- vclb = vcld * clay_phit
91
-
92
- return vsand, vsilt, vcld, vclb, (nphi_max_line, rhob_max_line)
93
-
94
- def lithology_fraction_kuttan(self, nphi, rhob, normalize: bool = True):
95
- """Estimate lithology volumetrics based on Kuttan's litho-porosity model.
96
-
97
- Args:
98
- nphi (float): Neutron Porosity log in v/v.
99
- rhob (float): Bulk Density log in g/cc.
100
- normalize (bool, optional): To normalize with porosity. Defaults to True.
101
-
102
- Returns:
103
- (float, float, float): vsand, vsilt, vcld
104
- """
105
- A = self.dry_sand_point
106
- B = self.dry_silt_point
107
- C = self.dry_clay_point
108
- D = self.fluid_point
109
- E = list(zip(nphi, rhob))
110
- rocklithofrac = length_a_b(A, C)
111
- sandsiltfrac = length_a_b(A, B)
112
- matrix_ratio_x = sandsiltfrac / rocklithofrac
113
-
114
- vsand = np.empty(0)
115
- vsilt = np.empty(0)
116
- vcld = np.empty(0)
117
- for i, point in enumerate(E):
118
- var_pt = line_intersection((A, C), (D, point))
119
- projlithofrac = length_a_b(var_pt, A)
120
- matrix_ratio = projlithofrac / rocklithofrac
121
- if matrix_ratio < matrix_ratio_x:
122
- phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', True, A, B, C, D) if normalize else 0
123
- vmatrix = 1 - phit
124
- vsilt = np.append(vsilt, (matrix_ratio / matrix_ratio_x) * vmatrix)
125
- vsand = np.append(vsand, (1 - vsilt[i]) * vmatrix)
126
- vcld = np.append(vcld, 0)
127
- else:
128
- phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', False, A, B, C, D) if normalize else 0
129
- vmatrix = 1 - phit
130
- vsand = np.append(vsand, 0)
131
- vsilt = np.append(vsilt, ((1 - matrix_ratio) * vmatrix) / (1 - matrix_ratio_x))
132
- vcld = np.append(vcld, (1 - vsilt[i]) * vmatrix)
133
-
134
- return vsand, vsilt, vcld
135
-
136
- def lithology_fraction_kuttan_modified(self, nphi, rhob, vsh_gr=None, badhole_flag=None, normalize: bool = True):
137
- """Estimate lithology volumetrics based on modified Kuttan's litho-porosity model
138
- (simplification of PCSB's litho-porosity model).
139
-
140
- Args:
141
- nphi (float): Neutron Porosity log in v/v.
142
- rhob (float): Bulk Density log in g/cc.
143
- normalize (bool, optional): To normalize with porosity. Defaults to True.
144
-
145
- Returns:
146
- (float, float, float): vsand, vsilt, vcld
147
- """
148
- A = self.dry_sand_point
149
- B = self.dry_silt_point
150
- C = self.dry_clay_point
151
- D = self.fluid_point
152
- badhole_flag = badhole_flag if badhole_flag is not None else np.zeros(len(nphi))
153
- vsh_gr = vsh_gr if vsh_gr is not None else np.zeros(len(nphi))
154
- E = list(zip(nphi, rhob, badhole_flag, vsh_gr))
155
-
156
- siltclayratio = 0.25 # empirical value
157
- claysiltfrac = length_a_b(C, B)
158
- rocklithofrac = length_a_b(A, C)
159
- sandsiltfrac = length_a_b(A, B)
160
- matrix_ratio_x = sandsiltfrac / rocklithofrac
161
-
162
- vsand = np.empty(0)
163
- vsilt = np.empty(0)
164
- vcld = np.empty(0)
165
- for i, point in enumerate(E):
166
- var_pt = line_intersection((A, C), (D, point))
167
- projlithofrac = length_a_b(var_pt, A)
168
- matrix_ratio = projlithofrac / rocklithofrac
169
- if point[2] == 1:
170
- phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', True, A, B, C, D) if normalize else 0
171
- vmatrix = 1 - phit
172
- vsand = np.append(vsand, (1 - point[3]) * vmatrix)
173
- vsilt = np.append(vsilt, siltclayratio * point[3] * vmatrix)
174
- vcld = np.append(vcld, (1 - siltclayratio) * point[3] * vmatrix)
175
- elif matrix_ratio < matrix_ratio_x:
176
- phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', True, A, B, C, D) if normalize else 0
177
- vmatrix = 1 - phit
178
- vsand = np.append(vsand, ((-projlithofrac / sandsiltfrac) + 1) * vmatrix)
179
- vsilt = np.append(vsilt, siltclayratio / sandsiltfrac * projlithofrac * vmatrix)
180
- vcld = np.append(vcld, ((1 - siltclayratio) / sandsiltfrac * projlithofrac) * vmatrix)
181
- else:
182
- phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', False, A, B, C, D) if normalize else 0
183
- vmatrix = 1 - phit
184
- vsand = np.append(vsand, 0)
185
- vsilt = np.append(vsilt, (-siltclayratio / claysiltfrac * projlithofrac + (
186
- rocklithofrac * siltclayratio / claysiltfrac)) * vmatrix)
187
- vcld = np.append(vcld, (siltclayratio / claysiltfrac * projlithofrac + (
188
- 1 - (siltclayratio * rocklithofrac / claysiltfrac))) * vmatrix)
189
-
190
- return vsand, vsilt, vcld
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes