quick-pp 0.2.55__tar.gz → 0.2.57__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.55 → quick_pp-0.2.57}/PKG-INFO +5 -2
- {quick_pp-0.2.55 → quick_pp-0.2.57}/README.md +3 -1
- {quick_pp-0.2.55 → quick_pp-0.2.57}/pyproject.toml +2 -1
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/__init__.py +1 -1
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/core_calibration.py +116 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/plotter/well_log.py +11 -3
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/plotter/well_log_config.py +9 -5
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/ressum.py +10 -10
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/rock_physics/geophysics.py +2 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/utils.py +1 -0
- quick_pp-0.2.55/quick_pp/plotter/xplots.py +0 -170
- {quick_pp-0.2.55 → quick_pp-0.2.57}/.gitignore +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/LICENSE +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/exceptions.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/main.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/mlflow_model_deployment.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/router.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/lithology_ssc.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/permeability_choo.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/permeability_others.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/porosity.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/ressum.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_archie.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_b.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_qv.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_rw.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/chat.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/las_handler.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/lithology.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/permeability.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/porosity.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/reservoir_summary.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/services/saturation.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/static/favicon.ico +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/static/logo.png +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/template/chat.html +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/api/template/home.html +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/cli.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/config.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/fluid_type.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/las_handler.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/carbonate.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/multi_mineral.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/sand_shale.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/sand_silt_clay.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/lithology/thin_beds.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/config.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/feature_engineering.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/predict_pipeline.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/train_pipeline.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/machine_learning/utils.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/objects.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/permeability.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/plotter/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/plotter/plotter.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/porosity.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/qaqc.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/rock_physics/__init__.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/rock_physics/geomechanics.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/rock_physics/rpm.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/rock_type.py +0 -0
- {quick_pp-0.2.55 → quick_pp-0.2.57}/quick_pp/saturation.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.57
|
|
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>
|
|
@@ -14,6 +14,7 @@ Classifier: Natural Language :: English
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Requires-Python: >=3.11
|
|
16
16
|
Requires-Dist: click>=7.0
|
|
17
|
+
Requires-Dist: dtw-python
|
|
17
18
|
Requires-Dist: fastapi
|
|
18
19
|
Requires-Dist: loguru
|
|
19
20
|
Requires-Dist: matplotlib==3.8.0
|
|
@@ -68,13 +69,15 @@ For development or to use the `qpp_assistant`, you'll need to clone the reposito
|
|
|
68
69
|
|
|
69
70
|
### Jupyter Notebook Examples
|
|
70
71
|
|
|
72
|
+
> More structured analysis/ examples are done in https://github.com/imranfadhil/pp_portfolio
|
|
73
|
+
|
|
71
74
|
The included notebooks demonstrate the core functionalities:
|
|
72
75
|
|
|
73
76
|
- `01_data_handler`: Create a MOCK `qppp` project file.
|
|
74
77
|
- `02_EDA`: Perform a quick exploratory data analysis.
|
|
75
78
|
- `03_*`: Carry out petrophysical interpretation of the MOCK wells.
|
|
76
79
|
|
|
77
|
-
|
|
80
|
+
**Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
|
|
78
81
|
|
|
79
82
|
### `qpp_assistant` Setup
|
|
80
83
|
|
|
@@ -35,13 +35,15 @@ For development or to use the `qpp_assistant`, you'll need to clone the reposito
|
|
|
35
35
|
|
|
36
36
|
### Jupyter Notebook Examples
|
|
37
37
|
|
|
38
|
+
> More structured analysis/ examples are done in https://github.com/imranfadhil/pp_portfolio
|
|
39
|
+
|
|
38
40
|
The included notebooks demonstrate the core functionalities:
|
|
39
41
|
|
|
40
42
|
- `01_data_handler`: Create a MOCK `qppp` project file.
|
|
41
43
|
- `02_EDA`: Perform a quick exploratory data analysis.
|
|
42
44
|
- `03_*`: Carry out petrophysical interpretation of the MOCK wells.
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
**Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
|
|
45
47
|
|
|
46
48
|
### `qpp_assistant` Setup
|
|
47
49
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quick-pp"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.57"
|
|
8
8
|
description = "Python package to assist in providing quick-look/ preliminary petrophysical estimation."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -29,6 +29,7 @@ classifiers = [
|
|
|
29
29
|
]
|
|
30
30
|
dependencies = [
|
|
31
31
|
"Click>=7.0",
|
|
32
|
+
"dtw-python",
|
|
32
33
|
"fastapi",
|
|
33
34
|
"loguru",
|
|
34
35
|
"matplotlib==3.8.0",
|
|
@@ -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.57' # Need to be updated manually when releasing a new version/ change in pyproject.toml
|
|
@@ -2,6 +2,9 @@ from scipy.optimize import curve_fit
|
|
|
2
2
|
import matplotlib.pyplot as plt
|
|
3
3
|
import numpy as np
|
|
4
4
|
import plotly.graph_objects as go
|
|
5
|
+
from tqdm import tqdm
|
|
6
|
+
from dtw import dtw
|
|
7
|
+
import pandas as pd
|
|
5
8
|
|
|
6
9
|
from quick_pp.utils import power_law_func, inv_power_law_func
|
|
7
10
|
from quick_pp import logger
|
|
@@ -26,6 +29,7 @@ def poroperm_xplot(poro, perm, a=None, b=None, core_group=None, label='', log_lo
|
|
|
26
29
|
perm (float): Core permeability (mD).
|
|
27
30
|
a (float, optional): a constant in perm=a*poro^b. Defaults to None.
|
|
28
31
|
b (float, optional): b constant in perm=a*poro^b. Defaults to None.
|
|
32
|
+
core_group (array-like, optional): Grouping for core samples to be used for coloring. Defaults to None.
|
|
29
33
|
label (str, optional): Label for the data group. Defaults to ''.
|
|
30
34
|
log_log (bool, optional): Whether to plot log-log or not. Defaults to False.
|
|
31
35
|
"""
|
|
@@ -392,3 +396,115 @@ def sw_shf_choo(perm, phit, phie, depth, fwl, ift, theta, gw, ghc, b0=0.4):
|
|
|
392
396
|
(0.2166 * (pc / (ift * abs(np.cos(np.radians(theta))))) * (
|
|
393
397
|
perm / phit)**(0.5))**(b0 * np.log10(1 + swb**-1) / 3))
|
|
394
398
|
return shf
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
def autocorrelate_core_depth(df):
|
|
402
|
+
"""Automatically shift core depths to match log depths using Dynamic Time Warping (DTW).
|
|
403
|
+
|
|
404
|
+
This function aligns core porosity (CPORE) with log porosity (PHIT) to correct for
|
|
405
|
+
depth discrepancies between core and wireline log measurements. It processes the data
|
|
406
|
+
on a per-well basis.
|
|
407
|
+
|
|
408
|
+
Args:
|
|
409
|
+
df (pd.DataFrame): DataFrame containing well log and core data. Must include
|
|
410
|
+
'WELL_NAME', 'DEPTH', 'PHIT', 'CPORE', 'CPERM', and 'CORE_ID'.
|
|
411
|
+
|
|
412
|
+
Returns:
|
|
413
|
+
tuple[pd.DataFrame, pd.DataFrame]:
|
|
414
|
+
- A DataFrame with the original data merged with the depth-corrected core
|
|
415
|
+
data. New columns include 'DEPTH_CORRECTED', 'CORE_ID_SHIFTED',
|
|
416
|
+
'CPORE_SHIFTED', and 'CPERM_SHIFTED'.
|
|
417
|
+
- A summary DataFrame detailing the depth shifts for each core sample,
|
|
418
|
+
including 'WELL_NAME', 'CORE_ID', 'ORIGINAL_DEPTH', 'DEPTH_CORRECTED',
|
|
419
|
+
and 'DEPTH_SHIFT'.
|
|
420
|
+
"""
|
|
421
|
+
required_cols = ['WELL_NAME', 'DEPTH', 'PHIT', 'CPORE', 'CPERM', 'CORE_ID']
|
|
422
|
+
for col in required_cols:
|
|
423
|
+
if col not in df.columns:
|
|
424
|
+
raise AssertionError(f"Missing required column: {col}")
|
|
425
|
+
|
|
426
|
+
shift_summaries = []
|
|
427
|
+
return_df = pd.DataFrame()
|
|
428
|
+
for well, data in tqdm(df.groupby('WELL_NAME'), desc='Correlating core depths'):
|
|
429
|
+
core_data = data[['DEPTH', 'CORE_ID', 'CPORE', 'CPERM']].dropna().sort_values('DEPTH').reset_index(drop=True)
|
|
430
|
+
|
|
431
|
+
if core_data.empty:
|
|
432
|
+
return_df = pd.concat([return_df, data])
|
|
433
|
+
continue
|
|
434
|
+
|
|
435
|
+
log_data = data[['DEPTH', 'PHIT']].dropna().sort_values('DEPTH').reset_index(drop=True)
|
|
436
|
+
tqdm.write(f'Processing {well}: {len(core_data)} core data and {len(log_data)} log data')
|
|
437
|
+
|
|
438
|
+
# Create a window of log data around core points to speed up DTW
|
|
439
|
+
core_indices_in_log = np.searchsorted(log_data.DEPTH, core_data.DEPTH, side='left')
|
|
440
|
+
window = 1
|
|
441
|
+
window_indices = core_indices_in_log[:, None] + np.arange(-window, window + 1)
|
|
442
|
+
window_indices = np.clip(window_indices, 0, len(log_data) - 1)
|
|
443
|
+
unique_indices = np.unique(window_indices.flatten())
|
|
444
|
+
log_data_subset = log_data.iloc[unique_indices].reset_index(drop=True)
|
|
445
|
+
|
|
446
|
+
# Extract the numpy arrays for the DTW algorithm
|
|
447
|
+
phit_vals = log_data_subset['PHIT'].values
|
|
448
|
+
cpore_vals = core_data['CPORE'].values
|
|
449
|
+
|
|
450
|
+
alignment = dtw(cpore_vals, phit_vals,
|
|
451
|
+
distance_only=False,
|
|
452
|
+
keep_internals=True,
|
|
453
|
+
step_pattern="symmetric2")
|
|
454
|
+
|
|
455
|
+
# The alignment object contains the mapping between indices
|
|
456
|
+
core_indices = alignment.index1 # Indices for the `core_data` DataFrame
|
|
457
|
+
log_indices = alignment.index2 # Indices for the `log_data_subset` DataFrame
|
|
458
|
+
|
|
459
|
+
# Create a detailed map from the alignment
|
|
460
|
+
correction_map_df = pd.DataFrame({
|
|
461
|
+
'ORIGINAL_DEPTH': core_data.loc[core_indices, 'DEPTH'].values,
|
|
462
|
+
'CORE_ID_SHIFTED': core_data.loc[core_indices, 'CORE_ID'].values,
|
|
463
|
+
'CPORE_SHIFTED': core_data.loc[core_indices, 'CPORE'].values,
|
|
464
|
+
'CPERM_SHIFTED': core_data.loc[core_indices, 'CPERM'].values,
|
|
465
|
+
'MATCHED_PHIT': log_data_subset.loc[log_indices, 'PHIT'].values,
|
|
466
|
+
'DEPTH_CORRECTED': log_data_subset.loc[log_indices, 'DEPTH'].values
|
|
467
|
+
})
|
|
468
|
+
|
|
469
|
+
# Find the best match for each original core depth by minimizing porosity difference
|
|
470
|
+
correction_map_df['PORO_DIFF'] = (correction_map_df['CPORE_SHIFTED'] - correction_map_df['MATCHED_PHIT']).abs()
|
|
471
|
+
correction_map_df['DEPTH_SHIFT'] = round(
|
|
472
|
+
correction_map_df.DEPTH_CORRECTED - correction_map_df.ORIGINAL_DEPTH, 3)
|
|
473
|
+
best_matches = correction_map_df.sort_values('PORO_DIFF').drop_duplicates('ORIGINAL_DEPTH')
|
|
474
|
+
|
|
475
|
+
if not best_matches.empty:
|
|
476
|
+
summary = best_matches[['CORE_ID_SHIFTED', 'ORIGINAL_DEPTH', 'DEPTH_CORRECTED', 'DEPTH_SHIFT']].copy()
|
|
477
|
+
summary.rename(columns={'CORE_ID_SHIFTED': 'CORE_ID'}, inplace=True)
|
|
478
|
+
summary['WELL_NAME'] = well
|
|
479
|
+
# Reorder columns for clarity
|
|
480
|
+
summary = summary[['WELL_NAME', 'CORE_ID', 'ORIGINAL_DEPTH', 'DEPTH_CORRECTED', 'DEPTH_SHIFT']]
|
|
481
|
+
shift_summaries.append(summary)
|
|
482
|
+
|
|
483
|
+
# Merge the corrected core data back into the original well data
|
|
484
|
+
df_corrected = pd.merge(
|
|
485
|
+
data,
|
|
486
|
+
best_matches[['DEPTH_CORRECTED', 'CORE_ID_SHIFTED', 'CPORE_SHIFTED', 'CPERM_SHIFTED']],
|
|
487
|
+
left_on='DEPTH',
|
|
488
|
+
right_on='DEPTH_CORRECTED',
|
|
489
|
+
how='left'
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
# Remove original depths if being corrected
|
|
493
|
+
ori_core_ids = df_corrected['CORE_ID'].dropna().unique()
|
|
494
|
+
shifted_core_ids = df_corrected['CORE_ID_SHIFTED'].dropna().unique()
|
|
495
|
+
|
|
496
|
+
mask_shifted = df_corrected['CORE_ID'].isin(shifted_core_ids)
|
|
497
|
+
mask_ori = df_corrected['CORE_ID_SHIFTED'].isin(ori_core_ids)
|
|
498
|
+
|
|
499
|
+
df_corrected.loc[mask_shifted, ['CORE_ID', 'CPORE', 'CPERM']] = np.nan
|
|
500
|
+
df_corrected.loc[mask_ori, ['CORE_ID', 'CPORE', 'CPERM']] = df_corrected.loc[
|
|
501
|
+
mask_ori, ['CORE_ID_SHIFTED', 'CPORE_SHIFTED', 'CPERM_SHIFTED']].values
|
|
502
|
+
|
|
503
|
+
return_df = pd.concat([return_df, df_corrected])
|
|
504
|
+
|
|
505
|
+
# After the loop, combine all summaries into a single DataFrame
|
|
506
|
+
final_summary_df = pd.DataFrame()
|
|
507
|
+
if shift_summaries:
|
|
508
|
+
final_summary_df = pd.concat(shift_summaries, ignore_index=True)
|
|
509
|
+
|
|
510
|
+
return return_df, final_summary_df
|
|
@@ -35,7 +35,7 @@ def add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs):
|
|
|
35
35
|
|
|
36
36
|
style = trace_def.get('style', {})
|
|
37
37
|
trace_args = dict(
|
|
38
|
-
x=df[col],
|
|
38
|
+
x=round(df[col], 3) if df[col].dtype == 'float64' else df[col],
|
|
39
39
|
y=index,
|
|
40
40
|
name=col,
|
|
41
41
|
**kwargs
|
|
@@ -249,14 +249,22 @@ def plotly_log(well_data, well_name: str = '', depth_uom="", trace_defs: dict =
|
|
|
249
249
|
if 'ROCK_FLAG_0' in df.columns and no_of_track >= 7 and default_flags:
|
|
250
250
|
rock_flag_columns = [col for col in df.columns if col.startswith('ROCK_FLAG_')]
|
|
251
251
|
# Remove 'ROCK_FLAG_0' if it already exists as a trace in fig.data
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
if any(trace.name == 'ROCK_FLAG_0' for trace in fig.data):
|
|
253
|
+
rock_flag_columns.remove('ROCK_FLAG_0')
|
|
254
|
+
fig.update_traces(selector=dict(name='ROCK_FLAG_0'), visible=False)
|
|
254
255
|
for feature in rock_flag_columns:
|
|
255
256
|
fig.add_trace(
|
|
256
257
|
go.Scatter(x=df[feature], y=index, line_color=COLOR_DICT[feature], name=feature,
|
|
257
258
|
fill='tozerox', fillcolor=COLOR_DICT.get(feature, '#000000')),
|
|
258
259
|
row=1, col=7, secondary_y=False)
|
|
259
260
|
|
|
261
|
+
# Add TVD to each tracks if available
|
|
262
|
+
if 'TVD' in df.columns:
|
|
263
|
+
for c in range(1, no_of_track + 1):
|
|
264
|
+
fig.add_trace(
|
|
265
|
+
go.Scatter(x=df['TVD'], y=index, name='TVD', line={'width': 0}),
|
|
266
|
+
row=1, col=c, secondary_y=False)
|
|
267
|
+
|
|
260
268
|
# Update xaxis and yaxis layout configurations
|
|
261
269
|
visible_xaxis = [col for col, trace_def in trace_defs.items() if not trace_def.get('hide_xaxis', True)]
|
|
262
270
|
layout_dict = {f'xaxis{x.xaxis[1:]}': v for k, v in xaxis_defs.items() for x in fig.data
|
|
@@ -312,7 +312,11 @@ TRACE_DEFS = dict(
|
|
|
312
312
|
track=8,
|
|
313
313
|
secondary_y=False,
|
|
314
314
|
hide_xaxis=False,
|
|
315
|
-
style={
|
|
315
|
+
style={
|
|
316
|
+
'line_width': 0, 'fill': 'tozerox', 'fillpattern_bgcolor': "#4D4DB8",
|
|
317
|
+
'fillpattern_fgcolor': '#000000', 'fillpattern_fillmode': 'replace', 'fillpattern_shape': '|',
|
|
318
|
+
'fillpattern_size': 3, 'fillpattern_solidity': 0.3
|
|
319
|
+
}
|
|
316
320
|
),
|
|
317
321
|
)
|
|
318
322
|
|
|
@@ -454,21 +458,21 @@ XAXIS_DEFS = dict(
|
|
|
454
458
|
dtick=0.1, range=[0, 0.5], type='linear', zeroline=False
|
|
455
459
|
),
|
|
456
460
|
COAL_FLAG=dict(
|
|
457
|
-
range=[.1, .2], type='linear', showgrid=False, zeroline=False,
|
|
461
|
+
range=[.1, .2], type='linear', showgrid=False, zeroline=False, tickfont={'size': 1}
|
|
458
462
|
),
|
|
459
463
|
TIGHT_FLAG=dict(
|
|
460
|
-
range=[.1, .2], type='linear', showgrid=False, zeroline=False, overlaying='x8'
|
|
464
|
+
range=[.1, .2], type='linear', showgrid=False, zeroline=False, tickfont={'size': 1}, overlaying='x8'
|
|
461
465
|
),
|
|
462
466
|
DTC=dict(
|
|
463
467
|
title={'text': 'DTC (us/ft)', 'font': {'color': COLOR_DICT['DTC'], 'size': font_size}},
|
|
464
468
|
tickfont={'color': COLOR_DICT['DTC'], 'size': font_size},
|
|
465
469
|
side='top', anchor='free', position=.85, title_standoff=.1,
|
|
466
|
-
dtick=
|
|
470
|
+
dtick=20, range=[140, 40], tickangle=-90, type='linear', zeroline=False
|
|
467
471
|
),
|
|
468
472
|
DTS=dict(
|
|
469
473
|
title={'text': 'DTS (us/ft)', 'font': {'color': COLOR_DICT['DTS'], 'size': font_size}},
|
|
470
474
|
tickfont={'color': COLOR_DICT['DTS'], 'size': font_size},
|
|
471
475
|
side='top', anchor='free', position=.89, title_standoff=.1, overlaying='x9',
|
|
472
|
-
dtick=40, range=[
|
|
476
|
+
dtick=40, range=[240, 40], tickangle=-90, type='linear', zeroline=False
|
|
473
477
|
)
|
|
474
478
|
)
|
|
@@ -33,7 +33,7 @@ def calc_reservoir_summary(depth, vshale, phit, swt, perm, zones,
|
|
|
33
33
|
|
|
34
34
|
df = pd.DataFrame({'depth': depth, 'vshale': vshale, 'phit': phit, 'swt': swt, 'perm': perm, 'zones': zones})
|
|
35
35
|
step = df['depth'].diff().mean()
|
|
36
|
-
df['
|
|
36
|
+
df['bvhc'] = df['phit'] * (1 - df['swt'])
|
|
37
37
|
df['rock_flag'], df['reservoir_flag'], df['pay_flag'] = flag_interval(df['vshale'], df['phit'], df['swt'], cutoffs)
|
|
38
38
|
df['all_flag'] = 1
|
|
39
39
|
|
|
@@ -55,23 +55,17 @@ def calc_reservoir_summary(depth, vshale, phit, swt, perm, zones,
|
|
|
55
55
|
"vshale": lambda x: np.nanmean(x),
|
|
56
56
|
"phit": lambda x: np.nanmean(x),
|
|
57
57
|
"swt": lambda x: np.nanmean(x),
|
|
58
|
-
"
|
|
58
|
+
"bvhc": lambda x: np.nanmean(x)
|
|
59
59
|
}).reset_index()
|
|
60
60
|
avg_df['perm_am'] = flag_df.groupby('zones')['perm'].agg('mean').reset_index(drop=True)
|
|
61
61
|
avg_df['perm_gm'] = flag_df.groupby('zones')['perm'].agg(gmean, nan_policy='omit').reset_index(drop=True)
|
|
62
62
|
avg_df['perm_hm'] = flag_df.groupby('zones')['perm'].agg(hmean, nan_policy='omit').reset_index(drop=True)
|
|
63
63
|
avg_df = avg_df.rename(columns={
|
|
64
|
-
"vshale": "av_vshale", "phit": "av_phit", "swt": "av_swt", "
|
|
64
|
+
"vshale": "av_vshale", "phit": "av_phit", "swt": "av_swt", "bvhc": "av_bvhc",
|
|
65
65
|
"perm_gm": "av_perm_gm", "perm_am": "av_perm_am", "perm_hm": "av_perm_hm"
|
|
66
66
|
})
|
|
67
67
|
temp_df = temp_df.merge(avg_df, on=["zones"], how="left", validate="1:1")
|
|
68
68
|
|
|
69
|
-
# Calculate gross thickness
|
|
70
|
-
gross = df.groupby(["zones"])[["depth"]].agg(lambda x: np.nanmax(x) - np.nanmin(x)).reset_index().rename(
|
|
71
|
-
columns={"depth": "gross"})
|
|
72
|
-
temp_df = temp_df.merge(gross[["zones", 'gross']], on=["zones"], how="left", validate="1:1")
|
|
73
|
-
temp_df['ntg'] = temp_df['net'] / temp_df['gross']
|
|
74
|
-
|
|
75
69
|
# Set the maximum depth as bottom depth
|
|
76
70
|
bottom = df.groupby(["zones"])[["depth"]].agg(lambda x: np.nanmax(x)).reset_index().rename(
|
|
77
71
|
columns={"depth": "bottom"})
|
|
@@ -83,6 +77,12 @@ def calc_reservoir_summary(depth, vshale, phit, swt, perm, zones,
|
|
|
83
77
|
temp_df = temp_df.merge(top[["zones", 'top']], on=["zones"], how="left", validate="1:1")
|
|
84
78
|
temp_df['flag'] = flag
|
|
85
79
|
|
|
80
|
+
# Calculate gross thickness
|
|
81
|
+
temp_df['gross'] = temp_df['bottom'] - temp_df['top']
|
|
82
|
+
|
|
83
|
+
# Calculate net thickness
|
|
84
|
+
temp_df['ntg'] = temp_df['net'] / temp_df['gross']
|
|
85
|
+
|
|
86
86
|
# Concat to ressum_df
|
|
87
87
|
ressum_df = pd.concat([ressum_df, temp_df], ignore_index=True)
|
|
88
88
|
|
|
@@ -91,7 +91,7 @@ def calc_reservoir_summary(depth, vshale, phit, swt, perm, zones,
|
|
|
91
91
|
|
|
92
92
|
# Sort the columns
|
|
93
93
|
cols = ['zones', 'flag', 'top', 'bottom', 'gross', 'net', 'ntg',
|
|
94
|
-
'av_vshale', 'av_phit', 'av_swt', '
|
|
94
|
+
'av_vshale', 'av_phit', 'av_swt', 'av_bvhc', 'av_perm_am', 'av_perm_gm', 'av_perm_hm']
|
|
95
95
|
|
|
96
96
|
logger.debug(f"Reservoir summary calculation completed with {len(ressum_df)} summary rows")
|
|
97
97
|
return ressum_df[cols]
|
|
@@ -174,7 +174,9 @@ def convert_md_to_tvd(df, well_coords):
|
|
|
174
174
|
Returns:
|
|
175
175
|
pandas.DataFrame: DataFrame with TVD column added.
|
|
176
176
|
"""
|
|
177
|
+
# Filter temp_df to only the range covered by the survey
|
|
177
178
|
dev_survey = wpp.deviation(md=well_coords['md'], inc=well_coords['incl'], azi=well_coords['azim'])
|
|
179
|
+
df = df[df.DEPTH.between(well_coords['md'].min(), well_coords['md'].max())]
|
|
178
180
|
df['TVD'] = dev_survey.minimum_curvature().resample(df.DEPTH.values).depth
|
|
179
181
|
|
|
180
182
|
# Get list of columns to resample
|
|
@@ -426,6 +426,7 @@ def get_tvd(df, well_coords):
|
|
|
426
426
|
|
|
427
427
|
dev_survey = wpp.deviation(md=well_coords['md'], inc=well_coords['incl'], azi=well_coords['azim'])
|
|
428
428
|
# Resample the survey at the exact MD points from the log data
|
|
429
|
+
df = df[df.DEPTH.between(well_coords['md'].min(), well_coords['md'].max())]
|
|
429
430
|
tvd = dev_survey.minimum_curvature().resample(df['DEPTH'].values).depth
|
|
430
431
|
return tvd
|
|
431
432
|
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
import matplotlib.pyplot as plt
|
|
3
|
-
from matplotlib.figure import Figure
|
|
4
|
-
|
|
5
|
-
def neutron_density_plot(nphi, rhob, color=None, labels=None, title=None, figsize=(8,8)):
|
|
6
|
-
"""Create a neutron-density crossplot with lithology overlay lines.
|
|
7
|
-
|
|
8
|
-
Args:
|
|
9
|
-
nphi (array-like): Neutron porosity values (v/v)
|
|
10
|
-
rhob (array-like): Bulk density values (g/cc)
|
|
11
|
-
color (array-like, optional): Color values for points
|
|
12
|
-
labels (list, optional): Labels for legend
|
|
13
|
-
title (str, optional): Plot title
|
|
14
|
-
figsize (tuple, optional): Figure size. Defaults to (8,8)
|
|
15
|
-
|
|
16
|
-
Returns:
|
|
17
|
-
matplotlib.figure.Figure: The created figure
|
|
18
|
-
"""
|
|
19
|
-
fig = Figure(figsize=figsize)
|
|
20
|
-
ax = fig.add_subplot(111)
|
|
21
|
-
|
|
22
|
-
# Plot data points
|
|
23
|
-
if color is not None:
|
|
24
|
-
scatter = ax.scatter(nphi, rhob, c=color, alpha=0.6)
|
|
25
|
-
if labels is not None:
|
|
26
|
-
fig.colorbar(scatter, label=labels)
|
|
27
|
-
else:
|
|
28
|
-
ax.scatter(nphi, rhob, alpha=0.6)
|
|
29
|
-
|
|
30
|
-
# Add lithology lines
|
|
31
|
-
# Sandstone line
|
|
32
|
-
nphi_sand = np.array([0, 0.45])
|
|
33
|
-
rhob_sand = np.array([2.65, 1.9])
|
|
34
|
-
ax.plot(nphi_sand, rhob_sand, 'r--', label='Sandstone')
|
|
35
|
-
|
|
36
|
-
# Limestone line
|
|
37
|
-
nphi_ls = np.array([0, 0.45])
|
|
38
|
-
rhob_ls = np.array([2.71, 2.0])
|
|
39
|
-
ax.plot(nphi_ls, rhob_ls, 'b--', label='Limestone')
|
|
40
|
-
|
|
41
|
-
# Dolomite line
|
|
42
|
-
nphi_dol = np.array([0, 0.45])
|
|
43
|
-
rhob_dol = np.array([2.85, 2.2])
|
|
44
|
-
ax.plot(nphi_dol, rhob_dol, 'g--', label='Dolomite')
|
|
45
|
-
|
|
46
|
-
# Customize plot
|
|
47
|
-
ax.set_xlabel('Neutron Porosity (v/v)')
|
|
48
|
-
ax.set_ylabel('Bulk Density (g/cc)')
|
|
49
|
-
ax.set_xlim(-0.05, 0.45)
|
|
50
|
-
ax.set_ylim(3.0, 1.8)
|
|
51
|
-
ax.grid(True)
|
|
52
|
-
ax.legend()
|
|
53
|
-
|
|
54
|
-
if title:
|
|
55
|
-
ax.set_title(title)
|
|
56
|
-
|
|
57
|
-
return fig
|
|
58
|
-
|
|
59
|
-
def density_pe_plot(rhob, pef, color=None, labels=None, title=None, figsize=(8,8)):
|
|
60
|
-
"""Create a density-photoelectric factor crossplot with lithology overlay.
|
|
61
|
-
|
|
62
|
-
Args:
|
|
63
|
-
rhob (array-like): Bulk density values (g/cc)
|
|
64
|
-
pef (array-like): Photoelectric factor values (barns/e-)
|
|
65
|
-
color (array-like, optional): Color values for points
|
|
66
|
-
labels (list, optional): Labels for legend
|
|
67
|
-
title (str, optional): Plot title
|
|
68
|
-
figsize (tuple, optional): Figure size. Defaults to (8,8)
|
|
69
|
-
|
|
70
|
-
Returns:
|
|
71
|
-
matplotlib.figure.Figure: The created figure
|
|
72
|
-
"""
|
|
73
|
-
fig = Figure(figsize=figsize)
|
|
74
|
-
ax = fig.add_subplot(111)
|
|
75
|
-
|
|
76
|
-
# Plot data points
|
|
77
|
-
if color is not None:
|
|
78
|
-
scatter = ax.scatter(rhob, pef, c=color, alpha=0.6)
|
|
79
|
-
if labels is not None:
|
|
80
|
-
fig.colorbar(scatter, label=labels)
|
|
81
|
-
else:
|
|
82
|
-
ax.scatter(rhob, pef, alpha=0.6)
|
|
83
|
-
|
|
84
|
-
# Add lithology points
|
|
85
|
-
minerals = {
|
|
86
|
-
'Quartz': (2.65, 1.81),
|
|
87
|
-
'Calcite': (2.71, 5.08),
|
|
88
|
-
'Dolomite': (2.85, 3.14),
|
|
89
|
-
'Anhydrite': (2.98, 5.05),
|
|
90
|
-
'Halite': (2.03, 4.65),
|
|
91
|
-
'Gypsum': (2.35, 4.0)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
for mineral, (dens, pe) in minerals.items():
|
|
95
|
-
ax.plot(dens, pe, 'r*', markersize=10, label=mineral)
|
|
96
|
-
|
|
97
|
-
# Customize plot
|
|
98
|
-
ax.set_xlabel('Bulk Density (g/cc)')
|
|
99
|
-
ax.set_ylabel('Photoelectric Factor (barns/e-)')
|
|
100
|
-
ax.set_xlim(2.0, 3.0)
|
|
101
|
-
ax.set_ylim(0, 6)
|
|
102
|
-
ax.grid(True)
|
|
103
|
-
ax.legend()
|
|
104
|
-
|
|
105
|
-
if title:
|
|
106
|
-
ax.set_title(title)
|
|
107
|
-
|
|
108
|
-
return fig
|
|
109
|
-
|
|
110
|
-
def m_n_plot(rhob, nphi, dtc, color=None, labels=None, title=None, figsize=(8,8)):
|
|
111
|
-
"""Create an M-N crossplot for lithology identification.
|
|
112
|
-
|
|
113
|
-
Args:
|
|
114
|
-
rhob (array-like): Bulk density values (g/cc)
|
|
115
|
-
nphi (array-like): Neutron porosity values (v/v)
|
|
116
|
-
dtc (array-like): Sonic transit time values (us/ft)
|
|
117
|
-
color (array-like, optional): Color values for points
|
|
118
|
-
labels (list, optional): Labels for legend
|
|
119
|
-
title (str, optional): Plot title
|
|
120
|
-
figsize (tuple, optional): Figure size. Defaults to (8,8)
|
|
121
|
-
|
|
122
|
-
Returns:
|
|
123
|
-
matplotlib.figure.Figure: The created figure
|
|
124
|
-
"""
|
|
125
|
-
# Calculate M and N values
|
|
126
|
-
# M = (dtf - dtc)/(rhob - rhof) * 0.01
|
|
127
|
-
# N = (nphi - phif)/(rhob - rhof)
|
|
128
|
-
|
|
129
|
-
dtf = 189 # fluid transit time (us/ft)
|
|
130
|
-
rhof = 1.0 # fluid density (g/cc)
|
|
131
|
-
phif = 1.0 # fluid porosity (v/v)
|
|
132
|
-
|
|
133
|
-
M = (dtf - dtc)/(rhob - rhof) * 0.01
|
|
134
|
-
N = (nphi - phif)/(rhob - rhof)
|
|
135
|
-
|
|
136
|
-
fig = Figure(figsize=figsize)
|
|
137
|
-
ax = fig.add_subplot(111)
|
|
138
|
-
|
|
139
|
-
# Plot data points
|
|
140
|
-
if color is not None:
|
|
141
|
-
scatter = ax.scatter(M, N, c=color, alpha=0.6)
|
|
142
|
-
if labels is not None:
|
|
143
|
-
fig.colorbar(scatter, label=labels)
|
|
144
|
-
else:
|
|
145
|
-
ax.scatter(M, N, alpha=0.6)
|
|
146
|
-
|
|
147
|
-
# Add mineral points
|
|
148
|
-
minerals = {
|
|
149
|
-
'Quartz': (0.80, -0.02),
|
|
150
|
-
'Calcite': (0.85, 0.03),
|
|
151
|
-
'Dolomite': (0.70, -0.01),
|
|
152
|
-
'Anhydrite': (0.65, -0.05),
|
|
153
|
-
'Gypsum': (0.75, 0.00)
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
for mineral, (m, n) in minerals.items():
|
|
157
|
-
ax.plot(m, n, 'r*', markersize=10, label=mineral)
|
|
158
|
-
|
|
159
|
-
# Customize plot
|
|
160
|
-
ax.set_xlabel('M = (dtf - dtc)/(rhob - rhof) * 0.01')
|
|
161
|
-
ax.set_ylabel('N = (nphi - phif)/(rhob - rhof)')
|
|
162
|
-
ax.set_xlim(0.4, 1.0)
|
|
163
|
-
ax.set_ylim(-0.15, 0.15)
|
|
164
|
-
ax.grid(True)
|
|
165
|
-
ax.legend()
|
|
166
|
-
|
|
167
|
-
if title:
|
|
168
|
-
ax.set_title(title)
|
|
169
|
-
|
|
170
|
-
return fig
|
|
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
|
|
File without changes
|
|
File without changes
|