quick-pp 0.2.3__py3-none-any.whl
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/__init__.py +0 -0
- quick_pp/api/__init__.py +0 -0
- quick_pp/api/exceptions.py +61 -0
- quick_pp/api/fastapi_mlflow/__init__.py +1 -0
- quick_pp/api/fastapi_mlflow/_mlflow_types.py +59 -0
- quick_pp/api/fastapi_mlflow/applications.py +72 -0
- quick_pp/api/fastapi_mlflow/exceptions.py +22 -0
- quick_pp/api/fastapi_mlflow/predictors.py +96 -0
- quick_pp/api/main.py +90 -0
- quick_pp/api/mlflow_model_deployment.py +99 -0
- quick_pp/api/qpp_assistant.py +160 -0
- quick_pp/api/router.py +18 -0
- quick_pp/api/schemas/lithology_hc_correction.py +39 -0
- quick_pp/api/schemas/lithology_ssc.py +37 -0
- quick_pp/api/schemas/lithology_vsh_gr.py +25 -0
- quick_pp/api/schemas/permeability_choo.py +25 -0
- quick_pp/api/schemas/permeability_others.py +24 -0
- quick_pp/api/schemas/porosity.py +22 -0
- quick_pp/api/schemas/ressum.py +29 -0
- quick_pp/api/schemas/saturation_archie.py +25 -0
- quick_pp/api/schemas/saturation_b.py +24 -0
- quick_pp/api/schemas/saturation_qv.py +26 -0
- quick_pp/api/schemas/saturation_rw.py +24 -0
- quick_pp/api/schemas/saturation_temp_grad.py +24 -0
- quick_pp/api/schemas/saturation_waxman_smits.py +28 -0
- quick_pp/api/services/las_handler.py +136 -0
- quick_pp/api/services/lithology.py +278 -0
- quick_pp/api/services/permeability.py +252 -0
- quick_pp/api/services/porosity.py +151 -0
- quick_pp/api/services/reservoir_summary.py +78 -0
- quick_pp/api/services/saturation.py +359 -0
- quick_pp/api/static/favicon.ico +0 -0
- quick_pp/api/static/logo.png +0 -0
- quick_pp/cli.py +118 -0
- quick_pp/config.py +94 -0
- quick_pp/core_calibration.py +394 -0
- quick_pp/fluid_type.py +128 -0
- quick_pp/geomechanics.py +195 -0
- quick_pp/las_handler.py +327 -0
- quick_pp/lithology/__init__.py +80 -0
- quick_pp/lithology/carbonate.py +166 -0
- quick_pp/lithology/multi_mineral.py +151 -0
- quick_pp/lithology/sand_shale.py +79 -0
- quick_pp/lithology/sand_silt_clay.py +131 -0
- quick_pp/logger.py +19 -0
- quick_pp/modelling/__init__.py +0 -0
- quick_pp/modelling/config.py +72 -0
- quick_pp/modelling/mock_data/mock_data.parquet +0 -0
- quick_pp/modelling/predict_pipeline.py +126 -0
- quick_pp/modelling/train_pipeline.py +220 -0
- quick_pp/modelling/utils.py +111 -0
- quick_pp/objects.py +177 -0
- quick_pp/permeability.py +151 -0
- quick_pp/plotter/__init__.py +0 -0
- quick_pp/plotter/plotter.py +315 -0
- quick_pp/plotter/well_log.py +187 -0
- quick_pp/plotter/well_log_config.py +409 -0
- quick_pp/porosity.py +341 -0
- quick_pp/qaqc.py +436 -0
- quick_pp/ressum.py +326 -0
- quick_pp/rock_type.py +499 -0
- quick_pp/saturation.py +455 -0
- quick_pp/utils.py +328 -0
- quick_pp-0.2.3.dist-info/METADATA +103 -0
- quick_pp-0.2.3.dist-info/RECORD +69 -0
- quick_pp-0.2.3.dist-info/WHEEL +4 -0
- quick_pp-0.2.3.dist-info/entry_points.txt +2 -0
- quick_pp-0.2.3.dist-info/licenses/AUTHORS.rst +13 -0
- quick_pp-0.2.3.dist-info/licenses/LICENSE +22 -0
quick_pp/utils.py
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from sklearn.preprocessing import MinMaxScaler
|
|
4
|
+
from scipy.signal import detrend
|
|
5
|
+
import math
|
|
6
|
+
import ruptures.detection as rpt
|
|
7
|
+
import scipy.stats as stats
|
|
8
|
+
from scipy.signal import find_peaks
|
|
9
|
+
|
|
10
|
+
from quick_pp.logger import logger
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def length_a_b(A: tuple, B: tuple):
|
|
14
|
+
"""Calculates the length of line between two points.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
A (tuple): Cartesian coordinates of point A.
|
|
18
|
+
B (tuple): Cartesian coordinates of point B.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
float: Length of line between two points.
|
|
22
|
+
"""
|
|
23
|
+
return math.sqrt(sum([(a - b) ** 2 for a, b in zip(A, B)]))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def line_intersection(line1, line2):
|
|
27
|
+
"""Calculates the intersection of two lines.
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
line1 (tuple of tuples): ((x11, y11), (x12, y12))
|
|
31
|
+
line2 (tuple of tuples): ((x22, y22), (x22, y22))
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
float, float: Cartesian coordinates of the intersection of two lines.
|
|
35
|
+
"""
|
|
36
|
+
xdiff = (line1[0][0] - line1[1][0], line2[0][0] - line2[1][0])
|
|
37
|
+
ydiff = (line1[0][1] - line1[1][1], line2[0][1] - line2[1][1])
|
|
38
|
+
|
|
39
|
+
def det(a, b):
|
|
40
|
+
return a[0] * b[1] - a[1] * b[0]
|
|
41
|
+
|
|
42
|
+
div = det(xdiff, ydiff)
|
|
43
|
+
if div == 0:
|
|
44
|
+
logger.error(f'\r{line1} and {line2} lines do not intersect')
|
|
45
|
+
return np.nan, np.nan
|
|
46
|
+
|
|
47
|
+
d = (det(*line1), det(*line2))
|
|
48
|
+
x = det(d, xdiff) / div
|
|
49
|
+
y = det(d, ydiff) / div
|
|
50
|
+
|
|
51
|
+
return x, y
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def zone_flagging(data: pd.DataFrame):
|
|
55
|
+
"""Flagging sand zones based on VSHALE, VCLW, and VSH_GR.
|
|
56
|
+
|
|
57
|
+
Returns:
|
|
58
|
+
pd.DataFrame: Original DataFrame with ZONE_FLAG and ZONES columns.
|
|
59
|
+
"""
|
|
60
|
+
df = data.copy()
|
|
61
|
+
if 'ZONES' not in df.columns:
|
|
62
|
+
df['ZONES'] = 'FORMATION'
|
|
63
|
+
df['ZONES'].fillna('FORMATION', inplace=True)
|
|
64
|
+
|
|
65
|
+
return_df = pd.DataFrame()
|
|
66
|
+
for _, well_data in df.groupby('WELL_NAME'):
|
|
67
|
+
# Using VSHALE if available otherwise calculate VSH_GR
|
|
68
|
+
if 'VSHALE' in well_data.columns:
|
|
69
|
+
well_data['vsh_curve'] = well_data['VSHALE']
|
|
70
|
+
else:
|
|
71
|
+
dtr_gr = detrend(well_data[['GR']].fillna(well_data['GR'].median()), axis=0) + well_data['GR'].mean()
|
|
72
|
+
well_data['vsh_curve'] = MinMaxScaler().fit_transform(dtr_gr)
|
|
73
|
+
threshold = np.nanquantile(well_data['vsh_curve'], .7, method='median_unbiased')
|
|
74
|
+
|
|
75
|
+
# Estimate ZONE_FLAG using VSH_GR
|
|
76
|
+
well_data['RES_FLAG'] = np.where(well_data['vsh_curve'] < threshold, 1, 0)
|
|
77
|
+
well_data['ZONES_FLAG'] = np.where(
|
|
78
|
+
well_data['vsh_curve'].rolling(25, win_type='boxcar', center=True).mean() < threshold, 1, 0)
|
|
79
|
+
well_data['ZONES_FLAG'] = well_data['ZONES_FLAG'].fillna(0)
|
|
80
|
+
|
|
81
|
+
# Fill in empty ZONES
|
|
82
|
+
no_zones_df = well_data[well_data['ZONES'] == 'FORMATION']
|
|
83
|
+
if not no_zones_df.empty:
|
|
84
|
+
# Assign generic ZONES
|
|
85
|
+
df_temp = pd.DataFrame()
|
|
86
|
+
sand_counter = 1
|
|
87
|
+
shale_counter = 0
|
|
88
|
+
for i, data in no_zones_df.iterrows():
|
|
89
|
+
if data['ZONES_FLAG'] == 1 and shale_counter == 1:
|
|
90
|
+
sand_counter += 1
|
|
91
|
+
shale_counter = 0
|
|
92
|
+
if data['ZONES_FLAG'] == 1:
|
|
93
|
+
data['ZONES'] = f'ZONE_{sand_counter}'
|
|
94
|
+
else:
|
|
95
|
+
data['ZONES'] = f'ZONE_{sand_counter}'
|
|
96
|
+
shale_counter = 1
|
|
97
|
+
df_temp = pd.concat([df_temp, pd.DataFrame(data[['DEPTH', 'ZONES']]).T], axis=0)
|
|
98
|
+
df_temp.reset_index(drop=True, inplace=True)
|
|
99
|
+
well_data.loc[well_data['DEPTH'].isin(df_temp['DEPTH']), 'ZONES'] = df_temp['ZONES']
|
|
100
|
+
|
|
101
|
+
# Replace small 'ZONE_'s with np.nan and ffill
|
|
102
|
+
remove_sands = well_data[well_data['ZONES'].str.contains('ZONE_', na=False)][['DEPTH', 'ZONES']].groupby(
|
|
103
|
+
'ZONES').count().reset_index()
|
|
104
|
+
remove_sands = remove_sands[remove_sands['DEPTH'] < 70]
|
|
105
|
+
well_data['ZONES'] = well_data['ZONES'].apply(
|
|
106
|
+
lambda x: x if x not in remove_sands['ZONES'].to_list() else np.nan)
|
|
107
|
+
well_data['ZONES'] = well_data['ZONES'].ffill().bfill()
|
|
108
|
+
|
|
109
|
+
return_df = pd.concat([return_df, well_data], ignore_index=True)
|
|
110
|
+
|
|
111
|
+
return return_df
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def power_law_func(x, a, b):
|
|
115
|
+
"""Generic power law function.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
x (float): Input variable.
|
|
119
|
+
a (float): a constant.
|
|
120
|
+
b (float): b constant.
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
float: y = a * x^b
|
|
124
|
+
"""
|
|
125
|
+
return a * x**b
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def inv_power_law_func(x, a, b):
|
|
129
|
+
"""Generic power law function.
|
|
130
|
+
|
|
131
|
+
Args:
|
|
132
|
+
x (float): Input variable.
|
|
133
|
+
a (float): a constant.
|
|
134
|
+
b (float): b constant.
|
|
135
|
+
|
|
136
|
+
Returns:
|
|
137
|
+
float: y = a * x^-b
|
|
138
|
+
"""
|
|
139
|
+
return a * x**-b
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def straight_line_func(x, m, c):
|
|
143
|
+
"""Generic straight line function.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
x (float): Input variable.
|
|
147
|
+
m (float): Slope of the line.
|
|
148
|
+
c (float): Y intercept of the line.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
float: y = m * x + c
|
|
152
|
+
"""
|
|
153
|
+
return m * x + c
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def min_max_line(feature, alpha: float = 0.05, auto_bin=False):
|
|
157
|
+
"""Calculates the minimum and maximum line of a feature, grouped based on change points.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
feature (float): Input feature to calculate the minimum and maximum line.
|
|
161
|
+
alpha (float, optional): Correction in percentage. Defaults to 0.05.
|
|
162
|
+
auto_bin (bool, optional): Automatically bin the feature. Defaults to False.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
(float, float): Minimum and maximum line of a feature.
|
|
166
|
+
"""
|
|
167
|
+
# Reset index if feature is a Series
|
|
168
|
+
if isinstance(feature, pd.Series):
|
|
169
|
+
feature.reset_index(drop=True, inplace=True)
|
|
170
|
+
list_of_dfs = [feature]
|
|
171
|
+
if auto_bin:
|
|
172
|
+
# Estimating number of peaks
|
|
173
|
+
signal_data = feature
|
|
174
|
+
kde = stats.gaussian_kde(signal_data[~np.isnan(signal_data)])
|
|
175
|
+
evaluated = kde.evaluate(np.linspace(np.nanmin(signal_data), np.nanmax(signal_data), 100))
|
|
176
|
+
peaks, _ = find_peaks(evaluated, height=np.nanmedian(evaluated))
|
|
177
|
+
|
|
178
|
+
# Detecting change points
|
|
179
|
+
model = "l2"
|
|
180
|
+
jump = len(signal_data) // (len(peaks) + 1)
|
|
181
|
+
my_bkps = rpt.BottomUp(model=model, jump=jump).fit_predict(signal_data, n_bkps=len(peaks))
|
|
182
|
+
my_bkps = np.insert(my_bkps, 0, 0)
|
|
183
|
+
|
|
184
|
+
list_of_dfs = [feature[my_bkps[i]:my_bkps[i + 1]] for i in range(len(my_bkps) - 1)]
|
|
185
|
+
|
|
186
|
+
min_lines = np.empty(0)
|
|
187
|
+
max_lines = np.empty(0)
|
|
188
|
+
# Enumerate over the bins
|
|
189
|
+
for data in list_of_dfs:
|
|
190
|
+
num_data = len(data)
|
|
191
|
+
if num_data > 0:
|
|
192
|
+
try:
|
|
193
|
+
(min_line_slope, min_line_intercept), (max_line_slope, max_line_intercept) = fit_trendlines_single(data)
|
|
194
|
+
min_line = straight_line_func(
|
|
195
|
+
np.arange(num_data), min_line_slope, min_line_intercept) + alpha * max(abs(data))
|
|
196
|
+
max_line = straight_line_func(
|
|
197
|
+
np.arange(num_data), max_line_slope, max_line_intercept) - alpha * max(abs(data))
|
|
198
|
+
min_lines = np.append(min_lines, min_line)
|
|
199
|
+
max_lines = np.append(max_lines, max_line)
|
|
200
|
+
except Exception as e:
|
|
201
|
+
logger.error(f'Error: {e}')
|
|
202
|
+
min_lines = np.append(min_lines, np.nan)
|
|
203
|
+
max_lines = np.append(max_lines, np.nan)
|
|
204
|
+
else:
|
|
205
|
+
min_lines = np.append(min_lines, np.nan)
|
|
206
|
+
max_lines = np.append(max_lines, np.nan)
|
|
207
|
+
return min_lines, max_lines
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def check_trend_line(minimum: bool, pivot: int, slope: float, y: np.array):
|
|
211
|
+
"""Check if the trend line is valid. Based on TrendLineAutomation by neurotrader888.
|
|
212
|
+
Computes sum of differences between trend line and feature, return negative val if invalid
|
|
213
|
+
|
|
214
|
+
Args:
|
|
215
|
+
minimum (bool): Whether to check for minimum or maximum.
|
|
216
|
+
pivot (int): Anchor point of the trend line.
|
|
217
|
+
slope (float): Slope of the trend line.
|
|
218
|
+
y (np.array): Data to fit the trend line.
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
float: Sum of differences between trend line and feature.
|
|
222
|
+
"""
|
|
223
|
+
# Find the intercept of the line going through pivot point with given slope
|
|
224
|
+
intercept = -slope * pivot + y[pivot]
|
|
225
|
+
line_vals = slope * np.arange(len(y)) + intercept
|
|
226
|
+
|
|
227
|
+
diffs = line_vals - y
|
|
228
|
+
|
|
229
|
+
# Check to see if the line is valid, return -1 if it is not valid.
|
|
230
|
+
if (minimum and diffs.max() > 1e-5) or (not minimum and diffs.min() < -1e-5):
|
|
231
|
+
return -1.0
|
|
232
|
+
|
|
233
|
+
# Squared sum of diffs between data and line
|
|
234
|
+
err = (diffs ** 2.0).sum()
|
|
235
|
+
return err
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
def optimize_slope(minimum: bool, pivot: int, init_slope: float, y: np.array):
|
|
239
|
+
"""Optimize the slope of the trend line. Based on TrendLineAutomation by neurotrader888.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
minimum (bool): Whether to optimize for minimum or maximum.
|
|
243
|
+
pivot (int): Anchor point of the trend line.
|
|
244
|
+
init_slope (float): Initial slope of the trend line.
|
|
245
|
+
y (np.array): Data to fit the trend line.
|
|
246
|
+
|
|
247
|
+
Raises:
|
|
248
|
+
Exception: If the derivative fails.
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
tuple: Tuple containing the slope and intercept of the optimized trend
|
|
252
|
+
"""
|
|
253
|
+
# Optmization variables
|
|
254
|
+
curr_step = 1.0
|
|
255
|
+
min_step = 0.0001
|
|
256
|
+
|
|
257
|
+
# Initiate at the slope of the line of best fit
|
|
258
|
+
best_slope = init_slope
|
|
259
|
+
best_err = check_trend_line(minimum, pivot, init_slope, y)
|
|
260
|
+
assert (best_err >= 0.0) # Shouldn't ever fail with initial slope
|
|
261
|
+
|
|
262
|
+
slope_unit = (y.max() - y.min()) / len(y)
|
|
263
|
+
get_derivative = True
|
|
264
|
+
derivative = None
|
|
265
|
+
while curr_step > min_step:
|
|
266
|
+
|
|
267
|
+
if get_derivative:
|
|
268
|
+
# Numerical differentiation, increase slope by very small amount to see if error increases/ decreases.
|
|
269
|
+
# Gives us the direction to change slope.
|
|
270
|
+
slope_change = best_slope + slope_unit * min_step
|
|
271
|
+
test_err = check_trend_line(minimum, pivot, slope_change, y)
|
|
272
|
+
derivative = test_err - best_err
|
|
273
|
+
|
|
274
|
+
# If increasing by a small amount fails, try decreasing by a small amount
|
|
275
|
+
if test_err < 0.0:
|
|
276
|
+
slope_change = best_slope - slope_unit * min_step
|
|
277
|
+
test_err = check_trend_line(minimum, pivot, slope_change, y)
|
|
278
|
+
derivative = best_err - test_err
|
|
279
|
+
|
|
280
|
+
if test_err < 0.0: # Derivative failed, give up
|
|
281
|
+
raise Exception("Derivative failed. Check your data.")
|
|
282
|
+
|
|
283
|
+
get_derivative = False
|
|
284
|
+
|
|
285
|
+
if derivative > 0.0: # Increasing slope increased error
|
|
286
|
+
test_slope = best_slope - slope_unit * curr_step
|
|
287
|
+
else: # Increasing slope decreased error
|
|
288
|
+
test_slope = best_slope + slope_unit * curr_step
|
|
289
|
+
|
|
290
|
+
test_err = check_trend_line(minimum, pivot, test_slope, y)
|
|
291
|
+
if test_err < 0 or test_err >= best_err:
|
|
292
|
+
# Slope failed/ didn't reduce error
|
|
293
|
+
curr_step *= 0.5 # Reduce step size
|
|
294
|
+
else: # Test slope reduced error
|
|
295
|
+
best_err = test_err
|
|
296
|
+
best_slope = test_slope
|
|
297
|
+
get_derivative = True # Recompute derivative
|
|
298
|
+
|
|
299
|
+
# Optimize done, return best slope and intercept
|
|
300
|
+
return (best_slope, -best_slope * pivot + y[pivot])
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def fit_trendlines_single(data: np.array):
|
|
304
|
+
"""Find line of best fit (least squared). Based on TrendLineAutomation by neurotrader888.
|
|
305
|
+
|
|
306
|
+
Args:
|
|
307
|
+
data (np.array): Curve to fit the trend lines.
|
|
308
|
+
|
|
309
|
+
Returns:
|
|
310
|
+
tuple: Tuples containing the slope and intercept of the min and max trend line.
|
|
311
|
+
"""
|
|
312
|
+
x = np.arange(len(data))
|
|
313
|
+
coefs = np.polyfit(x, data, 1)
|
|
314
|
+
slope = coefs[0]
|
|
315
|
+
intercept = coefs[1]
|
|
316
|
+
|
|
317
|
+
# Get points of line.
|
|
318
|
+
line_points = slope * x + intercept
|
|
319
|
+
|
|
320
|
+
# Find upper and lower pivot points
|
|
321
|
+
upper_pivot = (data - line_points).argmax()
|
|
322
|
+
lower_pivot = (data - line_points).argmin()
|
|
323
|
+
|
|
324
|
+
# Optimize the slope for both trend lines
|
|
325
|
+
min_line_coefs = optimize_slope(True, lower_pivot, slope, data)
|
|
326
|
+
max_line_coefs = optimize_slope(False, upper_pivot, slope, data)
|
|
327
|
+
|
|
328
|
+
return (min_line_coefs, max_line_coefs)
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quick-pp
|
|
3
|
+
Version: 0.2.3
|
|
4
|
+
Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
|
|
5
|
+
Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
|
|
6
|
+
Author-email: Imran Fadhil <imranfadhil@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: AUTHORS.rst
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: analysis,geoscience,log,petrophysics,quick_pp,well
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Natural Language :: English
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: chainlit==2.5.5
|
|
18
|
+
Requires-Dist: click>=7.0
|
|
19
|
+
Requires-Dist: fastapi
|
|
20
|
+
Requires-Dist: fastapi-mcp
|
|
21
|
+
Requires-Dist: langchain-ollama==0.3.3
|
|
22
|
+
Requires-Dist: loguru
|
|
23
|
+
Requires-Dist: matplotlib==3.8.0
|
|
24
|
+
Requires-Dist: mlflow
|
|
25
|
+
Requires-Dist: orjson
|
|
26
|
+
Requires-Dist: pandas
|
|
27
|
+
Requires-Dist: psycopg2-binary
|
|
28
|
+
Requires-Dist: ptitprince
|
|
29
|
+
Requires-Dist: ruptures
|
|
30
|
+
Requires-Dist: salib==1.5.1
|
|
31
|
+
Requires-Dist: scikit-learn
|
|
32
|
+
Requires-Dist: statsmodels
|
|
33
|
+
Requires-Dist: welly
|
|
34
|
+
Description-Content-Type: text/markdown
|
|
35
|
+
|
|
36
|
+
# quick_pp
|
|
37
|
+
|
|
38
|
+
Python package to assist in providing quick-look/ preliminary petrophysical estimation.
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+
## Quick Start (Jupyter Notebook Examples)
|
|
42
|
+
1. Create virtual environment (tested working with Python3.10.9)
|
|
43
|
+
> python -m venv venv
|
|
44
|
+
|
|
45
|
+
2. Activate virtual environment
|
|
46
|
+
> venv\Scripts\activate (Windows)
|
|
47
|
+
|
|
48
|
+
> source venv/bin/activate (Linux)
|
|
49
|
+
|
|
50
|
+
3. Install requirements
|
|
51
|
+
> pip install -r requirements.txt
|
|
52
|
+
|
|
53
|
+
4. Launch the notebook and run the cells
|
|
54
|
+
- 01_data_handler: create the MOCK qppp project file.
|
|
55
|
+
- 02_EDA: quick look on the data
|
|
56
|
+
- 03_*: quick petropohysical interpretation of the MOCK wells.
|
|
57
|
+
- For API notebook, need to run the following before running the cells
|
|
58
|
+
> uvicorn quick_pp.api.main:app
|
|
59
|
+
|
|
60
|
+
## Install
|
|
61
|
+
To install, use the following command:
|
|
62
|
+
|
|
63
|
+
`pip install quick_pp`
|
|
64
|
+
|
|
65
|
+
To use qpp_assistant, you would need to;
|
|
66
|
+
1. Install Ollama
|
|
67
|
+
2. Run `ollama pull qwen3` in the terminal
|
|
68
|
+
|
|
69
|
+
## CLI
|
|
70
|
+
To start the App
|
|
71
|
+
> quick_pp app
|
|
72
|
+
|
|
73
|
+
You can then access the Swagger UI at http://localhost:8888/docs and qpp_assistant at http://localhost:8888/qpp_assistant.
|
|
74
|
+
|
|
75
|
+
To use the mcp tools, you would need to first add the following SSE URLS through the interface;
|
|
76
|
+
http://localhost:8888/mcp - quick_pp tools.
|
|
77
|
+
|
|
78
|
+
http://localhost:5555/mcp - quick_pp ML model prediction tools (will only be available after ML models are trained and registered).
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
To train an ML model, these are the requirements;
|
|
82
|
+
1. The input file in parquet format need to be available; /data/input/<data_hash>___.parquet
|
|
83
|
+
2. The parquet file need to have the input and target features as specified in MODELLING_CONFIG in config.py.
|
|
84
|
+
> quick_pp train <model_config> <data_hash>
|
|
85
|
+
|
|
86
|
+
> Example >> quick_pp train mock mock
|
|
87
|
+
|
|
88
|
+
To run the MLflow server
|
|
89
|
+
> quick_pp mlflow-server
|
|
90
|
+
|
|
91
|
+
To run prediction, the trained models need to be registered in MLflow first.
|
|
92
|
+
> quick_pp predict <model_config> <data_hash>
|
|
93
|
+
|
|
94
|
+
You can access the mlflow server at http://localhost:5015
|
|
95
|
+
|
|
96
|
+
To deploy the trained ML models
|
|
97
|
+
> quick_pp model-deployment
|
|
98
|
+
|
|
99
|
+
You can access the deployed model Swagger UI at http://localhost:5555/docs
|
|
100
|
+
|
|
101
|
+
## Documentation
|
|
102
|
+
Documentation is available at:
|
|
103
|
+
<https://quick-pp.readthedocs.io/en/latest/index.html>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
quick_pp/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
quick_pp/cli.py,sha256=oODBfoyxSaTGb8PqyTWfbb0DWHHrGh0RCNnUOrxMR4g,4289
|
|
3
|
+
quick_pp/config.py,sha256=c9_prm9tMoVd2Fw0-_8dxH7MxOXQ9a5sRKwVS_Mh-Xg,3085
|
|
4
|
+
quick_pp/core_calibration.py,sha256=2sBDYWWvKeTVvYi8c9TxwQ0bsJYUmcmKAoDa9unVKOA,14232
|
|
5
|
+
quick_pp/fluid_type.py,sha256=Hudritv4LUmRFLpwQP_lsW5e01K6vWjJAgFjJEw989g,4621
|
|
6
|
+
quick_pp/geomechanics.py,sha256=yePqTGRrEYyZ3YksOECdOk9EgHkaCVL9K1weflxDbts,6257
|
|
7
|
+
quick_pp/las_handler.py,sha256=4g380leddnJS6SJGEX6_Jn2cs1faINkZA1w7ttFd7es,13225
|
|
8
|
+
quick_pp/logger.py,sha256=O5b-yBk9Bb7ntySCxj8LACP1qeXCfwO2TXJ65TrC-Jg,579
|
|
9
|
+
quick_pp/objects.py,sha256=I0Xm2QKPCzYsOyN_HDPSsD8WMWdY4YXyW43z1U3H1Bo,6835
|
|
10
|
+
quick_pp/permeability.py,sha256=UypniN0-95xrNywCX5hMgphWvhI7omjm4Bb6HbSrA2k,4375
|
|
11
|
+
quick_pp/porosity.py,sha256=RSIOXVL_u2lAOIKGuy_YJqqNtz2MQUSEPRJzHkBLXU0,12830
|
|
12
|
+
quick_pp/qaqc.py,sha256=KHcH9XGOOjmjHGrqj5qdqD0HwQhP6bKw1iiZ0yQi64s,18437
|
|
13
|
+
quick_pp/ressum.py,sha256=rW0y7ZFeQoJkIpp4WqLbCI4DhJr-cDqWYXQiLe_gpP8,14834
|
|
14
|
+
quick_pp/rock_type.py,sha256=OHfqgOL3j70sveh255qFoY5SAYHFJvJXI5pqiHH2IzI,19148
|
|
15
|
+
quick_pp/saturation.py,sha256=Gt8D7XyE0FdJ9S_JWbK2rZzDHwseMpW7n90CxxiwoBQ,14172
|
|
16
|
+
quick_pp/utils.py,sha256=GUukH6oyZRuDMBCR59ceq3rCAz4ZQKerGB2s8TzFmGI,12097
|
|
17
|
+
quick_pp/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
|
+
quick_pp/api/exceptions.py,sha256=J9VTve3Urei2oNSNjFsIDywT1PrQXkmPczCbtebGVGk,1836
|
|
19
|
+
quick_pp/api/main.py,sha256=erO9L0hq6ii_0wqJ94m_PJsFLZq1m8Mfvr8hnJyY2QM,2636
|
|
20
|
+
quick_pp/api/mlflow_model_deployment.py,sha256=i71wcAgQLJHyj29cIx3AYHIDjl_iqiL0lSIDsZ4iqeQ,3325
|
|
21
|
+
quick_pp/api/qpp_assistant.py,sha256=mmue_H-PNo0vYmnZSgXF8_VlwL5OxPMggTLTTXW7u9M,5959
|
|
22
|
+
quick_pp/api/router.py,sha256=iGl1oVagWYPrgaeMti1Rl3-Sq-XbnalkGSgBiKGAkvI,714
|
|
23
|
+
quick_pp/api/fastapi_mlflow/__init__.py,sha256=O1y2i1C4m602NbHgLdHmpflu9TGf21O6bs3ZEn_x0w4,23
|
|
24
|
+
quick_pp/api/fastapi_mlflow/_mlflow_types.py,sha256=NjX6T6CPklkUTu7XZ1LdPaPYb1_6_8834ngGS5ni120,1535
|
|
25
|
+
quick_pp/api/fastapi_mlflow/applications.py,sha256=vZeXclPAAQeQ75v8xAlNtWnZuIu5OkN3CvaOr09G_nw,2761
|
|
26
|
+
quick_pp/api/fastapi_mlflow/exceptions.py,sha256=D32vfs1NncA3r9nwOO00tT4u_lwvRj54SdjWJZMj5jo,535
|
|
27
|
+
quick_pp/api/fastapi_mlflow/predictors.py,sha256=BpYrcFXKliYW6adPMv654BEtp7dyikXae8aWjpm9byg,3679
|
|
28
|
+
quick_pp/api/schemas/lithology_hc_correction.py,sha256=aZSNg-jbJDqPAoAWtM7F7XtApDYP2ceIGsjV-ag7eRk,2088
|
|
29
|
+
quick_pp/api/schemas/lithology_ssc.py,sha256=nBwnEdYCh0UEqmVYuBiupoCTMyz_XtR52YZCN5_Vm70,1689
|
|
30
|
+
quick_pp/api/schemas/lithology_vsh_gr.py,sha256=novlR4GJiwbMFnvxa2JkiEgiXQPc2d-z5zELUFr1gM8,639
|
|
31
|
+
quick_pp/api/schemas/permeability_choo.py,sha256=wMba2otRoCOELhwaQG7s-iko3kNRZcvXpHZs3JIDJsU,1084
|
|
32
|
+
quick_pp/api/schemas/permeability_others.py,sha256=KQvO8lqdYzLAD5P8kHeKnZkafD0eopAEJA2VZr3ZF4E,940
|
|
33
|
+
quick_pp/api/schemas/porosity.py,sha256=wzOBrXJUMLr0a1UETzkXYfSw4pm_wJl18GYTXgkRd80,1179
|
|
34
|
+
quick_pp/api/schemas/ressum.py,sha256=bxC70gzwVkZHNztF1NbhpLg7GW0UP1XhGNQkJ4mXGbc,1664
|
|
35
|
+
quick_pp/api/schemas/saturation_archie.py,sha256=p1nFVBuNC3Tw8naDp29zP5QO9fBYF_bmwAFRSjQqG1c,1035
|
|
36
|
+
quick_pp/api/schemas/saturation_b.py,sha256=Qxla_exsXCWoYdmmDQy1IO3O0lkb_uzj-i9s76DAsjA,902
|
|
37
|
+
quick_pp/api/schemas/saturation_qv.py,sha256=XJYKWVvzTnxDtErmc_92heFIaiMPei4Fswq3cOrfTnc,1035
|
|
38
|
+
quick_pp/api/schemas/saturation_rw.py,sha256=rz7lSwHGB76V8jGy4Ggz9W1kfCjArmQ8qpkAtlRWEXE,912
|
|
39
|
+
quick_pp/api/schemas/saturation_temp_grad.py,sha256=lbUf3qD1IrfaC13Es-qgyw0TQiHWUB3lIUzWKUaxmQk,851
|
|
40
|
+
quick_pp/api/schemas/saturation_waxman_smits.py,sha256=ibsSOXVMnG4buRP_iNd8RJ4RitiBqL3Qst-7Lkmy1PA,1479
|
|
41
|
+
quick_pp/api/services/las_handler.py,sha256=yCuWRz0VQsMoH0fjYJFkvFGjVu7i6XfT2alf_3CpF4I,5296
|
|
42
|
+
quick_pp/api/services/lithology.py,sha256=Np5xIu79VnX2Co9RPktDaRJEd4qe4b86MJgcr-Xkz8k,11931
|
|
43
|
+
quick_pp/api/services/permeability.py,sha256=PG371eME-B1B7bApw3MspQJ290fsjPXj0-1BvYNLs4M,12876
|
|
44
|
+
quick_pp/api/services/porosity.py,sha256=D2D2g4xUXzaPW_HN9DGQpOymAES16ruA2kZnU-Cx9Ek,8229
|
|
45
|
+
quick_pp/api/services/reservoir_summary.py,sha256=jvtz_uYYaIjf8_6wh7xPoybpKhPW258byMVDyKZTCsg,3212
|
|
46
|
+
quick_pp/api/services/saturation.py,sha256=dHCB9n4I9vXUDxeTC7b2v3VJE07mG2lOVpVqpvKVccE,17563
|
|
47
|
+
quick_pp/api/static/favicon.ico,sha256=02WYcYycJoyOyd7DJGru32bcqotyYvN_5fG3eLjHgEY,6461
|
|
48
|
+
quick_pp/api/static/logo.png,sha256=02WYcYycJoyOyd7DJGru32bcqotyYvN_5fG3eLjHgEY,6461
|
|
49
|
+
quick_pp/lithology/__init__.py,sha256=q6GQX3NTRNII3LwE7tLDp18SIE7Ga3LepipyCqhfCIU,1604
|
|
50
|
+
quick_pp/lithology/carbonate.py,sha256=oM91zGXz0JOx1HI6_kURytZM-Q0KkVTHImxDz_jsLUQ,7406
|
|
51
|
+
quick_pp/lithology/multi_mineral.py,sha256=MxMVqYH0lQDrgBByY_fyEkurcGb7WMlsoVWkEUNEVOQ,8736
|
|
52
|
+
quick_pp/lithology/sand_shale.py,sha256=YoinLOxfnJJPbUpaoyRS4mlRJzcHl84sgVkgpVNQw0k,3173
|
|
53
|
+
quick_pp/lithology/sand_silt_clay.py,sha256=rDhGiTu5fPzPU4IF2wYb-hb1ZJY0aiXJSzD7OjDL06Q,5730
|
|
54
|
+
quick_pp/modelling/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
55
|
+
quick_pp/modelling/config.py,sha256=xUeiJRrjOVrwg_pUcBYKQks0TIyJgSgAR-N-P3CEmqw,2784
|
|
56
|
+
quick_pp/modelling/predict_pipeline.py,sha256=pe6m3QqehSkZKafTwXt5SSkt-rwpz7SqPRHy06RYSXs,4729
|
|
57
|
+
quick_pp/modelling/train_pipeline.py,sha256=Qnem_MC7sY6EctI5ZU38IMnrc_PeZOXB7BzwULfizIU,9011
|
|
58
|
+
quick_pp/modelling/utils.py,sha256=JuwIPGLMQYmqqS3etqAlSY9ldfIB9dr0eR2S5nbiuRA,4646
|
|
59
|
+
quick_pp/modelling/mock_data/mock_data.parquet,sha256=eEEDtWAf2WvoM5fLLeEGLV0Qjms67Z-ZuSFi8wEq3uI,21344
|
|
60
|
+
quick_pp/plotter/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
61
|
+
quick_pp/plotter/plotter.py,sha256=Yt6R6d3BX4fCVzKWDuyrD_3OJIo89E_KbCX0M2_QXxk,12049
|
|
62
|
+
quick_pp/plotter/well_log.py,sha256=WGko0qg4J0yVm7OdCB_uj3gNdtxp9fSfvbdHNBgeFbY,8664
|
|
63
|
+
quick_pp/plotter/well_log_config.py,sha256=SXtV5OaNZKdQYegAwbLJNRMjGC8eJLUKkJ4ndKjzoRU,15879
|
|
64
|
+
quick_pp-0.2.3.dist-info/METADATA,sha256=I2gNuP8jOWDLcGJrWK39qlWodzr1VEpv0k9hCDFg9I4,3363
|
|
65
|
+
quick_pp-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
66
|
+
quick_pp-0.2.3.dist-info/entry_points.txt,sha256=7GGDJtFoAEPetu8LYAA875kHAhx5_hPNzDl48KUgm8Q,46
|
|
67
|
+
quick_pp-0.2.3.dist-info/licenses/AUTHORS.rst,sha256=iAZe9M4yFdqjOFOVtBHCMVDDmz4ab6XLf-1LHgb8c7Y,172
|
|
68
|
+
quick_pp-0.2.3.dist-info/licenses/LICENSE,sha256=1DwLx3UMym7NM1tSiFAoWOIk0aU0i4RhOTL5BuGXq8g,1093
|
|
69
|
+
quick_pp-0.2.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Imran Fadhil
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|