quick-pp 0.1.1__tar.gz → 0.1.4__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.1.4/HISTORY.rst +19 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/PKG-INFO +13 -2
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/Makefile +2 -2
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/conf.py +3 -3
- quick_pp-0.1.4/docs/source/quick_pp.rst +93 -0
- quick_pp-0.1.4/docs/static/quick_pp_demo.gif +0 -0
- quick_pp-0.1.4/quick_pp/__init__.py +3 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp/las_handler.py +11 -21
- quick_pp-0.1.4/quick_pp/lithology.py +394 -0
- quick_pp-0.1.4/quick_pp/permeability.py +84 -0
- quick_pp-0.1.1/quick_pp/plotter/well_plots.py → quick_pp-0.1.4/quick_pp/plotter.py +109 -19
- {quick_pp-0.1.1/quick_pp/porosity → quick_pp-0.1.4/quick_pp}/porosity.py +64 -28
- {quick_pp-0.1.1/quick_pp/qaqc → quick_pp-0.1.4/quick_pp}/qaqc.py +29 -20
- {quick_pp-0.1.1/quick_pp/ressum → quick_pp-0.1.4/quick_pp}/ressum.py +13 -13
- {quick_pp-0.1.1/quick_pp/saturation → quick_pp-0.1.4/quick_pp}/saturation.py +60 -80
- {quick_pp-0.1.1/quick_pp/utils → quick_pp-0.1.4/quick_pp}/utils.py +29 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/PKG-INFO +13 -2
- quick_pp-0.1.4/quick_pp.egg-info/SOURCES.txt +45 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/setup.py +2 -1
- quick_pp-0.1.1/HISTORY.rst +0 -8
- quick_pp-0.1.1/docs/source/quick_pp.fluid_type.rst +0 -10
- quick_pp-0.1.1/docs/source/quick_pp.lithology.rst +0 -45
- quick_pp-0.1.1/docs/source/quick_pp.permeability.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.plotter.rst +0 -29
- quick_pp-0.1.1/docs/source/quick_pp.porosity.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.qaqc.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.ressum.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.rock_physics.rst +0 -10
- quick_pp-0.1.1/docs/source/quick_pp.rock_type.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.rst +0 -63
- quick_pp-0.1.1/docs/source/quick_pp.saturation.rst +0 -21
- quick_pp-0.1.1/docs/source/quick_pp.utils.rst +0 -21
- quick_pp-0.1.1/quick_pp/__init__.py +0 -8
- quick_pp-0.1.1/quick_pp/cli.py +0 -16
- quick_pp-0.1.1/quick_pp/fluid_type/__init__.py +0 -0
- quick_pp-0.1.1/quick_pp/lithology/__init__.py +0 -24
- quick_pp-0.1.1/quick_pp/lithology/multi_mineral.py +0 -53
- quick_pp-0.1.1/quick_pp/lithology/sand_shale.py +0 -81
- quick_pp-0.1.1/quick_pp/lithology/sand_silt_clay.py +0 -188
- quick_pp-0.1.1/quick_pp/lithology/shale.py +0 -80
- quick_pp-0.1.1/quick_pp/permeability/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/permeability/permeability.py +0 -102
- quick_pp-0.1.1/quick_pp/plotter/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/plotter/cross_plots.py +0 -86
- quick_pp-0.1.1/quick_pp/porosity/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/qaqc/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/quick_pp.py +0 -1
- quick_pp-0.1.1/quick_pp/ressum/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/rock_physics/__init__.py +0 -0
- quick_pp-0.1.1/quick_pp/rock_type/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/saturation/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp/utils/__init__.py +0 -1
- quick_pp-0.1.1/quick_pp.egg-info/SOURCES.txt +0 -72
- {quick_pp-0.1.1 → quick_pp-0.1.4}/AUTHORS.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/CONTRIBUTING.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/LICENSE +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/MANIFEST.in +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/README.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/_build/html/_static/file.png +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/_build/html/_static/minus.png +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/_build/html/_static/plus.png +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/make.bat +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/authors.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/contributing.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/history.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/index.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/installation.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/modules.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/readme.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/docs/source/usage.rst +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp/config.py +0 -0
- {quick_pp-0.1.1/quick_pp/rock_type → quick_pp-0.1.4/quick_pp}/rock_type.py +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/dependency_links.txt +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/entry_points.txt +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/not-zip-safe +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/requires.txt +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/quick_pp.egg-info/top_level.txt +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/setup.cfg +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/tests/__init__.py +0 -0
- {quick_pp-0.1.1 → quick_pp-0.1.4}/tests/test_quick_pp.py +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
=======
|
|
2
|
+
History
|
|
3
|
+
=======
|
|
4
|
+
|
|
5
|
+
0.1.0 (2023-10-08)
|
|
6
|
+
------------------
|
|
7
|
+
* First release on PyPI.
|
|
8
|
+
|
|
9
|
+
0.1.2 (2024-01-19)
|
|
10
|
+
------------------
|
|
11
|
+
* Refactor config.
|
|
12
|
+
|
|
13
|
+
0.1.3 (2024-01-20)
|
|
14
|
+
------------------
|
|
15
|
+
* Update requirements.
|
|
16
|
+
|
|
17
|
+
0.1.4 (2024-02-04)
|
|
18
|
+
------------------
|
|
19
|
+
* Update docstrings.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: quick_pp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
|
|
5
5
|
Home-page: https://github.com/imranfadhil/quick_pp
|
|
6
6
|
Author: Imran Fadhil
|
|
@@ -51,5 +51,16 @@ History
|
|
|
51
51
|
|
|
52
52
|
0.1.0 (2023-10-08)
|
|
53
53
|
------------------
|
|
54
|
-
|
|
55
54
|
* First release on PyPI.
|
|
55
|
+
|
|
56
|
+
0.1.2 (2024-01-19)
|
|
57
|
+
------------------
|
|
58
|
+
* Refactor config.
|
|
59
|
+
|
|
60
|
+
0.1.3 (2024-01-20)
|
|
61
|
+
------------------
|
|
62
|
+
* Update requirements.
|
|
63
|
+
|
|
64
|
+
0.1.4 (2024-02-04)
|
|
65
|
+
------------------
|
|
66
|
+
* Update docstrings.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Minimal makefile for Sphinx documentation
|
|
2
|
-
# Steps:
|
|
3
|
-
# 1. "sphinx-apidoc -o
|
|
2
|
+
# Steps (execute in the docs folder):
|
|
3
|
+
# 1. "sphinx-apidoc -o ./source ../quick_pp" to generate the module.rst files
|
|
4
4
|
# 2. "make html" to generate the html files
|
|
5
5
|
|
|
6
6
|
# You can set these variables from the command line.
|
|
@@ -32,7 +32,7 @@ import quick_pp # noqa
|
|
|
32
32
|
|
|
33
33
|
# Add any Sphinx extension module names here, as strings. They can be
|
|
34
34
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
35
|
-
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
|
|
35
|
+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', "sphinx.ext.napoleon"]
|
|
36
36
|
|
|
37
37
|
# Add any paths that contain templates here, relative to this directory.
|
|
38
38
|
templates_path = ['_templates']
|
|
@@ -65,7 +65,7 @@ release = quick_pp.__version__
|
|
|
65
65
|
#
|
|
66
66
|
# This is also used if you do content translation via gettext catalogs.
|
|
67
67
|
# Usually you set "language" from the command line for these cases.
|
|
68
|
-
language =
|
|
68
|
+
language = 'en'
|
|
69
69
|
|
|
70
70
|
# List of patterns, relative to source directory, that match files and
|
|
71
71
|
# directories to ignore when looking for source files.
|
|
@@ -98,7 +98,7 @@ html_theme = 'sphinx_rtd_theme'
|
|
|
98
98
|
# Add any paths that contain custom static files (such as style sheets) here,
|
|
99
99
|
# relative to this directory. They are copied after the builtin static files,
|
|
100
100
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
|
101
|
-
html_static_path = [
|
|
101
|
+
html_static_path = []
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
# -- Options for HTMLHelp output ---------------------------------------
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
quick\_pp package
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
Submodules
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
quick\_pp.las\_handler module
|
|
8
|
+
-----------------------------
|
|
9
|
+
|
|
10
|
+
.. automodule:: quick_pp.las_handler
|
|
11
|
+
:members:
|
|
12
|
+
:undoc-members:
|
|
13
|
+
:show-inheritance:
|
|
14
|
+
|
|
15
|
+
quick\_pp.lithology module
|
|
16
|
+
--------------------------
|
|
17
|
+
|
|
18
|
+
.. automodule:: quick_pp.lithology
|
|
19
|
+
:members:
|
|
20
|
+
:undoc-members:
|
|
21
|
+
:show-inheritance:
|
|
22
|
+
|
|
23
|
+
quick\_pp.permeability module
|
|
24
|
+
-----------------------------
|
|
25
|
+
|
|
26
|
+
.. automodule:: quick_pp.permeability
|
|
27
|
+
:members:
|
|
28
|
+
:undoc-members:
|
|
29
|
+
:show-inheritance:
|
|
30
|
+
|
|
31
|
+
quick\_pp.plotter module
|
|
32
|
+
------------------------
|
|
33
|
+
|
|
34
|
+
.. automodule:: quick_pp.plotter
|
|
35
|
+
:members:
|
|
36
|
+
:undoc-members:
|
|
37
|
+
:show-inheritance:
|
|
38
|
+
|
|
39
|
+
quick\_pp.porosity module
|
|
40
|
+
-------------------------
|
|
41
|
+
|
|
42
|
+
.. automodule:: quick_pp.porosity
|
|
43
|
+
:members:
|
|
44
|
+
:undoc-members:
|
|
45
|
+
:show-inheritance:
|
|
46
|
+
|
|
47
|
+
quick\_pp.qaqc module
|
|
48
|
+
---------------------
|
|
49
|
+
|
|
50
|
+
.. automodule:: quick_pp.qaqc
|
|
51
|
+
:members:
|
|
52
|
+
:undoc-members:
|
|
53
|
+
:show-inheritance:
|
|
54
|
+
|
|
55
|
+
quick\_pp.ressum module
|
|
56
|
+
-----------------------
|
|
57
|
+
|
|
58
|
+
.. automodule:: quick_pp.ressum
|
|
59
|
+
:members:
|
|
60
|
+
:undoc-members:
|
|
61
|
+
:show-inheritance:
|
|
62
|
+
|
|
63
|
+
quick\_pp.rock\_type module
|
|
64
|
+
---------------------------
|
|
65
|
+
|
|
66
|
+
.. automodule:: quick_pp.rock_type
|
|
67
|
+
:members:
|
|
68
|
+
:undoc-members:
|
|
69
|
+
:show-inheritance:
|
|
70
|
+
|
|
71
|
+
quick\_pp.saturation module
|
|
72
|
+
---------------------------
|
|
73
|
+
|
|
74
|
+
.. automodule:: quick_pp.saturation
|
|
75
|
+
:members:
|
|
76
|
+
:undoc-members:
|
|
77
|
+
:show-inheritance:
|
|
78
|
+
|
|
79
|
+
quick\_pp.utils module
|
|
80
|
+
----------------------
|
|
81
|
+
|
|
82
|
+
.. automodule:: quick_pp.utils
|
|
83
|
+
:members:
|
|
84
|
+
:undoc-members:
|
|
85
|
+
:show-inheritance:
|
|
86
|
+
|
|
87
|
+
Module contents
|
|
88
|
+
---------------
|
|
89
|
+
|
|
90
|
+
.. automodule:: quick_pp
|
|
91
|
+
:members:
|
|
92
|
+
:undoc-members:
|
|
93
|
+
:show-inheritance:
|
|
Binary file
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Created on Thu Dec 24 15:35:42 2020
|
|
3
|
-
|
|
4
|
-
@author: imran.fadhil
|
|
5
|
-
"""
|
|
6
1
|
import re
|
|
7
2
|
import lasio
|
|
8
3
|
import numpy as np
|
|
@@ -13,16 +8,16 @@ import welly
|
|
|
13
8
|
|
|
14
9
|
def read_las_files(las_files):
|
|
15
10
|
"""
|
|
16
|
-
1. Return df and well_header as
|
|
17
|
-
2. For every las files, curves_df, header_df, welly_object are returned through function "
|
|
11
|
+
1. Return df and well_header as df from .las files
|
|
12
|
+
2. For every las files, curves_df, header_df, welly_object are returned through function "read_las_file"
|
|
18
13
|
3. curves_df from all files are appended into merged_data
|
|
19
14
|
4. header_df from all files are appended into header_data
|
|
20
15
|
|
|
21
16
|
Args:
|
|
22
|
-
|
|
17
|
+
las_files (list): list of las files opened as binary.
|
|
23
18
|
|
|
24
19
|
Returns:
|
|
25
|
-
pd.DataFrame:
|
|
20
|
+
pd.DataFrame: Merged data, header data.
|
|
26
21
|
"""
|
|
27
22
|
merged_data = pd.DataFrame()
|
|
28
23
|
header_data = pd.DataFrame()
|
|
@@ -64,10 +59,10 @@ def read_las_file(file_object, required_sets=['PEP']): # noqa
|
|
|
64
59
|
|
|
65
60
|
Args:
|
|
66
61
|
file_object (str): las file object.
|
|
67
|
-
required_sets (list, optional): Required param set to be extracted.Defaults to ['PEP'].
|
|
62
|
+
required_sets (list, optional): Required param set to be extracted. Defaults to ['PEP'].
|
|
68
63
|
|
|
69
64
|
Returns:
|
|
70
|
-
pd.Dataframe:
|
|
65
|
+
pd.Dataframe: well_df, header_df and welly_object
|
|
71
66
|
"""
|
|
72
67
|
fileno = file_object.fileno() # identifier for files
|
|
73
68
|
parameter_line_numbers = []
|
|
@@ -159,8 +154,7 @@ def read_las_file(file_object, required_sets=['PEP']): # noqa
|
|
|
159
154
|
|
|
160
155
|
|
|
161
156
|
def pre_process(welly_object):
|
|
162
|
-
"""
|
|
163
|
-
Pre-process welly_object
|
|
157
|
+
"""Pre-process welly_object
|
|
164
158
|
|
|
165
159
|
1. Resample depth for welly_object
|
|
166
160
|
2. Replace NULL value with nan
|
|
@@ -169,7 +163,6 @@ def pre_process(welly_object):
|
|
|
169
163
|
|
|
170
164
|
Args:
|
|
171
165
|
welly_object (well object): Welly object for PEP dataset
|
|
172
|
-
data_df (pd.Dataframe): dataframe consist of PEP dataset
|
|
173
166
|
|
|
174
167
|
Returns:
|
|
175
168
|
pd.Dataframe: Processed data.
|
|
@@ -189,8 +182,7 @@ def pre_process(welly_object):
|
|
|
189
182
|
|
|
190
183
|
|
|
191
184
|
def extract_dataset(section_dict):
|
|
192
|
-
"""
|
|
193
|
-
Extract dataset from section_dict. For only Las file with ONE (1) dataset
|
|
185
|
+
"""Extract dataset from section_dict. For only Las file with ONE (1) dataset
|
|
194
186
|
|
|
195
187
|
1. Assign well information section as header_bytes
|
|
196
188
|
2. Loop through parameter, curve, and ASCII sections, assign their section values into data_bytes
|
|
@@ -202,8 +194,7 @@ def extract_dataset(section_dict):
|
|
|
202
194
|
section_dict (dict): Dictionary containing the LAS file section values.
|
|
203
195
|
|
|
204
196
|
Returns:
|
|
205
|
-
|
|
206
|
-
header_df and welly_object
|
|
197
|
+
pd.DataFrame, pd.DataFrame, welly_object: well_df, header_df and welly_object
|
|
207
198
|
"""
|
|
208
199
|
header_bytes = section_dict['WELL']
|
|
209
200
|
data_bytes = b''
|
|
@@ -226,8 +217,7 @@ def extract_dataset(section_dict):
|
|
|
226
217
|
|
|
227
218
|
|
|
228
219
|
def concat_datasets(file_object, header_line_numbers, parameter_line_numbers, required_sets=['PEP']):
|
|
229
|
-
"""
|
|
230
|
-
Concat required datasets in the LAS file.
|
|
220
|
+
"""Concat required datasets in the LAS file.
|
|
231
221
|
|
|
232
222
|
1. Iterate through list of parameter_line_numbers, by extracting only param_set of 'PEP'
|
|
233
223
|
2. Through pointer position, subset and then concat well_info and file_object
|
|
@@ -241,7 +231,7 @@ def concat_datasets(file_object, header_line_numbers, parameter_line_numbers, re
|
|
|
241
231
|
required_sets (list): Required sets to be concatenated.
|
|
242
232
|
|
|
243
233
|
Returns:
|
|
244
|
-
pd.Dataframe
|
|
234
|
+
pd.Dataframe, pd.Dataframe, welly_object: well_df, header_df and welly_object
|
|
245
235
|
"""
|
|
246
236
|
well_df = pd.DataFrame()
|
|
247
237
|
header_df = pd.DataFrame()
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import math
|
|
3
|
+
import statistics
|
|
4
|
+
from scipy.optimize import minimize
|
|
5
|
+
from scipy.signal import detrend
|
|
6
|
+
from sklearn.preprocessing import MinMaxScaler
|
|
7
|
+
|
|
8
|
+
from .utils import min_max_line, length_a_b, line_intersection
|
|
9
|
+
from .porosity import neu_den_xplot_poro_pt, clay_porosity
|
|
10
|
+
from .plotter import neutron_density_xplot
|
|
11
|
+
from .config import Config
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class SandSiltClay:
|
|
15
|
+
"""Sand-silt-clay model based on Kuttan's litho-porosity model.
|
|
16
|
+
|
|
17
|
+
The original is a binary model where reservoir sections (left to the silt line) consist of combination of
|
|
18
|
+
sand-silt while non-reservoir sections (right to the silt line) consist of silt-clay combination.
|
|
19
|
+
|
|
20
|
+
PCSB proposed a model based on Kuttan, where the reservoir sections consist of combination of sand-silt-clay
|
|
21
|
+
while non-reservoir sections remain a combination of silt-clay only. This module is a simplified version of the
|
|
22
|
+
original PCSB model."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, dry_sand_point: tuple = None, dry_silt_point: tuple = None, dry_clay_point: tuple = None,
|
|
25
|
+
fluid_point: tuple = None, wet_clay_point: tuple = None, silt_line_angle: float = None):
|
|
26
|
+
# Initialize the endpoints
|
|
27
|
+
self.dry_sand_point = dry_sand_point or Config.SSC_ENDPOINTS["DRY_SAND_POINT"]
|
|
28
|
+
self.dry_silt_point = dry_silt_point or Config.SSC_ENDPOINTS["DRY_SILT_POINT"]
|
|
29
|
+
self.dry_clay_point = dry_clay_point or Config.SSC_ENDPOINTS["DRY_CLAY_POINT"]
|
|
30
|
+
self.fluid_point = fluid_point or Config.SSC_ENDPOINTS["FLUID_POINT"]
|
|
31
|
+
self.wet_clay_point = wet_clay_point or Config.SSC_ENDPOINTS["WET_CLAY_POINT"]
|
|
32
|
+
self.silt_line_angle = silt_line_angle or Config.SSC_ENDPOINTS["SILT_LINE_ANGLE"]
|
|
33
|
+
|
|
34
|
+
def estimate_lithology(self, nphi, rhob, model: str = 'kuttan', xplot: bool = False, normalize: bool = True):
|
|
35
|
+
"""Estimate sand silt clay lithology volumetrics.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
nphi (float): Neutron Porosity log in v/v
|
|
39
|
+
rhob (float): Bulk Density log in g/cc
|
|
40
|
+
model (str, optional): Model to choose from 'kuttan' or 'kuttan_modified'. Defaults to 'kuttan'.
|
|
41
|
+
xplot (bool, optional): To plot Neutron Density cross plot. Defaults to False.
|
|
42
|
+
normalize (bool, optional): To normalize with porosity. Defaults to True.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
(float, float, float, boolean): vsand, vsilt, vcld, vclb, cross-plot if xplot True else None
|
|
46
|
+
"""
|
|
47
|
+
assert model in ['kuttan', 'kuttan_modified'], f"'{model}' model is not available."
|
|
48
|
+
# Initialize the endpoints
|
|
49
|
+
A = self.dry_sand_point
|
|
50
|
+
B = self.dry_silt_point
|
|
51
|
+
C = self.dry_clay_point
|
|
52
|
+
D = self.fluid_point
|
|
53
|
+
|
|
54
|
+
# Redefine wetclay point
|
|
55
|
+
_, rhob_max_line = min_max_line(rhob, 0.05)
|
|
56
|
+
_, nphi_max_line = min_max_line(nphi, 0.05)
|
|
57
|
+
wetclay_RHOB = np.min(rhob_max_line)
|
|
58
|
+
wetclay_NPHI = np.max(nphi_max_line)
|
|
59
|
+
if not all(self.wet_clay_point):
|
|
60
|
+
self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
|
|
61
|
+
# print(f'#### wet_clay_point: {wet_clay_point}')
|
|
62
|
+
|
|
63
|
+
# Redefine drysilt point
|
|
64
|
+
drysilt_NPHI = 1 - 1.68*(math.tan(float(self.silt_line_angle - 90)*math.pi / 180))
|
|
65
|
+
if not all(B):
|
|
66
|
+
B = self.dry_silt_point = (drysilt_NPHI, B[1])
|
|
67
|
+
# print(f'#### drysilt_pt: {drysilt_pt}')
|
|
68
|
+
|
|
69
|
+
# Define dryclay point
|
|
70
|
+
if not all(C):
|
|
71
|
+
m = (D[1] - self.wet_clay_point[1]) / (D[0] - self.wet_clay_point[0])
|
|
72
|
+
dryclay_NPHI = ((C[1] - D[1]) / m) + D[0]
|
|
73
|
+
C = self.dry_clay_point = (dryclay_NPHI, C[1])
|
|
74
|
+
# print(f'#### dryclay_pt: {C}, {m}')
|
|
75
|
+
|
|
76
|
+
if model == 'kuttan':
|
|
77
|
+
vsand, vsilt, vcld = self.lithology_fraction_kuttan(nphi, rhob, normalize)
|
|
78
|
+
else:
|
|
79
|
+
vsand, vsilt, vcld = self.lithology_fraction_kuttan_modified(nphi, rhob, normalize)
|
|
80
|
+
|
|
81
|
+
# Calculate vclb: volume of clay bound water
|
|
82
|
+
clay_phit = clay_porosity(rhob_max_line, C[1])
|
|
83
|
+
vclb = vcld * clay_phit
|
|
84
|
+
|
|
85
|
+
if xplot:
|
|
86
|
+
fig = neutron_density_xplot(nphi, rhob, A, B, C, D, self.wet_clay_point)
|
|
87
|
+
return vsand, vsilt, vcld, vclb, fig
|
|
88
|
+
else:
|
|
89
|
+
return vsand, vsilt, vcld, vclb, None
|
|
90
|
+
|
|
91
|
+
def lithology_fraction_kuttan(self, nphi, rhob, normalize: bool = True):
|
|
92
|
+
"""Estimate lithology volumetrics based on Kuttan's litho-porosity model.
|
|
93
|
+
|
|
94
|
+
Args:
|
|
95
|
+
nphi (float): Neutron Porosity log in v/v.
|
|
96
|
+
rhob (float): Bulk Density log in g/cc.
|
|
97
|
+
normalize (bool, optional): To normalize with porosity. Defaults to True.
|
|
98
|
+
|
|
99
|
+
Returns:
|
|
100
|
+
(float, float, float): vsand, vsilt, vcld
|
|
101
|
+
"""
|
|
102
|
+
A = self.dry_sand_point
|
|
103
|
+
B = self.dry_silt_point
|
|
104
|
+
C = self.dry_clay_point
|
|
105
|
+
D = self.fluid_point
|
|
106
|
+
E = list(zip(nphi, rhob))
|
|
107
|
+
rocklithofrac = length_a_b(A, C)
|
|
108
|
+
sandsiltfrac = length_a_b(A, B)
|
|
109
|
+
matrix_ratio_x = sandsiltfrac / rocklithofrac
|
|
110
|
+
|
|
111
|
+
vsand = []
|
|
112
|
+
vsilt = []
|
|
113
|
+
vcld = []
|
|
114
|
+
for i, point in enumerate(E):
|
|
115
|
+
var_pt = line_intersection((A, C), (D, point))
|
|
116
|
+
projlithofrac = length_a_b(var_pt, A)
|
|
117
|
+
matrix_ratio = projlithofrac / rocklithofrac
|
|
118
|
+
if matrix_ratio < matrix_ratio_x:
|
|
119
|
+
phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', True, A, B, C, D) if normalize else 0
|
|
120
|
+
vmatrix = 1 - phit
|
|
121
|
+
vsilt.append((matrix_ratio / matrix_ratio_x) * vmatrix)
|
|
122
|
+
vsand.append((1 - vsilt[i]) * vmatrix)
|
|
123
|
+
vcld.append(0)
|
|
124
|
+
else:
|
|
125
|
+
phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', False, A, B, C, D) if normalize else 0
|
|
126
|
+
vmatrix = 1 - phit
|
|
127
|
+
vsand.append(0)
|
|
128
|
+
vsilt.append(((1 - matrix_ratio) * vmatrix) / (1 - matrix_ratio_x))
|
|
129
|
+
vcld.append((1 - vsilt[i]) * vmatrix)
|
|
130
|
+
|
|
131
|
+
return vsand, vsilt, vcld
|
|
132
|
+
|
|
133
|
+
def lithology_fraction_kuttan_modified(self, nphi, rhob, normalize: bool = True):
|
|
134
|
+
"""Estimate lithology volumetrics based on modified Kuttan's litho-porosity model
|
|
135
|
+
(simplification of PCSB's litho-porosity model).
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
nphi (float): Neutron Porosity log in v/v.
|
|
139
|
+
rhob (float): Bulk Density log in g/cc.
|
|
140
|
+
normalize (bool, optional): To normalize with porosity. Defaults to True.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
(float, float, float): vsand, vsilt, vcld
|
|
144
|
+
"""
|
|
145
|
+
A = self.dry_sand_point
|
|
146
|
+
B = self.dry_silt_point
|
|
147
|
+
C = self.dry_clay_point
|
|
148
|
+
D = self.fluid_point
|
|
149
|
+
E = list(zip(nphi, rhob))
|
|
150
|
+
|
|
151
|
+
siltclayratio = 0.4 # empirical value
|
|
152
|
+
claysiltfrac = length_a_b(C, B)
|
|
153
|
+
rocklithofrac = length_a_b(A, C)
|
|
154
|
+
sandsiltfrac = length_a_b(A, B)
|
|
155
|
+
matrix_ratio_x = sandsiltfrac / rocklithofrac
|
|
156
|
+
|
|
157
|
+
vsand = []
|
|
158
|
+
vsilt = []
|
|
159
|
+
vcld = []
|
|
160
|
+
for i, point in enumerate(E):
|
|
161
|
+
var_pt = line_intersection((A, C), (D, point))
|
|
162
|
+
projlithofrac = length_a_b(var_pt, A)
|
|
163
|
+
matrix_ratio = projlithofrac / rocklithofrac
|
|
164
|
+
if matrix_ratio < matrix_ratio_x:
|
|
165
|
+
phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', True, A, B, C, D) if normalize else 0
|
|
166
|
+
vmatrix = 1 - phit
|
|
167
|
+
vsand.append(((-projlithofrac / sandsiltfrac) + 1) * vmatrix)
|
|
168
|
+
vsilt.append(siltclayratio / sandsiltfrac * projlithofrac * vmatrix)
|
|
169
|
+
vcld.append(((1 - siltclayratio) / sandsiltfrac * projlithofrac) * vmatrix)
|
|
170
|
+
else:
|
|
171
|
+
phit = neu_den_xplot_poro_pt(point[0], point[1], 'ssc', False, A, B, C, D) if normalize else 0
|
|
172
|
+
vmatrix = 1 - phit
|
|
173
|
+
vsand.append(0)
|
|
174
|
+
vsilt.append((-siltclayratio / claysiltfrac * projlithofrac + (
|
|
175
|
+
rocklithofrac * siltclayratio / claysiltfrac)) * vmatrix)
|
|
176
|
+
vcld.append((siltclayratio / claysiltfrac * projlithofrac + (
|
|
177
|
+
1 - (siltclayratio * rocklithofrac / claysiltfrac))) * vmatrix)
|
|
178
|
+
|
|
179
|
+
return vsand, vsilt, vcld
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class SandShale:
|
|
183
|
+
"""This binary model only consider a combination of sand-shale components. """
|
|
184
|
+
|
|
185
|
+
def __init__(self, dry_sand_point: tuple = None, dry_clay_point: tuple = None,
|
|
186
|
+
fluid_point: tuple = None, wet_clay_point: tuple = None, silt_line_angle: float = None):
|
|
187
|
+
# Initialize the endpoints
|
|
188
|
+
self.dry_sand_point = dry_sand_point or Config.SSC_ENDPOINTS["DRY_SAND_POINT"]
|
|
189
|
+
self.dry_clay_point = dry_clay_point or Config.SSC_ENDPOINTS["DRY_CLAY_POINT"]
|
|
190
|
+
self.fluid_point = fluid_point or Config.SSC_ENDPOINTS["FLUID_POINT"]
|
|
191
|
+
self.wet_clay_point = wet_clay_point or Config.SSC_ENDPOINTS["WET_CLAY_POINT"]
|
|
192
|
+
self.silt_line_angle = silt_line_angle or Config.SSC_ENDPOINTS["SILT_LINE_ANGLE"]
|
|
193
|
+
|
|
194
|
+
def estimate_lithology(self, nphi, rhob, xplot: bool = False):
|
|
195
|
+
"""Estimate lithology volumetrics based on neutron density cross plot.
|
|
196
|
+
|
|
197
|
+
Args:
|
|
198
|
+
nphi (float): Neutron Porosity log in v/v
|
|
199
|
+
rhob (float): Bulk Density log in g/cc
|
|
200
|
+
xplot (bool, optional): To plot Neutron Density cross plot. Defaults to False.
|
|
201
|
+
|
|
202
|
+
Returns:
|
|
203
|
+
(float, float): vsand, vcld, cross-plot if xplot True else None
|
|
204
|
+
"""
|
|
205
|
+
# Initialize the endpoints
|
|
206
|
+
A = self.dry_sand_point
|
|
207
|
+
C = self.dry_clay_point
|
|
208
|
+
D = self.fluid_point
|
|
209
|
+
|
|
210
|
+
# Redefine wetclay point
|
|
211
|
+
_, rhob_max_line = min_max_line(rhob, 0.05)
|
|
212
|
+
_, nphi_max_line = min_max_line(nphi, 0.05)
|
|
213
|
+
wetclay_RHOB = np.min(rhob_max_line)
|
|
214
|
+
wetclay_NPHI = np.max(nphi_max_line)
|
|
215
|
+
if not all(self.wet_clay_point):
|
|
216
|
+
self.wet_clay_point = (wetclay_NPHI, wetclay_RHOB)
|
|
217
|
+
# print(f'#### wet_clay_point: {wet_clay_point}')
|
|
218
|
+
|
|
219
|
+
# Define dryclay point
|
|
220
|
+
if not all(C):
|
|
221
|
+
m = (D[1] - self.wet_clay_point[1]) / (D[0] - self.wet_clay_point[0])
|
|
222
|
+
dryclay_NPHI = ((C[1] - D[1]) / m) + D[0]
|
|
223
|
+
C = self.dry_clay_point = (dryclay_NPHI, C[1])
|
|
224
|
+
# print(f'#### dryclay_pt: {C}, {m}')
|
|
225
|
+
|
|
226
|
+
vsand, vcld = self.lithology_fraction(nphi, rhob)
|
|
227
|
+
|
|
228
|
+
if xplot:
|
|
229
|
+
fig = neutron_density_xplot(nphi, rhob, A, (0, 0), C, D, self.wet_clay_point)
|
|
230
|
+
return vsand, vcld, fig
|
|
231
|
+
else:
|
|
232
|
+
return vsand, vcld, None
|
|
233
|
+
|
|
234
|
+
def lithology_fraction(self, nphi, rhob):
|
|
235
|
+
"""Estimate sand and shale based on neutron density cross plot.
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
nphi (float): Neutron Porosity log in v/v
|
|
239
|
+
rhob (float): Bulk Density log in g/cc
|
|
240
|
+
|
|
241
|
+
Returns:
|
|
242
|
+
(float, float): vsand, vcld
|
|
243
|
+
"""
|
|
244
|
+
A = self.dry_sand_point
|
|
245
|
+
C = self.dry_clay_point
|
|
246
|
+
D = self.fluid_point
|
|
247
|
+
E = list(zip(nphi, rhob))
|
|
248
|
+
rocklithofrac = length_a_b(A, C)
|
|
249
|
+
|
|
250
|
+
vsand = []
|
|
251
|
+
vcld = []
|
|
252
|
+
for i, point in enumerate(E):
|
|
253
|
+
var_pt = line_intersection((A, C), (D, point))
|
|
254
|
+
projlithofrac = length_a_b(var_pt, A)
|
|
255
|
+
vshale = projlithofrac / rocklithofrac
|
|
256
|
+
|
|
257
|
+
phit = neu_den_xplot_poro_pt(point[0], point[1], 'ss', None, A, (0, 0), C, D)
|
|
258
|
+
vmatrix = 1 - phit
|
|
259
|
+
vsand.append((1 - vshale) * vmatrix)
|
|
260
|
+
vcld.append(vshale * vmatrix)
|
|
261
|
+
|
|
262
|
+
return vsand, vcld
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class MultiMineral():
|
|
266
|
+
"""This multi-mineral model utilizes optimization method to determine each mineral components."""
|
|
267
|
+
|
|
268
|
+
def estimate_lithology(self, gr, nphi, rhob):
|
|
269
|
+
"""Modified from https://github.com/ruben-charles/petrophysical_evaluation_optimization_methods.git
|
|
270
|
+
This module only takes in gr, nphi and rhob to estimate the volumetric of quartz, calcite, dolomite and shale.
|
|
271
|
+
|
|
272
|
+
Args:
|
|
273
|
+
gr (float): Gamma Ray log in GAPI.
|
|
274
|
+
nphi (float): Neutron Porosity log in v/v.
|
|
275
|
+
rhob (float): Bulk Density log in g/cc.
|
|
276
|
+
|
|
277
|
+
Returns:
|
|
278
|
+
(float, float, float, float, float): vol_quartz, vol_calcite, vol_dolomite, vol_shale, vol_mud
|
|
279
|
+
"""
|
|
280
|
+
# Getting default values from Config which may need to be changed based on the dataset
|
|
281
|
+
responses = Config.MINERALS_LOG_VALUE
|
|
282
|
+
|
|
283
|
+
def error_recon(volumes, *args):
|
|
284
|
+
vol_quartz, vol_calcite, vol_dolomite, vol_shale, vol_mud = volumes
|
|
285
|
+
GR, NPHI, RHOB = args
|
|
286
|
+
GR_RECON = vol_quartz*responses["GR_QUARTZ"] + vol_calcite*responses["GR_CALCITE"] + \
|
|
287
|
+
vol_dolomite*responses["GR_DOLOMITE"] + vol_shale*responses["GR_SH"] + vol_mud*responses["GR_MUD"]
|
|
288
|
+
NPHI_RECON = vol_quartz*responses["NPHI_QUARTZ"] + vol_calcite*responses["NPHI_CALCITE"] + \
|
|
289
|
+
vol_dolomite*responses["NPHI_DOLOMITE"] + vol_shale*responses["NPHI_SH"] + vol_mud*responses["NPHI_MUD"]
|
|
290
|
+
RHOB_RECON = vol_quartz*responses["RHOB_QUARTZ"] + vol_calcite*responses["RHOB_CALCITE"] + \
|
|
291
|
+
vol_dolomite*responses["RHOB_DOLOMITE"] + vol_shale*responses["RHOB_SH"] + vol_mud*responses["RHOB_MUD"]
|
|
292
|
+
|
|
293
|
+
# Some magic numbers to adjust the precision of differents magnitude orders (needs improvement)
|
|
294
|
+
return (GR - GR_RECON)**2 + (NPHI*300 - NPHI_RECON*300)**2 + (RHOB*100 - RHOB_RECON*100)**2
|
|
295
|
+
|
|
296
|
+
def constraint_(x):
|
|
297
|
+
return x[0] + x[1] + x[2] + x[3] + x[4] - 1
|
|
298
|
+
|
|
299
|
+
constrains = [{"type": "eq", "fun": constraint_}]
|
|
300
|
+
|
|
301
|
+
# Mineral volume bounds (quartz, calcite, dolomite, shale, mud)
|
|
302
|
+
bounds = ((0, 1), (0, 1), (0, 0.1), (0, 1), (0, 0.45))
|
|
303
|
+
|
|
304
|
+
vol_quartz = []
|
|
305
|
+
vol_calcite = []
|
|
306
|
+
vol_dolomite = []
|
|
307
|
+
vol_shale = []
|
|
308
|
+
vol_mud = []
|
|
309
|
+
for i, input in enumerate(zip(gr, nphi, rhob)):
|
|
310
|
+
res = minimize(error_recon, ((0, 0, 0, 0, 0)),
|
|
311
|
+
args=input, bounds=bounds, constraints=constrains)
|
|
312
|
+
vol_quartz.append(res.x[0])
|
|
313
|
+
vol_calcite.append(res.x[1])
|
|
314
|
+
vol_dolomite.append(res.x[2])
|
|
315
|
+
vol_shale.append(res.x[3])
|
|
316
|
+
vol_mud.append(res.x[4])
|
|
317
|
+
|
|
318
|
+
return vol_quartz, vol_calcite, vol_dolomite, vol_shale, vol_mud
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def shale_volume_larinov_tertiary(igr):
|
|
322
|
+
"""
|
|
323
|
+
Computes shale volume from gamma ray using Larinov's method for tertiary rocks.
|
|
324
|
+
|
|
325
|
+
Parameters
|
|
326
|
+
----------
|
|
327
|
+
igr : float
|
|
328
|
+
Interval gamma ray [API].
|
|
329
|
+
|
|
330
|
+
Returns
|
|
331
|
+
-------
|
|
332
|
+
vshale : float
|
|
333
|
+
Shale volume [fraction].
|
|
334
|
+
|
|
335
|
+
"""
|
|
336
|
+
return 0.083 * (2**(3.7 * igr) - 1)
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def shale_volume_larinov_older(igr):
|
|
340
|
+
"""
|
|
341
|
+
Computes shale volume from gamma ray using Larinov's method for older rocks.
|
|
342
|
+
|
|
343
|
+
Parameters
|
|
344
|
+
----------
|
|
345
|
+
igr : float
|
|
346
|
+
Interval gamma ray [API].
|
|
347
|
+
|
|
348
|
+
Returns
|
|
349
|
+
-------
|
|
350
|
+
vshale : float
|
|
351
|
+
Shale volume [fraction].
|
|
352
|
+
|
|
353
|
+
"""
|
|
354
|
+
return 0.33 * (2**(2 * igr) - 1)
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
def shale_volume_steiber(igr):
|
|
358
|
+
"""
|
|
359
|
+
Computes shale volume from gamma ray using Steiber's method.
|
|
360
|
+
|
|
361
|
+
Parameters
|
|
362
|
+
----------
|
|
363
|
+
igr : float
|
|
364
|
+
Interval gamma ray [API].
|
|
365
|
+
|
|
366
|
+
Returns
|
|
367
|
+
-------
|
|
368
|
+
vshale : float
|
|
369
|
+
Shale volume [fraction].
|
|
370
|
+
|
|
371
|
+
"""
|
|
372
|
+
return igr / (3 - 2 * igr)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
def gr_index(gr):
|
|
376
|
+
"""
|
|
377
|
+
Computes gamma ray index from gamma ray.
|
|
378
|
+
|
|
379
|
+
Parameters
|
|
380
|
+
----------
|
|
381
|
+
gr : float
|
|
382
|
+
Gamma ray [API].
|
|
383
|
+
|
|
384
|
+
Returns
|
|
385
|
+
-------
|
|
386
|
+
gr_index : float
|
|
387
|
+
Gamma ray index [API].
|
|
388
|
+
|
|
389
|
+
"""
|
|
390
|
+
gr = np.where(np.isnan(gr), np.min(gr), gr)
|
|
391
|
+
dtr_gr = detrend(gr, axis=0) + statistics.mean(gr)
|
|
392
|
+
scaler = MinMaxScaler()
|
|
393
|
+
igr = scaler.fit_transform(dtr_gr.reshape(-1, 1))
|
|
394
|
+
return igr
|