quick-pp 0.2.52__tar.gz → 0.2.54__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 (75) hide show
  1. {quick_pp-0.2.52 → quick_pp-0.2.54}/PKG-INFO +1 -1
  2. {quick_pp-0.2.52 → quick_pp-0.2.54}/pyproject.toml +1 -1
  3. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/__init__.py +1 -1
  4. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/feature_engineering.py +32 -0
  5. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/predict_pipeline.py +1 -1
  6. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/plotter/well_log_config.py +14 -5
  7. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/rock_physics/geophysics.py +4 -6
  8. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/rock_type.py +33 -0
  9. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/saturation.py +2 -1
  10. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/utils.py +15 -0
  11. {quick_pp-0.2.52 → quick_pp-0.2.54}/.gitignore +0 -0
  12. {quick_pp-0.2.52 → quick_pp-0.2.54}/LICENSE +0 -0
  13. {quick_pp-0.2.52 → quick_pp-0.2.54}/README.md +0 -0
  14. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/__init__.py +0 -0
  15. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/exceptions.py +0 -0
  16. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
  17. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
  18. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
  19. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
  20. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
  21. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/main.py +0 -0
  22. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/mlflow_model_deployment.py +0 -0
  23. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/router.py +0 -0
  24. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
  25. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/lithology_ssc.py +0 -0
  26. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
  27. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/permeability_choo.py +0 -0
  28. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/permeability_others.py +0 -0
  29. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/porosity.py +0 -0
  30. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/ressum.py +0 -0
  31. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_archie.py +0 -0
  32. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_b.py +0 -0
  33. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_qv.py +0 -0
  34. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_rw.py +0 -0
  35. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
  36. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
  37. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/chat.py +0 -0
  38. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/las_handler.py +0 -0
  39. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/lithology.py +0 -0
  40. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/permeability.py +0 -0
  41. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/porosity.py +0 -0
  42. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/reservoir_summary.py +0 -0
  43. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/services/saturation.py +0 -0
  44. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/static/favicon.ico +0 -0
  45. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/static/logo.png +0 -0
  46. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/template/chat.html +0 -0
  47. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/api/template/home.html +0 -0
  48. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/cli.py +0 -0
  49. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/config.py +0 -0
  50. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/core_calibration.py +0 -0
  51. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/fluid_type.py +0 -0
  52. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/las_handler.py +0 -0
  53. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/__init__.py +0 -0
  54. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/carbonate.py +0 -0
  55. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/multi_mineral.py +0 -0
  56. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/sand_shale.py +0 -0
  57. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/sand_silt_clay.py +0 -0
  58. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/lithology/thin_beds.py +0 -0
  59. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/__init__.py +0 -0
  60. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/config.py +0 -0
  61. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
  62. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/train_pipeline.py +0 -0
  63. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/machine_learning/utils.py +0 -0
  64. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/objects.py +0 -0
  65. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/permeability.py +0 -0
  66. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/plotter/__init__.py +0 -0
  67. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/plotter/plotter.py +0 -0
  68. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/plotter/well_log.py +0 -0
  69. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/plotter/xplots.py +0 -0
  70. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/porosity.py +0 -0
  71. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/qaqc.py +0 -0
  72. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/ressum.py +0 -0
  73. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/rock_physics/__init__.py +0 -0
  74. {quick_pp-0.2.52 → quick_pp-0.2.54}/quick_pp/rock_physics/geomechanics.py +0 -0
  75. {quick_pp-0.2.52 → quick_pp-0.2.54}/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.52
3
+ Version: 0.2.54
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>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "quick-pp"
7
- version = "0.2.52"
7
+ version = "0.2.54"
8
8
  description = "Python package to assist in providing quick-look/ preliminary petrophysical estimation."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -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.52' # Need to be updated manually when releasing a new version/ change in pyproject.toml
23
+ __version__ = '0.2.54' # Need to be updated manually when releasing a new version/ change in pyproject.toml
@@ -99,6 +99,36 @@ 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, rhob_threshold=2.3, window_size=15, trend_factor=0.03):
103
+ """Flag tight streak intervals based on high RHOB, high RT, and low NPHI.
104
+
105
+ Tight streaks (e.g., carbonate cemented layers) are characterized by high
106
+ bulk density, high resistivity, and low porosity. This function flags
107
+ these zones by identifying points where log values deviate significantly
108
+ from their local trend, in addition to crossing absolute thresholds.
109
+
110
+ Args:
111
+ rhob (pd.Series): Bulk density log (g/cm³).
112
+ rhob_threshold (float, optional): RHOB threshold for tight streak. Defaults to 2.5.
113
+ window_size (int, optional): The size of the rolling window for trend calculation. Defaults to 21.
114
+ trend_factor (float, optional): A factor to control sensitivity to trend deviation.
115
+ Defaults to 0.05 (5%).
116
+
117
+ Returns:
118
+ pd.Series: A series of floats (0.0 or 1.0), 1.0 where a tight streak is flagged.
119
+ """
120
+ # Calculate rolling averages to establish local trends
121
+ rhob_trend = rhob.rolling(window=window_size, center=True, min_periods=1).mean()
122
+
123
+ # Flag where RHOB are significantly above trend
124
+ trend_condition = (rhob > rhob_trend * (1 + trend_factor))
125
+
126
+ # Flag where values cross absolute thresholds
127
+ threshold_condition = (rhob > rhob_threshold)
128
+
129
+ return (trend_condition & threshold_condition).astype(float)
130
+
131
+
102
132
  def generate_fe_features(df):
103
133
  """Generate feature engineered features from the raw features.
104
134
 
@@ -115,6 +145,8 @@ def generate_fe_features(df):
115
145
  tqdm.write(f'Processing well {well_name}')
116
146
  well_df = well_df.sort_values('DEPTH').copy()
117
147
 
148
+ df.loc[well_df.index, 'TIGHT_FLAG'] = tight_streak_flagging(well_df['RHOB'], well_df['RT'])
149
+
118
150
  df.loc[well_df.index, 'COAL_FLAG'] = coal_flagging(well_df['NPHI'], well_df['RHOB'])
119
151
 
120
152
  rhob_mask = well_df['RHOB'].notna()
@@ -139,7 +139,7 @@ def predict_pipeline(
139
139
 
140
140
  # Merge specific columns from original data missing from pred_df
141
141
  merge_cols = ['WELL_NAME', 'DEPTH']
142
- missing_cols = ['ROCK_FLAG', 'COAL_FLAG']
142
+ missing_cols = ['ROCK_FLAG', 'COAL_FLAG', 'TIGHT_FLAG']
143
143
  pred_df = pd.merge(pred_df, data[merge_cols + missing_cols], on=merge_cols, how='left')
144
144
 
145
145
  # Postprocess the predictions and save
@@ -166,8 +166,8 @@ TRACE_DEFS = dict(
166
166
  BADHOLE=dict(
167
167
  track=1,
168
168
  secondary_y=False,
169
- hide_xaxis=True,
170
- style={'fill': 'tozerox', 'fillcolor': 'rgba(0, 0, 0, .25)'}
169
+ hide_xaxis=False,
170
+ style={'line_width': 0, 'fill': 'tozerox', 'fillcolor': 'rgba(0, 0, 0, .15)'}
171
171
  ),
172
172
  VSILT=dict(
173
173
  track=8,
@@ -308,6 +308,12 @@ TRACE_DEFS = dict(
308
308
  'fillcolor': 'rgba(98, 180, 207, .5)'
309
309
  }
310
310
  ),
311
+ TIGHT_FLAG=dict(
312
+ track=8,
313
+ secondary_y=False,
314
+ hide_xaxis=False,
315
+ style={'line_width': 0, 'fill': 'tozerox', 'fillcolor': '#0000A0'}
316
+ ),
311
317
  )
312
318
 
313
319
  # Centralize axis definitions for maintainability
@@ -341,7 +347,7 @@ XAXIS_DEFS = dict(
341
347
  title={'text': 'PERM (mD)', 'font': {'color': COLOR_DICT['PERM'], 'size': font_size}},
342
348
  tickfont={'color': COLOR_DICT['PERM'], 'size': font_size},
343
349
  side='top', anchor='free', position=.91, title_standoff=.1,
344
- range=[np.log10(0.1), np.log10(10000)], type='log', tickformat='d', tickangle=-90,
350
+ range=[np.log10(0.1), np.log10(1e5)], type='log', tickformat='d', tickangle=-90,
345
351
  minor_showgrid=True
346
352
  ),
347
353
  SWT=dict(
@@ -414,7 +420,7 @@ XAXIS_DEFS = dict(
414
420
  title={'text': 'BADHOLE', 'font': {'color': COLOR_DICT['BADHOLE'], 'size': font_size}},
415
421
  tickfont={'size': 1},
416
422
  side='top', anchor='free', position=.96, title_standoff=.1, overlaying='x1',
417
- range=[0.1, 5], type='linear', showgrid=False, zeroline=False
423
+ range=[0.1, 4], type='linear', showgrid=False, zeroline=False
418
424
  ),
419
425
  PEF=dict(
420
426
  title={'text': 'PEF', 'font': {'color': COLOR_DICT['PEF'], 'size': font_size}},
@@ -432,7 +438,7 @@ XAXIS_DEFS = dict(
432
438
  title={'text': 'CPERM (mD)', 'font': {'color': COLOR_DICT['CPERM'], 'size': font_size}},
433
439
  tickfont={'color': COLOR_DICT['CPERM'], 'size': font_size},
434
440
  side='top', anchor='free', position=.85, title_standoff=.1, overlaying='x5',
435
- range=[np.log10(0.1), np.log10(10000)], type='log', tickformat='d', tickangle=-90,
441
+ range=[np.log10(0.1), np.log10(1e5)], type='log', tickformat='d', tickangle=-90,
436
442
  zeroline=False, showgrid=False
437
443
  ),
438
444
  SHF=dict(
@@ -450,6 +456,9 @@ XAXIS_DEFS = dict(
450
456
  COAL_FLAG=dict(
451
457
  range=[.1, .2], type='linear', showgrid=False, zeroline=False,
452
458
  ),
459
+ TIGHT_FLAG=dict(
460
+ range=[.1, .2], type='linear', showgrid=False, zeroline=False, overlaying='x8'
461
+ ),
453
462
  DTC=dict(
454
463
  title={'text': 'DTC (us/ft)', 'font': {'color': COLOR_DICT['DTC'], 'size': font_size}},
455
464
  tickfont={'color': COLOR_DICT['DTC'], 'size': font_size},
@@ -1,6 +1,5 @@
1
1
  import numpy as np
2
2
  import pandas as pd
3
- import xarray as xr
4
3
  import matplotlib.pyplot as plt
5
4
  from scipy.optimize import minimize
6
5
  from scipy.signal import convolve, hilbert
@@ -175,11 +174,8 @@ def convert_md_to_tvd(df, well_coords):
175
174
  Returns:
176
175
  pandas.DataFrame: DataFrame with TVD column added.
177
176
  """
178
- dev_survey = wpp.deviation(
179
- well_coords['md'], well_coords['incl'], well_coords['azim']
180
- )
181
- md_range = np.arange(df.DEPTH.min(), df.DEPTH.max(), df.DEPTH.diff().mode()[0])
182
- df['TVD'] = dev_survey.minimum_curvature().resample(md_range).depth
177
+ dev_survey = wpp.deviation(md=well_coords['md'], inc=well_coords['incl'], azi=well_coords['azim'])
178
+ df['TVD'] = dev_survey.minimum_curvature().resample(df.DEPTH.values).depth
183
179
 
184
180
  # Get list of columns to resample
185
181
  numeric_cols = df.select_dtypes(include=np.number).columns.tolist()
@@ -238,6 +234,8 @@ def convert_well_trajectory_to_ilxl(seismic_cube, well_trajectory):
238
234
  seismic_cube (xarray.Dataset): 3D seismic cube with coordinates (inline, xline, twt/depth)
239
235
  well_trajectory (pandas.DataFrame): Well trajectory with columns for X,Y coordinates and depth/time
240
236
  """
237
+ import xarray as xr
238
+
241
239
  # Scale the coordinates if required
242
240
  try:
243
241
  seismic_cube.segysak.scale_coords()
@@ -88,6 +88,39 @@ def calc_r35_perm(r35, pore):
88
88
  return 10**((np.log10(r35) - .732 + .864 * np.log10(pore * 100)) / .588)
89
89
 
90
90
 
91
+ def plot_rqi(cpore, cperm, cut_offs=None, rock_type=None, title='Rock Quality Index (RQI)'):
92
+ """Plot the RQI cross plot.
93
+
94
+ Args:
95
+ cpore (float): Core porosity in fraction.
96
+ cperm (float): Core permeability in mD.
97
+ cut_offs (list, optional): List of RQI values to plot as lines.
98
+ Defaults to None, which will use [0.1, 0.3, 0.5, 1.0].
99
+ rock_type (array, optional): Array of rock types for coloring points. Defaults to None.
100
+ title (str, optional): Plot title. Defaults to 'Rock Quality Index (RQI)'.
101
+ """
102
+ _, ax = plt.subplots(figsize=(10, 8))
103
+ plt.title(title)
104
+ plt.scatter(cpore, cperm, marker='.', c=rock_type, cmap='viridis')
105
+ cut_offs = cut_offs if cut_offs is not None else [0.1, 0.3, 0.5, 1.0]
106
+ pore_points = np.geomspace(0.001, 1, 20)
107
+ for rqi in cut_offs:
108
+ perm_points = pore_points * (rqi / 0.0314)**2
109
+ ax.plot(pore_points, perm_points, linestyle='dashed', label=f'RQI={round(rqi, 3)}')
110
+
111
+ plt.xlabel('Porosity (frac)')
112
+ plt.xlim(-.05, .5)
113
+ plt.ylabel('Permeability (mD)')
114
+ plt.ylim(1e-3, 1e5)
115
+ plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
116
+ plt.yscale('log')
117
+ ax.yaxis.set_major_formatter(ticker.FuncFormatter(
118
+ lambda x, pos: ('{{:.{:1d}f}}'.format(int(np.maximum(-np.log10(x), 0)))).format(x)))
119
+ plt.minorticks_on()
120
+ plt.grid(True, which='major', linestyle='--', linewidth='0.5', color='gray')
121
+ plt.grid(True, which='minor', linestyle=':', linewidth='0.3', color='gray')
122
+
123
+
91
124
  def plot_fzi(cpore, cperm, cut_offs=None, rock_type=None, title='Flow Zone Indicator (FZI)'):
92
125
  """Plot the FZI cross plot.
93
126
 
@@ -469,8 +469,9 @@ def swirr_xplot(swt, phit, c=.0125, label='', log_log=False, title=''):
469
469
  ax.plot(c / cphit, cphit, label=rf'$\phi$ S = {c}',
470
470
  color=line_color, linestyle='dashed')
471
471
  ax.set_ylabel('PHIT (frac)')
472
+ ax.set_ylim(1e-3, 1)
472
473
  ax.set_xlabel('SWT (frac)')
473
- ax.set_xlim(0, 1)
474
+ ax.set_xlim(1e-3, 1)
474
475
  ax.legend()
475
476
  if log_log:
476
477
  ax.set_xscale('log')
@@ -410,3 +410,18 @@ def remove_straights(log, window: int = 30, threshold: float = 0.001):
410
410
 
411
411
  rolling_std = log_series.rolling(window=window, center=True, min_periods=window // 2).std()
412
412
  return np.where(rolling_std < threshold, np.nan, log_series.values)
413
+
414
+
415
+ def get_tvd(df, well_coords):
416
+ """_summary_
417
+
418
+ Args:
419
+ df (_type_): _description_
420
+ well_coords (_type_): _description_
421
+ """
422
+ import wellpathpy as wpp
423
+
424
+ dev_survey = wpp.deviation(md=well_coords['md'], inc=well_coords['incl'], azi=well_coords['azim'])
425
+ # Resample the survey at the exact MD points from the log data
426
+ tvd = dev_survey.minimum_curvature().resample(df['DEPTH'].values).depth
427
+ return tvd
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes