quick-pp 0.2.63__tar.gz → 0.2.65__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 (74) hide show
  1. {quick_pp-0.2.63 → quick_pp-0.2.65}/PKG-INFO +1 -1
  2. {quick_pp-0.2.63 → quick_pp-0.2.65}/pyproject.toml +1 -1
  3. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/__init__.py +1 -1
  4. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/las_handler.py +4 -4
  5. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/objects.py +11 -10
  6. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/plotter/plotter.py +14 -12
  7. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/saturation.py +3 -3
  8. {quick_pp-0.2.63 → quick_pp-0.2.65}/.gitignore +0 -0
  9. {quick_pp-0.2.63 → quick_pp-0.2.65}/LICENSE +0 -0
  10. {quick_pp-0.2.63 → quick_pp-0.2.65}/README.md +0 -0
  11. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/__init__.py +0 -0
  12. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/exceptions.py +0 -0
  13. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
  14. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
  15. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
  16. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
  17. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
  18. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/main.py +0 -0
  19. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/mlflow_model_deployment.py +0 -0
  20. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/router.py +0 -0
  21. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
  22. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/lithology_ssc.py +0 -0
  23. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
  24. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/permeability_choo.py +0 -0
  25. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/permeability_others.py +0 -0
  26. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/porosity.py +0 -0
  27. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/ressum.py +0 -0
  28. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_archie.py +0 -0
  29. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_b.py +0 -0
  30. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_qv.py +0 -0
  31. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_rw.py +0 -0
  32. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
  33. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
  34. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/chat.py +0 -0
  35. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/las_handler.py +0 -0
  36. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/lithology.py +0 -0
  37. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/permeability.py +0 -0
  38. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/porosity.py +0 -0
  39. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/reservoir_summary.py +0 -0
  40. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/services/saturation.py +0 -0
  41. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/static/favicon.ico +0 -0
  42. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/static/logo.png +0 -0
  43. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/template/chat.html +0 -0
  44. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/api/template/home.html +0 -0
  45. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/cli.py +0 -0
  46. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/config.py +0 -0
  47. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/core_calibration.py +0 -0
  48. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/fluid_type.py +0 -0
  49. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/__init__.py +0 -0
  50. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/carbonate.py +0 -0
  51. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/multi_mineral.py +0 -0
  52. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/sand_shale.py +0 -0
  53. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/sand_silt_clay.py +0 -0
  54. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/lithology/thin_beds.py +0 -0
  55. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/__init__.py +0 -0
  56. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/config.py +0 -0
  57. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/feature_engineering.py +0 -0
  58. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
  59. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/predict_pipeline.py +0 -0
  60. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/train_pipeline.py +0 -0
  61. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/machine_learning/utils.py +0 -0
  62. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/permeability.py +0 -0
  63. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/plotter/__init__.py +0 -0
  64. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/plotter/well_log.py +0 -0
  65. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/plotter/well_log_config.py +0 -0
  66. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/porosity.py +0 -0
  67. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/qaqc.py +0 -0
  68. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/ressum.py +0 -0
  69. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/rock_physics/__init__.py +0 -0
  70. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/rock_physics/geomechanics.py +0 -0
  71. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/rock_physics/geophysics.py +0 -0
  72. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/rock_physics/rpm.py +0 -0
  73. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/rock_type.py +0 -0
  74. {quick_pp-0.2.63 → quick_pp-0.2.65}/quick_pp/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quick-pp
3
- Version: 0.2.63
3
+ Version: 0.2.65
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.63"
7
+ version = "0.2.65"
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.63' # Need to be updated manually when releasing a new version/ change in pyproject.toml
23
+ __version__ = '0.2.65' # Need to be updated manually when releasing a new version/ change in pyproject.toml
@@ -9,7 +9,7 @@ import welly
9
9
  from quick_pp import logger
10
10
 
11
11
 
12
- def read_las_files(las_files):
12
+ def read_las_files(las_files, depth_uom=None):
13
13
  """
14
14
  1. Return df and well_header as df from .las files
15
15
  2. For every las files, curves_df, header_df, welly_object are returned through function "read_las_file"
@@ -27,7 +27,7 @@ def read_las_files(las_files):
27
27
 
28
28
  for f in las_files:
29
29
  try:
30
- df, well_header = read_las_file_welly(f)
30
+ df, well_header = read_las_file_welly(f, depth_uom)
31
31
  except Exception as e:
32
32
  logger.error(f"[read_las_files] Exception for {f.name} | {e} ")
33
33
  df, well_header, _ = read_las_file_mmap(f)
@@ -143,10 +143,10 @@ def read_las_file_mmap(file_object, required_sets=['PEP']): # noqa
143
143
  return curves_df, header_df, welly_object
144
144
 
145
145
 
146
- def read_las_file_welly(file_object):
146
+ def read_las_file_welly(file_object, depth_uom=None):
147
147
  welly_dataset = welly.las.from_las(file_object.name)
148
148
  well_header = welly_dataset['Header']
149
- welly_object = welly.well.Well.from_datasets(welly_dataset)
149
+ welly_object = welly.well.Well.from_datasets(welly_dataset, index_units=depth_uom)
150
150
  df = pre_process(welly_object)
151
151
  return df, well_header
152
152
 
@@ -18,16 +18,15 @@ class Project(object):
18
18
  self.project_path = project_path or os.path.join("data", "04_project")
19
19
  self.data_path = os.path.join(self.project_path, self.name)
20
20
  self.output_path = os.path.join(self.data_path, "outputs")
21
- os.makedirs(self.data_path, exist_ok=True)
22
21
  os.makedirs(self.output_path, exist_ok=True)
23
22
  logger.info(f"Project '{name}' initialized with path: {self.data_path}")
24
23
 
25
- def read_las(self, path: list):
24
+ def read_las(self, path: list, depth_uom=None):
26
25
  logger.info(f"Reading {len(path)} LAS files for project '{self.name}'")
27
26
  for file in path:
28
27
  logger.debug(f"Processing LAS file: {file}")
29
28
  well = Well()
30
- well.read_las(file)
29
+ well.read_las(file, depth_uom)
31
30
  self.save_well(well)
32
31
  self.update_history(action=f"Read LAS file for project {self.name}")
33
32
 
@@ -154,14 +153,14 @@ class Well(object):
154
153
  self.description = description
155
154
  logger.debug(f"Well object initialized: {name}")
156
155
 
157
- def read_las(self, path: str):
156
+ def read_las(self, path: str, depth_uom=None):
158
157
  logger.info(f"Reading LAS file: {path}")
159
158
  with open(path, "rb") as f:
160
- data, header = las.read_las_files([f])
159
+ data, header = las.read_las_files([f], depth_uom)
161
160
  header_df = header.T
162
161
  self.name = header_df[header_df['mnemonic'] == 'WELL']['value'].values[0].replace("/", "-")
163
162
  self.description = f"Well {self.name}"
164
- self.depth_uom = header_df[header_df['mnemonic'] == 'STRT']['unit'].values[0]
163
+ self.depth_uom = depth_uom or header_df[header_df['mnemonic'] == 'STRT']['unit'].values[0]
165
164
  self.data = data
166
165
  self.header = header
167
166
  logger.info(f"LAS file loaded: {self.name} with {len(data)} records, depth unit: {self.depth_uom}")
@@ -182,15 +181,17 @@ class Well(object):
182
181
  self.config.update(config)
183
182
  self.update_history(action=f"Updated config for well {self.name}")
184
183
 
185
- def export_to_parquet(self, folder=os.path.join("data", "04_project", "outputs")):
186
- os.makedirs(folder, exist_ok=True)
184
+ def export_to_parquet(self, folder=None):
185
+ if not folder:
186
+ folder = self.output_path
187
187
  path = os.path.join(folder, f"{self.name}.parquet")
188
188
  logger.info(f"Exporting well data to parquet: {path}")
189
189
  self.data.to_parquet(path)
190
190
  logger.debug(f"Exported {len(self.data)} records to parquet")
191
191
 
192
- def export_to_las(self, folder=os.path.join("data", "04_project", "outputs")):
193
- os.makedirs(folder, exist_ok=True)
192
+ def export_to_las(self, folder=None):
193
+ if not folder:
194
+ folder = self.output_path
194
195
  logger.info(f"Exporting well data to LAS format in folder: {folder}")
195
196
  las.export_to_las(well_data=self.data, well_name=self.name, folder=folder)
196
197
 
@@ -39,19 +39,20 @@ def update_fluid_contacts(well_data, well_config: dict):
39
39
  well_data = well_data.copy()
40
40
  logger.debug(f"well_data columns before update: {well_data.columns.tolist()}")
41
41
  well_data['OIL_FLAG'] = np.where(
42
- ((well_data['DEPTH'] > out) | (well_data['DEPTH'] > goc)) & (
43
- (well_data['DEPTH'] < odt) | (well_data['DEPTH'] < owc)), 1, 0)
42
+ ((well_data['TVD'] > out) | (well_data['TVD'] > goc)) & (
43
+ (well_data['TVD'] < odt) | (well_data['TVD'] < owc)), 1, 0)
44
44
 
45
45
  well_data['GAS_FLAG'] = np.where(
46
- ((well_data['DEPTH'] < gdt) | (well_data['DEPTH'] < gwc) | (well_data['DEPTH'] < goc)) & (
47
- well_data['DEPTH'] > gut), 1, 0)
46
+ ((well_data['TVD'] < gdt) | (well_data['TVD'] < gwc) | (well_data['TVD'] < goc)) & (
47
+ well_data['TVD'] > gut), 1, 0)
48
48
 
49
49
  well_data['WATER_FLAG'] = np.where(
50
- ((well_data['DEPTH'] > wut) | (well_data['DEPTH'] > owc) | (well_data['DEPTH'] > gwc)), 1, 0)
50
+ ((well_data['TVD'] > wut) | (well_data['TVD'] > owc) | (well_data['TVD'] > gwc)), 1, 0)
51
51
 
52
52
  well_data['FLUID_FLAG'] = np.where(
53
53
  well_data['OIL_FLAG'] == 1, 1, np.where(
54
- well_data['GAS_FLAG'] == 1, 2, 0))
54
+ well_data['GAS_FLAG'] == 1, 2, np.where(
55
+ well_data['WATER_FLAG'] == 1, 0, -1)))
55
56
 
56
57
  return well_data
57
58
 
@@ -187,6 +188,7 @@ def stick_plot(data, well_config: dict, zone: str = 'ALL'):
187
188
  """
188
189
  logger.info(f"Generating stick plot for zone: {zone}")
189
190
  assert 'SWT' in data.columns, 'SWT column not found in data.'
191
+ assert 'TVD' in data.columns, 'TVD column not found in data.'
190
192
  assert_well_config_structure(well_config)
191
193
 
192
194
  # Create BVO and BVOH columns
@@ -204,23 +206,23 @@ def stick_plot(data, well_config: dict, zone: str = 'ALL'):
204
206
  logger.debug(f"Plotting well: {well_name}")
205
207
  well_data = data[(data['WELL_NAME'] == well_name) & (data['ZONES'] == zone)].copy()
206
208
  well_data = update_fluid_contacts(well_data, well_config[well_name]['zones'][zone])
207
- ax.plot(well_data['BVO'], well_data['DEPTH'], label=r'$BVO_{Log}$')
209
+ ax.plot(well_data['BVO'], well_data['TVD'], label=r'$BVO_{Log}$')
208
210
  if 'BVOH' in well_data.columns:
209
- ax.plot(well_data['BVOH'], well_data['DEPTH'], label=r'$BVO_{SHF}$')
211
+ ax.plot(well_data['BVOH'], well_data['TVD'], label=r'$BVO_{SHF}$')
210
212
 
211
213
  # Fill between based on fluid flag
212
214
  ax.fill_betweenx(
213
- well_data['DEPTH'], 0, 1, where=well_data['FLUID_FLAG'] == 1, color='g', alpha=0.3, label='Oil')
215
+ well_data['TVD'], 0, 1, where=well_data['FLUID_FLAG'] == 1, color='g', alpha=0.3, label='Oil')
214
216
  ax.fill_betweenx(
215
- well_data['DEPTH'], 0, 1, where=well_data['FLUID_FLAG'] == 2, color='r', alpha=0.3, label='Gas')
217
+ well_data['TVD'], 0, 1, where=well_data['FLUID_FLAG'] == 2, color='r', alpha=0.3, label='Gas')
216
218
  ax.fill_betweenx(
217
- well_data['DEPTH'], 0, 1, where=well_data['FLUID_FLAG'] == 0, color='b', alpha=0.3, label='Water')
219
+ well_data['TVD'], 0, 1, where=well_data['FLUID_FLAG'] == 0, color='b', alpha=0.3, label='Water')
218
220
 
219
221
  ax.set_title(f'Well: {well_name}')
220
222
  ax.set_xlim(0, .5)
221
223
  ax.legend()
222
224
 
223
- axes[0].set_ylabel('Depth')
225
+ axes[0].set_ylabel('Depth (TVD)')
224
226
  fig.subplots_adjust(wspace=0.3, hspace=0)
225
227
  fig.set_facecolor('aliceblue')
226
228
  plt.gca().invert_yaxis()
@@ -80,7 +80,7 @@ def waxman_smits_saturation(rt, rw, phit, Qv=None, B=None, m=2, n=2):
80
80
 
81
81
  logger.debug(f"Waxman-Smits saturation range: {min(swt)} - {max(swt)}")
82
82
  # Post process only valid data
83
- invalid_mask = ~((rt > 0) & np.isfinite(rt))
83
+ invalid_mask = ~((rt > 0) & np.isfinite(rt) & (phit > 0) & np.isfinite(phit))
84
84
  swt[invalid_mask] = 1.0
85
85
  return swt
86
86
 
@@ -120,7 +120,7 @@ def normalized_waxman_smits_saturation(rt, rw, phit, vshale, phit_shale, rt_shal
120
120
 
121
121
  logger.debug(f"Normalized Waxman-Smits saturation range: {min(swt)} - {max(swt)}")
122
122
  # Post process only valid data
123
- invalid_mask = ~((rt > 0) & np.isfinite(rt))
123
+ invalid_mask = ~((rt > 0) & np.isfinite(rt) & (phit > 0) & np.isfinite(phit))
124
124
  swt[invalid_mask] = 1.0
125
125
  return swt
126
126
 
@@ -158,7 +158,7 @@ def dual_water_saturation(rt, rw, phit, a, m, n, swb, rwb):
158
158
 
159
159
  logger.debug(f"Dual water saturation range: {swt.min():.3f} - {swt.max():.3f}")
160
160
  # Post process only valid data
161
- invalid_mask = ~((rt > 0) & np.isfinite(rt))
161
+ invalid_mask = ~((rt > 0) & np.isfinite(rt) & (phit > 0) & np.isfinite(phit))
162
162
  swt[invalid_mask] = 1.0
163
163
  return swt
164
164
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes