quick-pp 0.2.53__tar.gz → 0.2.55__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.
- {quick_pp-0.2.53 → quick_pp-0.2.55}/PKG-INFO +1 -1
- {quick_pp-0.2.53 → quick_pp-0.2.55}/pyproject.toml +1 -1
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/__init__.py +1 -1
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/config.py +4 -4
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/core_calibration.py +1 -1
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/sand_shale.py +9 -5
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/sand_silt_clay.py +7 -3
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/feature_engineering.py +4 -10
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/porosity.py +10 -17
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/qaqc.py +1 -1
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/rock_type.py +2 -2
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/saturation.py +223 -23
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/utils.py +25 -3
- {quick_pp-0.2.53 → quick_pp-0.2.55}/.gitignore +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/LICENSE +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/README.md +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/exceptions.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/main.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/mlflow_model_deployment.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/router.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/lithology_ssc.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/permeability_choo.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/permeability_others.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/porosity.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/ressum.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_archie.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_b.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_qv.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_rw.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/chat.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/las_handler.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/lithology.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/permeability.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/porosity.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/reservoir_summary.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/services/saturation.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/static/favicon.ico +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/static/logo.png +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/template/chat.html +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/api/template/home.html +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/cli.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/fluid_type.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/las_handler.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/carbonate.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/multi_mineral.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/lithology/thin_beds.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/config.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/predict_pipeline.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/train_pipeline.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/machine_learning/utils.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/objects.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/permeability.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/plotter/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/plotter/plotter.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/plotter/well_log.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/plotter/well_log_config.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/plotter/xplots.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/ressum.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/rock_physics/__init__.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/rock_physics/geomechanics.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/rock_physics/geophysics.py +0 -0
- {quick_pp-0.2.53 → quick_pp-0.2.55}/quick_pp/rock_physics/rpm.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quick-pp
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.55
|
|
4
4
|
Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
|
|
5
5
|
Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
|
|
6
6
|
Author-email: Imran Fadhil <imranfadhil@gmail.com>
|
|
@@ -20,4 +20,4 @@ logging.getLogger("mlflow").setLevel(logging.WARNING)
|
|
|
20
20
|
|
|
21
21
|
__author__ = """Imran Fadhil"""
|
|
22
22
|
__email__ = 'imranfadhil@gmail.com'
|
|
23
|
-
__version__ = '0.2.
|
|
23
|
+
__version__ = '0.2.55' # Need to be updated manually when releasing a new version/ change in pyproject.toml
|
|
@@ -9,11 +9,11 @@ class Config(object):
|
|
|
9
9
|
VARS = dict(
|
|
10
10
|
GR=dict(name="Gamma Ray", unit="GAPI", min=0, max=200),
|
|
11
11
|
RT=dict(name="True Resistivity", unit="ohm.m", min=0, max=2000),
|
|
12
|
-
NPHI=dict(name="Neutron Porosity", unit="v/v", min=-.05, max=0
|
|
13
|
-
RHOB=dict(name="Bulk Density", unit="g/cc", min=1.
|
|
12
|
+
NPHI=dict(name="Neutron Porosity", unit="v/v", min=-.05, max=1.0),
|
|
13
|
+
RHOB=dict(name="Bulk Density", unit="g/cc", min=1.0, max=3.0),
|
|
14
14
|
PEF=dict(name="Peak Frequency", unit="Hz", min=0, max=10),
|
|
15
|
-
DTC=dict(name="DTC", unit="us/ft", min=
|
|
16
|
-
DTS=dict(name="DTS", unit="us/ft", min=
|
|
15
|
+
DTC=dict(name="DTC", unit="us/ft", min=20, max=260),
|
|
16
|
+
DTS=dict(name="DTS", unit="us/ft", min=20, max=260),
|
|
17
17
|
VSAND=dict(name="Sand Volume", unit="v/v", min=0, max=1),
|
|
18
18
|
VSILT=dict(name="Silt Volume", unit="v/v", min=0, max=1),
|
|
19
19
|
VCLAY=dict(name="Clay Volume", unit="v/v", min=0, max=1),
|
|
@@ -42,7 +42,7 @@ def poroperm_xplot(poro, perm, a=None, b=None, core_group=None, label='', log_lo
|
|
|
42
42
|
plt.xlabel('CPORE (frac)')
|
|
43
43
|
plt.xlim(0.001, 0.5)
|
|
44
44
|
plt.ylabel('CPERM (mD)')
|
|
45
|
-
plt.ylim(.001,
|
|
45
|
+
plt.ylim(.001, 1e5)
|
|
46
46
|
plt.yscale('log')
|
|
47
47
|
if log_log:
|
|
48
48
|
plt.xscale('log')
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import numpy as np
|
|
2
2
|
from typing import Optional
|
|
3
3
|
|
|
4
|
-
from quick_pp.utils import min_max_line, length_a_b, line_intersection
|
|
4
|
+
from quick_pp.utils import min_max_line, length_a_b, line_intersection, remove_outliers
|
|
5
5
|
from quick_pp.config import Config
|
|
6
6
|
from quick_pp import logger
|
|
7
7
|
|
|
@@ -45,9 +45,13 @@ class SandShale:
|
|
|
45
45
|
D = self.fluid_point
|
|
46
46
|
|
|
47
47
|
# Redefine wetclay point
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if not all(self.wet_clay_point):
|
|
48
|
+
nphi_max_line = None
|
|
49
|
+
rhob_max_line = None
|
|
50
|
+
if not all(self.wet_clay_point):
|
|
51
|
+
rhob_clean = remove_outliers(rhob)
|
|
52
|
+
nphi_clean = remove_outliers(nphi)
|
|
53
|
+
_, rhob_max_line = min_max_line(rhob_clean, 0.05)
|
|
54
|
+
_, nphi_max_line = min_max_line(nphi_clean, 0.05)
|
|
51
55
|
wetclay_RHOB = np.min(rhob_max_line)
|
|
52
56
|
wetclay_NPHI = np.max(nphi_max_line)
|
|
53
57
|
self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
|
|
@@ -67,7 +71,7 @@ class SandShale:
|
|
|
67
71
|
f"vcld: {vcld.mean():.3f}"
|
|
68
72
|
)
|
|
69
73
|
|
|
70
|
-
return vsand, vcld
|
|
74
|
+
return vsand, vcld, (nphi_max_line, rhob_max_line)
|
|
71
75
|
|
|
72
76
|
def lithology_fraction(self, nphi, rhob):
|
|
73
77
|
"""Estimate sand and shale based on neutron density cross plot.
|
|
@@ -2,7 +2,7 @@ import numpy as np
|
|
|
2
2
|
import math
|
|
3
3
|
from typing import Optional
|
|
4
4
|
|
|
5
|
-
from quick_pp.utils import min_max_line, length_a_b, line_intersection
|
|
5
|
+
from quick_pp.utils import min_max_line, length_a_b, line_intersection, remove_outliers
|
|
6
6
|
from quick_pp.config import Config
|
|
7
7
|
from quick_pp import logger
|
|
8
8
|
|
|
@@ -54,9 +54,13 @@ class SandSiltClay:
|
|
|
54
54
|
D = self.fluid_point
|
|
55
55
|
|
|
56
56
|
# Redefine wetclay point
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
nphi_max_line = None
|
|
58
|
+
rhob_max_line = None
|
|
59
59
|
if not all(self.wet_clay_point):
|
|
60
|
+
rhob_clean = remove_outliers(rhob)
|
|
61
|
+
nphi_clean = remove_outliers(nphi)
|
|
62
|
+
_, rhob_max_line = min_max_line(rhob_clean, 0.1)
|
|
63
|
+
_, nphi_max_line = min_max_line(nphi_clean, 0.1)
|
|
60
64
|
wetclay_RHOB = np.nanmin(rhob_max_line)
|
|
61
65
|
wetclay_NPHI = np.nanmax(nphi_max_line)
|
|
62
66
|
self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
|
|
@@ -99,7 +99,7 @@ def coal_flagging(nphi, rhob, rhob_threshold=2.0, nphi_threshold=0.3, window_siz
|
|
|
99
99
|
return (trend_condition & threshold_condition).astype(float)
|
|
100
100
|
|
|
101
101
|
|
|
102
|
-
def tight_streak_flagging(rhob,
|
|
102
|
+
def tight_streak_flagging(rhob, rhob_threshold=2.3, window_size=15, trend_factor=0.03):
|
|
103
103
|
"""Flag tight streak intervals based on high RHOB, high RT, and low NPHI.
|
|
104
104
|
|
|
105
105
|
Tight streaks (e.g., carbonate cemented layers) are characterized by high
|
|
@@ -109,9 +109,7 @@ def tight_streak_flagging(rhob, rt, rhob_threshold=2.5, rt_threshold=2, window_s
|
|
|
109
109
|
|
|
110
110
|
Args:
|
|
111
111
|
rhob (pd.Series): Bulk density log (g/cm³).
|
|
112
|
-
rt (pd.Series): True resistivity log (ohm.m).
|
|
113
112
|
rhob_threshold (float, optional): RHOB threshold for tight streak. Defaults to 2.5.
|
|
114
|
-
rt_threshold (float, optional): RT threshold for tight streak. Defaults to 50.
|
|
115
113
|
window_size (int, optional): The size of the rolling window for trend calculation. Defaults to 21.
|
|
116
114
|
trend_factor (float, optional): A factor to control sensitivity to trend deviation.
|
|
117
115
|
Defaults to 0.05 (5%).
|
|
@@ -121,16 +119,12 @@ def tight_streak_flagging(rhob, rt, rhob_threshold=2.5, rt_threshold=2, window_s
|
|
|
121
119
|
"""
|
|
122
120
|
# Calculate rolling averages to establish local trends
|
|
123
121
|
rhob_trend = rhob.rolling(window=window_size, center=True, min_periods=1).mean()
|
|
124
|
-
rt_trend = rt.rolling(window=window_size, center=True, min_periods=1).mean()
|
|
125
122
|
|
|
126
|
-
# Flag where RHOB
|
|
127
|
-
trend_condition = (
|
|
128
|
-
(rhob > rhob_trend * (1 + trend_factor)) &
|
|
129
|
-
(rt > rt_trend * (1 + trend_factor))
|
|
130
|
-
)
|
|
123
|
+
# Flag where RHOB are significantly above trend
|
|
124
|
+
trend_condition = (rhob > rhob_trend * (1 + trend_factor))
|
|
131
125
|
|
|
132
126
|
# Flag where values cross absolute thresholds
|
|
133
|
-
threshold_condition = (
|
|
127
|
+
threshold_condition = (rhob > rhob_threshold)
|
|
134
128
|
|
|
135
129
|
return (trend_condition & threshold_condition).astype(float)
|
|
136
130
|
|
|
@@ -48,7 +48,7 @@ def effective_porosity(phit, phi_shale, vshale):
|
|
|
48
48
|
return phie
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def
|
|
51
|
+
def estimate_shale_porosity_trend(rho_clw: np.ndarray, rho_dry_clay: float = 2.72, rho_fluid: float = 1.0):
|
|
52
52
|
"""Calculate clay porosity given bulk density of wet clay line.
|
|
53
53
|
|
|
54
54
|
Args:
|
|
@@ -65,27 +65,20 @@ def clay_porosity(rho_clw: np.ndarray, rho_dry_clay: float = 2.72, rho_fluid: fl
|
|
|
65
65
|
return phi_clay
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def
|
|
68
|
+
def estimate_shale_porosity(nphi, phit):
|
|
69
69
|
"""
|
|
70
|
-
Computes shale porosity from
|
|
70
|
+
Computes shale porosity from neutron porosity and total porosity.
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
Shale volume [fraction].
|
|
76
|
-
phi_vsh : float
|
|
77
|
-
Total porosity of shale [fraction].
|
|
72
|
+
Args:
|
|
73
|
+
nphi (float): Neutron porosity (hydrocarbon corrected) [fraction].
|
|
74
|
+
phit (float): Total porosity [fraction].
|
|
78
75
|
|
|
79
|
-
Returns
|
|
80
|
-
|
|
81
|
-
porosity : float
|
|
82
|
-
Shale porosity [fraction].
|
|
76
|
+
Returns:
|
|
77
|
+
float: Shale porosity [fraction].
|
|
83
78
|
|
|
84
79
|
"""
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
logger.debug(f"Shale porosity range: {phi_sh.min():.3f} - {phi_sh.max():.3f}")
|
|
88
|
-
return phi_sh
|
|
80
|
+
phit_sh = nphi - phit
|
|
81
|
+
return np.where(phit_sh > 0, phit_sh, phit).clip(1e-2, 1.0)
|
|
89
82
|
|
|
90
83
|
|
|
91
84
|
def rho_matrix(vsand=0, vsilt=0, vclay=0, vcalc=0, vdolo=0, vheavy=0,
|
|
@@ -182,7 +182,7 @@ def plot_rfn(cpore, cperm, rock_type=None, title='Lucia RFN'):
|
|
|
182
182
|
plt.xlabel('Porosity (frac)')
|
|
183
183
|
plt.xlim(-.05, .5)
|
|
184
184
|
plt.ylabel('Permeability (mD)')
|
|
185
|
-
plt.ylim(1e-3,
|
|
185
|
+
plt.ylim(1e-3, 1e5)
|
|
186
186
|
plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
|
|
187
187
|
|
|
188
188
|
plt.yscale('log')
|
|
@@ -218,7 +218,7 @@ def plot_winland(cpore, cperm, cut_offs=None, rock_type=None, title='Winland R35
|
|
|
218
218
|
plt.xlabel('Porosity (frac)')
|
|
219
219
|
plt.xlim(-.05, .5)
|
|
220
220
|
plt.ylabel('Permeability (mD)')
|
|
221
|
-
plt.ylim(1e-3,
|
|
221
|
+
plt.ylim(1e-3, 1e5)
|
|
222
222
|
plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
|
|
223
223
|
|
|
224
224
|
plt.yscale('log')
|
|
@@ -4,7 +4,7 @@ import matplotlib.pyplot as plt
|
|
|
4
4
|
import matplotlib.ticker as ticker
|
|
5
5
|
from tqdm import tqdm
|
|
6
6
|
|
|
7
|
-
from quick_pp.utils import min_max_line
|
|
7
|
+
from quick_pp.utils import min_max_line, remove_outliers
|
|
8
8
|
from quick_pp import logger
|
|
9
9
|
|
|
10
10
|
plt.style.use('seaborn-v0_8-paper')
|
|
@@ -82,6 +82,43 @@ def waxman_smits_saturation(rt, rw, phit, Qv=None, B=None, m=2, n=2):
|
|
|
82
82
|
return swt
|
|
83
83
|
|
|
84
84
|
|
|
85
|
+
def normalized_waxman_smits_saturation(rt, rw, phit, vshale, phit_shale, rt_shale, m=2, n=2):
|
|
86
|
+
"""Estimate water saturation based on Waxman-Smits model for dispersed clay mineral.
|
|
87
|
+
Based on Ausburn, Brian E., and Robert Freedman. "The Waxman-smits Equation For Shaly Sands:
|
|
88
|
+
i. Simple Methods Of Solution
|
|
89
|
+
ii. Error Analysis." The Log Analyst 26 (1985)
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
rt (float): True resistivity or deep resistivity log.
|
|
93
|
+
rw (float): Formation water resistivity.
|
|
94
|
+
phit (float): Total porosity.
|
|
95
|
+
|
|
96
|
+
m (float): Saturation factor.
|
|
97
|
+
n (float): Cementartion factor.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
float: Water saturation.
|
|
101
|
+
"""
|
|
102
|
+
logger.debug("Calculating Normalized Waxman-Smits saturation")
|
|
103
|
+
Qvn = estimate_qvn(vclay=vshale, phit=phit, phit_clay=phit_shale)
|
|
104
|
+
B = (phit_shale**-m / rt_shale) - (1 / rw)
|
|
105
|
+
|
|
106
|
+
# Initial guess
|
|
107
|
+
swt = 1
|
|
108
|
+
swt_i = 0
|
|
109
|
+
logger.debug("Starting iterative solution for Waxman-Smits")
|
|
110
|
+
|
|
111
|
+
# Use tqdm for progress bar during iterations
|
|
112
|
+
for i in tqdm(range(50), desc="Normalized Waxman-Smits iteration"):
|
|
113
|
+
fx = swt**n / rw + Qvn * B * swt**(n - 1) - (phit**-m / rt) # Juhasz, 1981
|
|
114
|
+
delta_sat = abs(swt - swt_i) / 2
|
|
115
|
+
swt_i = swt
|
|
116
|
+
swt = np.where(fx < 0, swt + delta_sat, swt - delta_sat)
|
|
117
|
+
|
|
118
|
+
logger.debug(f"Normalized Waxman-Smits saturation range: {min(swt)} - {max(swt)}")
|
|
119
|
+
return swt
|
|
120
|
+
|
|
121
|
+
|
|
85
122
|
def dual_water_saturation(rt, rw, phit, a, m, n, swb, rwb):
|
|
86
123
|
"""Estimate water saturation based on dual water model, an extension from Waxman-Smits by Clavier, Coates and
|
|
87
124
|
Dumanoir (1977).
|
|
@@ -117,20 +154,6 @@ def dual_water_saturation(rt, rw, phit, a, m, n, swb, rwb):
|
|
|
117
154
|
return swt
|
|
118
155
|
|
|
119
156
|
|
|
120
|
-
def estimate_swb(phit, vsh, nphi_sh):
|
|
121
|
-
"""Estimate bound water saturation based on dual water model.
|
|
122
|
-
Args:
|
|
123
|
-
phit (float): Total porosity in fraction.
|
|
124
|
-
vsh (float): Volume of shale in fraction.
|
|
125
|
-
nphi_sh (float): Neutron porosity reading in a nearby 100% shale interval in fraction.
|
|
126
|
-
|
|
127
|
-
Returns:
|
|
128
|
-
float: Bound water saturation.
|
|
129
|
-
"""
|
|
130
|
-
swb = vsh * nphi_sh / phit
|
|
131
|
-
return swb
|
|
132
|
-
|
|
133
|
-
|
|
134
157
|
def indonesian_saturation(rt, rw, phie, vsh, rsh, a, m, n):
|
|
135
158
|
"""Estimate water saturation based on Indonesian model which may work well with fresh formation water.
|
|
136
159
|
Based on Poupon-Leveaux 1971.
|
|
@@ -199,6 +222,20 @@ def connectivity_saturation(rt, rw, phit, mu=2, chi_w=0):
|
|
|
199
222
|
return sw
|
|
200
223
|
|
|
201
224
|
|
|
225
|
+
def estimate_swb(phit, vsh, nphi_sh):
|
|
226
|
+
"""Estimate bound water saturation based on dual water model.
|
|
227
|
+
Args:
|
|
228
|
+
phit (float): Total porosity in fraction.
|
|
229
|
+
vsh (float): Volume of shale in fraction.
|
|
230
|
+
nphi_sh (float): Neutron porosity reading in a nearby 100% shale interval in fraction.
|
|
231
|
+
|
|
232
|
+
Returns:
|
|
233
|
+
float: Bound water saturation.
|
|
234
|
+
"""
|
|
235
|
+
swb = vsh * nphi_sh / phit
|
|
236
|
+
return swb
|
|
237
|
+
|
|
238
|
+
|
|
202
239
|
def estimate_chi_w(s_cw, phit, sigma_cw, sigma_w, mu=2):
|
|
203
240
|
"""Estimate water connectivity correction index based on connectivity model Montaron 2009
|
|
204
241
|
Args:
|
|
@@ -218,13 +255,6 @@ def estimate_chi_w(s_cw, phit, sigma_cw, sigma_w, mu=2):
|
|
|
218
255
|
return chi_w
|
|
219
256
|
|
|
220
257
|
|
|
221
|
-
def modified_simandoux_saturation():
|
|
222
|
-
""" TODO: Estimate water saturation based on modified Simandoux's model.
|
|
223
|
-
"""
|
|
224
|
-
logger.warning("Modified Simandoux saturation not implemented yet")
|
|
225
|
-
pass
|
|
226
|
-
|
|
227
|
-
|
|
228
258
|
def estimate_temperature_gradient(tvd, unit='metric'):
|
|
229
259
|
"""Estimate formation temperature based on gradient of 25 degC/km or 15 degF/1000ft.
|
|
230
260
|
|
|
@@ -246,7 +276,7 @@ def estimate_b_waxman_smits(T, rw):
|
|
|
246
276
|
|
|
247
277
|
Args:
|
|
248
278
|
T (float): Temperature in degC.
|
|
249
|
-
rw (float):
|
|
279
|
+
rw (float): Formation water resistivity in ohm.m.
|
|
250
280
|
|
|
251
281
|
Returns:
|
|
252
282
|
float: B parameter.
|
|
@@ -361,6 +391,31 @@ def estimate_rw_from_shale_trend(rt, phit, vshale, depth, m=1.3):
|
|
|
361
391
|
return rw
|
|
362
392
|
|
|
363
393
|
|
|
394
|
+
def estimate_rt_shale(rt, vshale):
|
|
395
|
+
"""Estimate resistivity of shale.
|
|
396
|
+
|
|
397
|
+
Args:
|
|
398
|
+
rt (float): True resistivity.
|
|
399
|
+
vshale (float): Volume of shale.
|
|
400
|
+
|
|
401
|
+
Returns:
|
|
402
|
+
float: Resistivity of shale.
|
|
403
|
+
"""
|
|
404
|
+
# Identify shale intervals
|
|
405
|
+
vshale = remove_outliers(vshale)
|
|
406
|
+
|
|
407
|
+
vsh_threshold = np.nanquantile(vshale, 0.5)
|
|
408
|
+
shale_mask = vshale >= vsh_threshold
|
|
409
|
+
|
|
410
|
+
# Create a series with phit values only at shale intervals
|
|
411
|
+
rt_shale = rt.where(shale_mask).rolling(31, center=True, min_periods=1).mean()
|
|
412
|
+
|
|
413
|
+
# Forward-fill and then back-fill to propagate shale porosity
|
|
414
|
+
rt_shale = rt_shale.ffill().bfill()
|
|
415
|
+
logger.debug(f"Shale porosity range: {rt_shale.min():.3f} - {rt_shale.max():.3f}")
|
|
416
|
+
return rt_shale
|
|
417
|
+
|
|
418
|
+
|
|
364
419
|
def estimate_qv(vcld, phit, rho_clay=2.65, cec_clay=.062):
|
|
365
420
|
"""Estimate Qv, cation exchange capacity per unit total pore volume (meq/cm3).
|
|
366
421
|
|
|
@@ -379,6 +434,36 @@ def estimate_qv(vcld, phit, rho_clay=2.65, cec_clay=.062):
|
|
|
379
434
|
return qv
|
|
380
435
|
|
|
381
436
|
|
|
437
|
+
def estimate_qvn(vclay, phit, phit_clay):
|
|
438
|
+
"""Estimate normalized Qv
|
|
439
|
+
|
|
440
|
+
Args:
|
|
441
|
+
vclay (float): Volume of clay in fraction
|
|
442
|
+
phit (float): Total porosity in fraction
|
|
443
|
+
phit_clay (float): Total porosity of clay in fraction
|
|
444
|
+
|
|
445
|
+
Returns:
|
|
446
|
+
float: Normalized Qv.
|
|
447
|
+
"""
|
|
448
|
+
return vclay * phit_clay / phit
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
def estimate_qv_ward(rt, phit, B, rw, m):
|
|
452
|
+
"""Estimate Qv based on B. Ward (SIPM), 1973
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
rt (float): True resistivity in ohm.m from a water-bearing zone.
|
|
456
|
+
phit (float): Total porosity in fraction.
|
|
457
|
+
B (float): Conductance parameter for Waxman-Smits.
|
|
458
|
+
rw (float): Formation water resistivity in ohm.m.
|
|
459
|
+
m (float): Cementation exponent.
|
|
460
|
+
|
|
461
|
+
Returns:
|
|
462
|
+
float: Qv in meq/cm3.
|
|
463
|
+
"""
|
|
464
|
+
return 1 / B * ((1 / (rt * phit**m)) - (1 / rw))
|
|
465
|
+
|
|
466
|
+
|
|
382
467
|
def estimate_qv_hill(vclb, phit, water_salinity=10000):
|
|
383
468
|
"""Estimating Qv based on Hill et. al, 1979.
|
|
384
469
|
|
|
@@ -413,6 +498,20 @@ def estimate_qv_lavers(phit, a=3.05e-4, b=3.49):
|
|
|
413
498
|
return qv
|
|
414
499
|
|
|
415
500
|
|
|
501
|
+
def estimate_bqv(phit, max_phit_clean_sand, C):
|
|
502
|
+
"""Estimate BQv (Bulk volume of clay bound water) based on Juhasz/ Rackley method.
|
|
503
|
+
|
|
504
|
+
Args:
|
|
505
|
+
phit (float): Total porosity.
|
|
506
|
+
max_phit_clean_sand (float): Maximum porosity of clean sand.
|
|
507
|
+
C (float): Constant depending on clay type.
|
|
508
|
+
|
|
509
|
+
Returns:
|
|
510
|
+
float: Bulk volume of clay bound water.
|
|
511
|
+
"""
|
|
512
|
+
return (max_phit_clean_sand - phit) / (C * phit)
|
|
513
|
+
|
|
514
|
+
|
|
416
515
|
def estimate_m_archie(rt, rw, phit):
|
|
417
516
|
"""Estimate apparent m (saturation factor) based on Archie's equation in water bearing zone.
|
|
418
517
|
|
|
@@ -449,6 +548,58 @@ def estimate_m_indonesian(rt, rw, phie, vsh, rsh):
|
|
|
449
548
|
return m
|
|
450
549
|
|
|
451
550
|
|
|
551
|
+
def qv_phit_xplot(phit, qv):
|
|
552
|
+
"""Generate BQV plot (Cwa vs 1/PHIT) and fit a best straight line."""
|
|
553
|
+
fig, ax = plt.subplots()
|
|
554
|
+
ax.set_title("Qv vs 1/PHIT")
|
|
555
|
+
|
|
556
|
+
# Prepare data for plotting and fitting
|
|
557
|
+
x = 1 / phit
|
|
558
|
+
y = qv
|
|
559
|
+
|
|
560
|
+
# Remove non-finite values for a clean fit
|
|
561
|
+
mask = np.isfinite(x) & np.isfinite(y)
|
|
562
|
+
ax.scatter(x[mask], y[mask], marker='.')
|
|
563
|
+
|
|
564
|
+
# Fit a straight line using np.polyfit
|
|
565
|
+
m, c = np.polyfit(x[mask], y[mask], 1)
|
|
566
|
+
ax.plot(x[mask], m * x[mask] + c, color='r', linestyle='--', label=f'y = {m:.2f}x + {c:.2f}')
|
|
567
|
+
|
|
568
|
+
ax.set_xlabel('1 / PHIT (frac)')
|
|
569
|
+
ax.set_ylabel('Qv (meq/cc)')
|
|
570
|
+
ax.legend()
|
|
571
|
+
ax.minorticks_on()
|
|
572
|
+
ax.grid(True, which='major', linestyle='--', linewidth='0.5', color='gray')
|
|
573
|
+
ax.grid(True, which='minor', linestyle=':', linewidth='0.3', color='gray')
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
def cwa_qvn_xplot(rt, phit, qvn, m=2.0, rw=.2, B=None, C=None, slope=250):
|
|
577
|
+
"""Generate Cwa vs Qvn plot."""
|
|
578
|
+
x = qvn
|
|
579
|
+
y = 1 / (rt * phit**m)
|
|
580
|
+
if len(x) != len(y):
|
|
581
|
+
logger.warning(f"Length mismatch between Qvn ({len(x)}) and Cwa ({len(y)}). Plot may be incorrect.")
|
|
582
|
+
|
|
583
|
+
fig, ax = plt.subplots()
|
|
584
|
+
ax.set_title("Cwa vs Qvn")
|
|
585
|
+
ax.scatter(x, y, marker='.')
|
|
586
|
+
|
|
587
|
+
# Add straight line
|
|
588
|
+
x_line = np.linspace(0, 1.0, len(x))
|
|
589
|
+
y_line = 1 / rw + x_line * slope
|
|
590
|
+
ax.plot(x_line, y_line, 'r--', label=f'm= {m} \nrw= {rw} \nslope= {slope}')
|
|
591
|
+
|
|
592
|
+
ax.set_xlabel('Qvn (meq/cc)')
|
|
593
|
+
ax.set_ylabel('Cwa (1 / ohm.m)')
|
|
594
|
+
ax.set_xlim(0, 1.0)
|
|
595
|
+
ax.set_ylim(0, 100)
|
|
596
|
+
ax.minorticks_on()
|
|
597
|
+
ax.grid(True)
|
|
598
|
+
fig.tight_layout()
|
|
599
|
+
ax.legend()
|
|
600
|
+
return fig
|
|
601
|
+
|
|
602
|
+
|
|
452
603
|
def swirr_xplot(swt, phit, c=.0125, label='', log_log=False, title=''):
|
|
453
604
|
"""Plot SWT vs PHIT for sand intervales only and estimate Swirr from cross plot.
|
|
454
605
|
Based on Buckles, 1965.
|
|
@@ -476,10 +627,56 @@ def swirr_xplot(swt, phit, c=.0125, label='', log_log=False, title=''):
|
|
|
476
627
|
if log_log:
|
|
477
628
|
ax.set_xscale('log')
|
|
478
629
|
ax.set_yscale('log')
|
|
630
|
+
ax.minorticks_on()
|
|
631
|
+
ax.grid(True, which='major', linestyle='--', linewidth='0.5', color='gray')
|
|
632
|
+
ax.grid(True, which='minor', linestyle=':', linewidth='0.3', color='gray')
|
|
479
633
|
fig.tight_layout()
|
|
480
634
|
logger.debug("Swirr crossplot created")
|
|
481
635
|
|
|
482
636
|
|
|
637
|
+
def rt_phit_xplot(rt, phit, m=2, rw=.01):
|
|
638
|
+
"""Generate RT vs PHIT plot.
|
|
639
|
+
|
|
640
|
+
This plot is useful for visualizing the relationship between true resistivity
|
|
641
|
+
and total porosity, often used for identifying water-bearing zones and estimating
|
|
642
|
+
formation water resistivity (Rw) and cementation exponent (m).
|
|
643
|
+
|
|
644
|
+
Args:
|
|
645
|
+
rt (float): True resistivity or deep resistivity log (ohm.m).
|
|
646
|
+
phit (float): Total porosity (fraction).
|
|
647
|
+
m (float, optional): Cementation exponent for the iso-line. Defaults to 2.
|
|
648
|
+
rw (float, optional): Formation water resistivity for the iso-line (ohm.m). Defaults to 0.01.
|
|
649
|
+
|
|
650
|
+
Returns:
|
|
651
|
+
matplotlib.figure.Figure: The RT vs PHIT plot.
|
|
652
|
+
"""
|
|
653
|
+
fig, ax = plt.subplots()
|
|
654
|
+
ax.set_title("RT vs PHIT")
|
|
655
|
+
ax.scatter(phit, rt, marker='.')
|
|
656
|
+
|
|
657
|
+
# Add iso-lines
|
|
658
|
+
phit_i = np.arange(0, 1, 1 / len(phit))
|
|
659
|
+
rt_i = phit_i**-m * rw
|
|
660
|
+
ax.plot(phit_i, rt_i, 'r--', alpha=0.5, label=f'm= {m} \nrw= {rw}')
|
|
661
|
+
|
|
662
|
+
ax.set_ylabel('RT (ohm.m)')
|
|
663
|
+
ax.set_xlabel('PHIT (frac)')
|
|
664
|
+
ax.loglog()
|
|
665
|
+
ax.set_xlim(1e-2, 1)
|
|
666
|
+
ax.set_ylim(1e-2, 1e2)
|
|
667
|
+
|
|
668
|
+
ax.minorticks_on()
|
|
669
|
+
ax.grid(True, which='major', linestyle='--', linewidth='0.5', color='gray')
|
|
670
|
+
ax.grid(True, which='minor', linestyle=':', linewidth='0.3', color='gray')
|
|
671
|
+
ax.xaxis.set_major_formatter(ticker.FuncFormatter(
|
|
672
|
+
lambda x, pos: ('{{:.{:1d}f}}'.format(int(np.maximum(-np.log10(x), 0)))).format(x)))
|
|
673
|
+
ax.yaxis.set_major_formatter(ticker.FuncFormatter(
|
|
674
|
+
lambda x, pos: ('{{:.{:1d}f}}'.format(int(np.maximum(-np.log10(x), 0)))).format(x)))
|
|
675
|
+
ax.legend()
|
|
676
|
+
fig.tight_layout()
|
|
677
|
+
return fig
|
|
678
|
+
|
|
679
|
+
|
|
483
680
|
def pickett_plot(rt, phit, m=-2, min_rw=0.1, shift=.2, title='Pickett Plot'):
|
|
484
681
|
"""Generate Pickett plot which is used to plot phit and rt at water bearing interval to determine;
|
|
485
682
|
m = The slope of best-fit line crossing the cleanest sand.
|
|
@@ -519,6 +716,9 @@ def pickett_plot(rt, phit, m=-2, min_rw=0.1, shift=.2, title='Pickett Plot'):
|
|
|
519
716
|
ax.set_xlabel('RT (ohm.m)')
|
|
520
717
|
|
|
521
718
|
ax.legend()
|
|
719
|
+
ax.minorticks_on()
|
|
720
|
+
ax.grid(True, which='major', linestyle='--', linewidth='0.5', color='gray')
|
|
721
|
+
ax.grid(True, which='minor', linestyle=':', linewidth='0.3', color='gray')
|
|
522
722
|
fig.tight_layout()
|
|
523
723
|
logger.debug("Pickett plot created")
|
|
524
724
|
|
|
@@ -413,11 +413,14 @@ def remove_straights(log, window: int = 30, threshold: float = 0.001):
|
|
|
413
413
|
|
|
414
414
|
|
|
415
415
|
def get_tvd(df, well_coords):
|
|
416
|
-
"""
|
|
416
|
+
"""Calculate true vertical depth (TVD) given well survey data.
|
|
417
417
|
|
|
418
418
|
Args:
|
|
419
|
-
df (
|
|
420
|
-
well_coords (
|
|
419
|
+
df (pd.DataFrame): Dataframe with DEPTH column.
|
|
420
|
+
well_coords (pd.DataFrame): Dataframe with md, incl and azim columns.
|
|
421
|
+
|
|
422
|
+
Returns:
|
|
423
|
+
np.array: TVD values.
|
|
421
424
|
"""
|
|
422
425
|
import wellpathpy as wpp
|
|
423
426
|
|
|
@@ -425,3 +428,22 @@ def get_tvd(df, well_coords):
|
|
|
425
428
|
# Resample the survey at the exact MD points from the log data
|
|
426
429
|
tvd = dev_survey.minimum_curvature().resample(df['DEPTH'].values).depth
|
|
427
430
|
return tvd
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def remove_outliers(curve):
|
|
434
|
+
"""Removes outliers from a curve using the IQR method and forward fills the NaNs.
|
|
435
|
+
|
|
436
|
+
Args:
|
|
437
|
+
curve (np.array): The input curve data.
|
|
438
|
+
|
|
439
|
+
Returns:
|
|
440
|
+
np.array: The curve with outliers replaced by NaN and then forward filled.
|
|
441
|
+
"""
|
|
442
|
+
q1, q3 = np.nanquantile(curve, [0.25, 0.75])
|
|
443
|
+
iqr = q3 - q1
|
|
444
|
+
upper_bound = q3 + 1.5 * iqr
|
|
445
|
+
lower_bound = q1 - 1.5 * iqr
|
|
446
|
+
|
|
447
|
+
# Replace outliers with NaN and then forward fill
|
|
448
|
+
curve_series = pd.Series(curve)
|
|
449
|
+
return curve_series.where((curve_series >= lower_bound) & (curve_series <= upper_bound))
|
|
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
|
|
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
|
|
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
|
|
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
|