quick-pp 0.2.74__tar.gz → 0.2.76__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.74 → quick_pp-0.2.76}/PKG-INFO +1 -1
- {quick_pp-0.2.74 → quick_pp-0.2.76}/pyproject.toml +1 -1
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/__init__.py +1 -1
- quick_pp-0.2.76/quick_pp/cli.py +175 -0
- quick_pp-0.2.76/quick_pp/config.py +233 -0
- quick_pp-0.2.76/quick_pp/core_calibration.py +1221 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/db_connector.py +4 -2
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/models.py +76 -28
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/objects.py +310 -61
- quick_pp-0.2.76/quick_pp/fluid_type.py +230 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/las_handler.py +155 -108
- quick_pp-0.2.76/quick_pp/lithology/carbonate.py +274 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/lithology/multi_mineral.py +218 -146
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/lithology/sand_shale.py +41 -17
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/lithology/sand_silt_clay.py +56 -29
- quick_pp-0.2.76/quick_pp/lithology/thin_beds.py +337 -0
- quick_pp-0.2.76/quick_pp/machine_learning/config.py +93 -0
- quick_pp-0.2.76/quick_pp/machine_learning/feature_engineering.py +266 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/machine_learning/predict_pipeline.py +55 -31
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/machine_learning/train_pipeline.py +63 -38
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/machine_learning/utils.py +40 -24
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/permeability.py +60 -42
- quick_pp-0.2.76/quick_pp/plotter/plotter.py +386 -0
- quick_pp-0.2.76/quick_pp/plotter/well_log.py +448 -0
- quick_pp-0.2.76/quick_pp/plotter/well_log_config.py +907 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/porosity.py +165 -104
- quick_pp-0.2.76/quick_pp/qaqc.py +557 -0
- quick_pp-0.2.76/quick_pp/ressum.py +709 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/rock_physics/geomechanics.py +198 -136
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/rock_physics/geophysics.py +234 -156
- quick_pp-0.2.76/quick_pp/rock_physics/rpm.py +408 -0
- quick_pp-0.2.76/quick_pp/rock_type.py +850 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/saturation.py +274 -216
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/utils.py +134 -85
- quick_pp-0.2.74/quick_pp/cli.py +0 -120
- quick_pp-0.2.74/quick_pp/config.py +0 -126
- quick_pp-0.2.74/quick_pp/core_calibration.py +0 -622
- quick_pp-0.2.74/quick_pp/fluid_type.py +0 -179
- quick_pp-0.2.74/quick_pp/lithology/carbonate.py +0 -216
- quick_pp-0.2.74/quick_pp/lithology/thin_beds.py +0 -273
- quick_pp-0.2.74/quick_pp/machine_learning/config.py +0 -72
- quick_pp-0.2.74/quick_pp/machine_learning/feature_engineering.py +0 -159
- quick_pp-0.2.74/quick_pp/plotter/plotter.py +0 -301
- quick_pp-0.2.74/quick_pp/plotter/well_log.py +0 -364
- quick_pp-0.2.74/quick_pp/plotter/well_log_config.py +0 -522
- quick_pp-0.2.74/quick_pp/qaqc.py +0 -441
- quick_pp-0.2.74/quick_pp/ressum.py +0 -495
- quick_pp-0.2.74/quick_pp/rock_physics/rpm.py +0 -376
- quick_pp-0.2.74/quick_pp/rock_type.py +0 -558
- {quick_pp-0.2.74 → quick_pp-0.2.76}/.gitignore +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/LICENSE +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/README.md +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/exceptions.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/main.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/mlflow_model_deployment.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/router.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/lithology_ssc.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/permeability_choo.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/permeability_others.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/porosity.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/ressum.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_archie.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_b.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_qv.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_rw.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/chat.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/las_handler.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/lithology.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/permeability.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/porosity.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/reservoir_summary.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/services/saturation.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/static/favicon.ico +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/static/logo.png +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/template/chat.html +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/api/template/home.html +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/setup_postgresql_db.sql +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/database/setup_sqlite_db.sql +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/lithology/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/machine_learning/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/plotter/__init__.py +0 -0
- {quick_pp-0.2.74 → quick_pp-0.2.76}/quick_pp/rock_physics/__init__.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.76
|
|
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>
|
|
@@ -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.76" # Need to be updated manually when releasing a new version/ change in pyproject.toml
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Command-Line Interface for the quick_pp library.
|
|
3
|
+
|
|
4
|
+
This script provides a set of commands to interact with the various components
|
|
5
|
+
of the quick_pp application, including running the web app, managing MLflow
|
|
6
|
+
servers, and executing machine learning training and prediction pipelines.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
import os
|
|
11
|
+
import shutil
|
|
12
|
+
import socket
|
|
13
|
+
import sys
|
|
14
|
+
from importlib import metadata, resources
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
from subprocess import Popen
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
quick_ppVersion = metadata.version("quick_pp")
|
|
21
|
+
except metadata.PackageNotFoundError:
|
|
22
|
+
quick_ppVersion = "0.0.0"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def is_server_running(host, port):
|
|
26
|
+
"""Check if a server is running on the specified host and port.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
host (str): The hostname or IP address of the server.
|
|
30
|
+
port (int): The port number of the server.
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
bool: True if the server is accessible, False otherwise.
|
|
34
|
+
"""
|
|
35
|
+
try:
|
|
36
|
+
with socket.create_connection((host, port), timeout=2):
|
|
37
|
+
return True
|
|
38
|
+
except Exception:
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@click.group()
|
|
43
|
+
@click.version_option(
|
|
44
|
+
prog_name="quick_pp",
|
|
45
|
+
version=quick_ppVersion,
|
|
46
|
+
message="%(prog)s version: %(version)s",
|
|
47
|
+
)
|
|
48
|
+
def cli():
|
|
49
|
+
"""
|
|
50
|
+
Command-line interface for the quick_pp library.
|
|
51
|
+
|
|
52
|
+
Provides commands to run the web application, manage MLflow servers,
|
|
53
|
+
and execute machine learning pipelines for training and prediction.
|
|
54
|
+
"""
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@click.command()
|
|
59
|
+
@click.option("--debug", is_flag=True)
|
|
60
|
+
def app(debug):
|
|
61
|
+
"""Start the quick_pp web application.
|
|
62
|
+
|
|
63
|
+
This launches a Uvicorn server to run the FastAPI backend and the associated qpp assistant module.
|
|
64
|
+
The --debug flag enables auto-reload for development."""
|
|
65
|
+
if not is_server_running("localhost", 8888):
|
|
66
|
+
reload_ = "--reload" if debug else ""
|
|
67
|
+
cmd = f"uvicorn quick_pp.api.main:app --host 0.0.0.0 --port 8888 {reload_}"
|
|
68
|
+
click.echo(f"App is not running. Starting it now... | {cmd}")
|
|
69
|
+
process = Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, shell=True)
|
|
70
|
+
process.wait()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@click.command()
|
|
74
|
+
@click.argument("env", default="local", type=click.Choice(["local", "remote"]))
|
|
75
|
+
def mlflow_server(env):
|
|
76
|
+
"""Start the MLflow tracking server.
|
|
77
|
+
|
|
78
|
+
This command can launch a local server or is intended to be used with a
|
|
79
|
+
pre-configured remote server based on the 'env' argument.
|
|
80
|
+
"""
|
|
81
|
+
from quick_pp.machine_learning.utils import run_mlflow_server
|
|
82
|
+
|
|
83
|
+
run_mlflow_server(env)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@click.command()
|
|
87
|
+
@click.option("--debug", is_flag=True)
|
|
88
|
+
def model_deployment(debug):
|
|
89
|
+
"""Run the MLflow model deployment."""
|
|
90
|
+
"""Serve the latest registered MLflow models via a FastAPI endpoint.
|
|
91
|
+
|
|
92
|
+
This makes the trained models available for prediction over a REST API.
|
|
93
|
+
The --debug flag enables auto-reload for development."""
|
|
94
|
+
if not is_server_running("localhost", 5555):
|
|
95
|
+
reload_ = "--reload" if debug else ""
|
|
96
|
+
cmd = f"uvicorn quick_pp.api.mlflow_model_deployment:app --host 0.0.0.0 --port 5555 {reload_}"
|
|
97
|
+
click.echo(f"Model server is not running. Starting it now... | {cmd}")
|
|
98
|
+
process = Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, shell=True)
|
|
99
|
+
process.wait()
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@click.command()
|
|
103
|
+
@click.argument("model_config", required=True, type=click.STRING)
|
|
104
|
+
@click.argument("data_hash", required=True, type=click.STRING)
|
|
105
|
+
@click.argument("env", default="local", type=click.Choice(["local", "remote"]))
|
|
106
|
+
def train(model_config, data_hash, env):
|
|
107
|
+
"""Execute the model training pipeline.
|
|
108
|
+
|
|
109
|
+
This command automates the process of training, evaluating, and logging models
|
|
110
|
+
as defined in the configuration. It sets up the necessary environment by copying
|
|
111
|
+
default configuration and data files if they don't exist, then starts the training
|
|
112
|
+
process using MLflow for experiment tracking.
|
|
113
|
+
|
|
114
|
+
MODEL_CONFIG: The key for the modelling suite (e.g., 'clastic', 'carbonate').
|
|
115
|
+
DATA_HASH: The unique hash identifying the input data file for training.
|
|
116
|
+
ENV: The MLflow environment ('local' or 'remote').
|
|
117
|
+
"""
|
|
118
|
+
from quick_pp.machine_learning.train_pipeline import train_pipeline
|
|
119
|
+
|
|
120
|
+
# Set up the environment by copying default config and data if they don't exist.
|
|
121
|
+
# This allows users to customize them easily.
|
|
122
|
+
config_file = resources.files("quick_pp.machine_learning").joinpath("config.py")
|
|
123
|
+
root_config_file = Path(os.getcwd(), "config.py")
|
|
124
|
+
if os.path.exists(config_file) and not os.path.exists(root_config_file):
|
|
125
|
+
shutil.copyfile(config_file, root_config_file)
|
|
126
|
+
click.echo(f"Copied {config_file} to {root_config_file}")
|
|
127
|
+
|
|
128
|
+
# Copy mock_data.parquet into data/input if it doesn't exist
|
|
129
|
+
mock_file = resources.files("quick_pp.machine_learning.mock_data").joinpath(
|
|
130
|
+
"mock_data.parquet"
|
|
131
|
+
)
|
|
132
|
+
data_dir = Path(os.getcwd(), "data", "input")
|
|
133
|
+
os.makedirs(data_dir, exist_ok=True)
|
|
134
|
+
root_mock_file = Path(data_dir, "mock_data.parquet")
|
|
135
|
+
if os.path.exists(mock_file) and not os.path.exists(root_mock_file):
|
|
136
|
+
shutil.copyfile(mock_file, root_mock_file)
|
|
137
|
+
click.echo(f"Copied {mock_file} to {root_mock_file}")
|
|
138
|
+
|
|
139
|
+
click.echo(f"Training {model_config} model with data hash {data_hash}")
|
|
140
|
+
train_pipeline(model_config, data_hash, env)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@click.command()
|
|
144
|
+
@click.argument("model_config", required=True, type=click.STRING)
|
|
145
|
+
@click.argument("data_hash", required=True, type=click.STRING)
|
|
146
|
+
@click.argument("output_file_name", required=False, default="test", type=click.STRING)
|
|
147
|
+
@click.argument("env", default="local", type=click.Choice(["local", "remote"]))
|
|
148
|
+
@click.option("--plot", is_flag=True, help="Generate and save plots for predictions.")
|
|
149
|
+
def predict(model_config, data_hash, output_file_name, env, plot):
|
|
150
|
+
"""Run the prediction pipeline using the latest registered models.
|
|
151
|
+
|
|
152
|
+
This command loads data, fetches the appropriate trained models from the MLflow
|
|
153
|
+
registry, runs predictions, post-processes the results, and saves the output.
|
|
154
|
+
|
|
155
|
+
MODEL_CONFIG: The key for the modelling suite whose models will be used.
|
|
156
|
+
DATA_HASH: The unique hash identifying the input data file for prediction.
|
|
157
|
+
OUTPUT_FILE_NAME: The base name for the output predictions file.
|
|
158
|
+
ENV: The MLflow environment ('local' or 'remote').
|
|
159
|
+
"""
|
|
160
|
+
from quick_pp.machine_learning.predict_pipeline import predict_pipeline
|
|
161
|
+
|
|
162
|
+
click.echo("Running prediction...")
|
|
163
|
+
predict_pipeline(model_config, data_hash, output_file_name, env, plot)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
# Add commands to the CLI group
|
|
167
|
+
cli.add_command(app)
|
|
168
|
+
cli.add_command(mlflow_server)
|
|
169
|
+
cli.add_command(model_deployment)
|
|
170
|
+
cli.add_command(train)
|
|
171
|
+
cli.add_command(predict)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if __name__ == "__main__":
|
|
175
|
+
cli()
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Centralized configuration for the quick_pp library.
|
|
3
|
+
|
|
4
|
+
This module defines the `Config` class, which serves as a namespace for
|
|
5
|
+
storing static configuration data used across various modules. This includes
|
|
6
|
+
default petrophysical parameters, rock physics model endpoints, and mappings.
|
|
7
|
+
|
|
8
|
+
Centralizing configuration here allows for easier management and modification
|
|
9
|
+
of default values without altering the core logic of the functions.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Config:
|
|
14
|
+
"""A class to hold static configuration data for the quick_pp library."""
|
|
15
|
+
|
|
16
|
+
# Default cutoffs for reservoir summary calculations
|
|
17
|
+
RESSUM_CUTOFFS = dict(VSHALE=0.4, PHIT=0.05, SWT=0.95)
|
|
18
|
+
|
|
19
|
+
# Defines properties for common well log variables, including names, units, and typical ranges.
|
|
20
|
+
VARS = dict(
|
|
21
|
+
GR=dict(name="Gamma Ray", unit="GAPI", min=0, max=200),
|
|
22
|
+
RT=dict(name="True Resistivity", unit="ohm.m", min=0, max=2000),
|
|
23
|
+
NPHI=dict(name="Neutron Porosity", unit="v/v", min=-0.05, max=1.0),
|
|
24
|
+
RHOB=dict(name="Bulk Density", unit="g/cc", min=1.0, max=3.0),
|
|
25
|
+
PEF=dict(name="Peak Frequency", unit="Hz", min=0, max=10),
|
|
26
|
+
DTC=dict(name="DTC", unit="us/ft", min=20, max=260),
|
|
27
|
+
DTS=dict(name="DTS", unit="us/ft", min=20, max=260),
|
|
28
|
+
VSAND=dict(name="Sand Volume", unit="v/v", min=0, max=1),
|
|
29
|
+
VSILT=dict(name="Silt Volume", unit="v/v", min=0, max=1),
|
|
30
|
+
VCLAY=dict(name="Clay Volume", unit="v/v", min=0, max=1),
|
|
31
|
+
VSHALE=dict(name="Shale Volume", unit="v/v", min=0, max=1),
|
|
32
|
+
PHIT=dict(name="Total Porosity", unit="v/v", min=0, max=0.5),
|
|
33
|
+
PHIE=dict(name="Effective Porosity", unit="v/v", min=0, max=0.5),
|
|
34
|
+
SWT=dict(vname="Total Water Saturation", unit="v/v", min=0, max=1),
|
|
35
|
+
SWE=dict(vname="Effective Water Saturation", unit="v/v", min=0, max=1),
|
|
36
|
+
PERM=dict(name="Permeability", unit="mD", min=0.01, max=100000),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Default endpoints for the Sand-Silt-Clay lithology model.
|
|
40
|
+
SSC_ENDPOINTS = dict(
|
|
41
|
+
FLUID_POINT=(1.0, 1.0),
|
|
42
|
+
DRY_SAND_POINT=(-0.02, 2.65),
|
|
43
|
+
DRY_SILT_POINT=(None, 2.68), # None means it will be calculated
|
|
44
|
+
DRY_CLAY_POINT=(None, 2.71), # None means it will be calculated
|
|
45
|
+
WET_CLAY_POINT=(None, None), # None means it will be calculated
|
|
46
|
+
SILT_LINE_ANGLE=119, # Deg angle from horizontal
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# Default endpoints for the Thin-Beds lithology model.
|
|
50
|
+
TS_ENDPOINTS = dict(
|
|
51
|
+
FLUID_POINT=(1.0, 1.0),
|
|
52
|
+
DRY_SAND_POINT=(-0.02, 2.65),
|
|
53
|
+
DRY_SHALE_POINT=(0.44, 2.71),
|
|
54
|
+
DRY_SAND_PORO=0.26,
|
|
55
|
+
DRY_SHALE_PORO=0.1,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
# Default endpoints for the Carbonate Neutron-Density crossplot model.
|
|
59
|
+
CARB_NEU_DEN_ENDPOINTS = dict(
|
|
60
|
+
FLUID_POINT=(1.0, 1.0),
|
|
61
|
+
DRY_CALC_POINT=(0.0, 2.71),
|
|
62
|
+
DRY_DOLO_POINT=(0.01, 2.87),
|
|
63
|
+
DRY_CLAY_POINT=(0.24, 2.78),
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
# Default endpoints for the Carbonate Density-PEF crossplot model.
|
|
67
|
+
CARB_DEN_PEF_ENDPOINTS = dict(
|
|
68
|
+
FLUID_POINT=(1.0, 1.0),
|
|
69
|
+
DRY_CALC_POINT=(5.08, 2.71),
|
|
70
|
+
DRY_DOLO_POINT=(3.14, 2.87),
|
|
71
|
+
DRY_CLAY_POINT=(2.2, 2.78),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Typical log responses for various pure minerals.
|
|
75
|
+
MINERALS_LOG_VALUE = {
|
|
76
|
+
"QUARTZ": {"GR": 0.0, "NPHI": -0.02, "RHOB": 2.64, "DTC": 52.9, "PEF": 1.8},
|
|
77
|
+
"CALCITE": {"GR": 0.0, "NPHI": 0.0, "RHOB": 2.71, "DTC": 49.7, "PEF": 5.1},
|
|
78
|
+
"DOLOMITE": {"GR": 0.0, "NPHI": 0.01, "RHOB": 2.85, "DTC": 43.5, "PEF": 3.1},
|
|
79
|
+
"SHALE": {"GR": 150.0, "NPHI": 0.30, "RHOB": 2.55, "DTC": 120.0, "PEF": 3.5},
|
|
80
|
+
"KAOLINITE": {"GR": 35.0, "NPHI": 0.37, "RHOB": 2.41, "DTC": 143.0, "PEF": 1.8},
|
|
81
|
+
"FELDSPAR": {"GR": 150.0, "NPHI": 0.02, "RHOB": 2.56, "DTC": 70.0, "PEF": 3.1},
|
|
82
|
+
"ANHYDRITE": {"GR": 0.0, "NPHI": -0.02, "RHOB": 2.98, "DTC": 50.0, "PEF": 5.1},
|
|
83
|
+
"GYPSUM": {"GR": 0.0, "NPHI": 0.6, "RHOB": 2.35, "DTC": 52.0, "PEF": 4.0},
|
|
84
|
+
"HALITE": {"GR": 0.0, "NPHI": -0.03, "RHOB": 2.04, "DTC": 67.0, "PEF": 4.7},
|
|
85
|
+
"PYRITE": {"GR": 0.0, "NPHI": -0.02, "RHOB": 5.0, "DTC": 65.0, "PEF": 17.0},
|
|
86
|
+
"COAL": {"GR": 30.0, "NPHI": 0.50, "RHOB": 1.3, "DTC": 150.0, "PEF": 0.2},
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
# Maps mineral names to their corresponding volume curve mnemonics (e.g., QUARTZ -> VSAND).
|
|
90
|
+
MINERALS_NAME_MAPPING = {
|
|
91
|
+
"QUARTZ": "VSAND",
|
|
92
|
+
"CALCITE": "VCALC",
|
|
93
|
+
"DOLOMITE": "VDOLO",
|
|
94
|
+
"SHALE": "VCLAY",
|
|
95
|
+
"KAOLINITE": "VKAOL",
|
|
96
|
+
"FELDSPAR": "VFELD",
|
|
97
|
+
"ANHYDRITE": "VANHY",
|
|
98
|
+
"GYPSUM": "VGYPS",
|
|
99
|
+
"HALITE": "VHALI",
|
|
100
|
+
"PYRITE": "VPYRI",
|
|
101
|
+
"COAL": "VCOAL",
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
# Elastic and density properties for minerals and fluids used in geomechanics and rock physics.
|
|
105
|
+
GEOMECHANICS_VALUE = dict(
|
|
106
|
+
# Quartz
|
|
107
|
+
RHOB_QUARTZ=2.65,
|
|
108
|
+
K_QUARTZ=36.6,
|
|
109
|
+
G_QUARTZ=45.0,
|
|
110
|
+
# Shale
|
|
111
|
+
RHOB_SHALE=2.7,
|
|
112
|
+
K_SHALE=21.0,
|
|
113
|
+
G_SHALE=7.0,
|
|
114
|
+
# Calcite
|
|
115
|
+
RHOB_CALCITE=2.71,
|
|
116
|
+
K_CALCITE=75.0,
|
|
117
|
+
G_CALCITE=30.0,
|
|
118
|
+
# Dolomite
|
|
119
|
+
RHOB_DOLOMITE=2.85,
|
|
120
|
+
K_DOLOMITE=100.0,
|
|
121
|
+
G_DOLOMITE=40.0,
|
|
122
|
+
# Cement
|
|
123
|
+
RHOB_CEMENT=2.65,
|
|
124
|
+
K_CEMENT=37.0,
|
|
125
|
+
G_CEMENT=45.0,
|
|
126
|
+
# Brine
|
|
127
|
+
RHOB_BRINE=1.0,
|
|
128
|
+
K_BRINE=2.5,
|
|
129
|
+
# Oil
|
|
130
|
+
RHOB_OIL=0.8,
|
|
131
|
+
K_OIL=1.5,
|
|
132
|
+
# Gas
|
|
133
|
+
RHOB_GAS=0.2,
|
|
134
|
+
K_GAS=0.06,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# A dictionary of common geological abbreviations and their expanded forms.
|
|
138
|
+
# This can be expanded with more terms as needed.
|
|
139
|
+
CORE_GEO_ABBREVIATIONS = {
|
|
140
|
+
"ss": "sandstone",
|
|
141
|
+
"sh": "shale",
|
|
142
|
+
"ls": "limestone",
|
|
143
|
+
"dol": "dolomite",
|
|
144
|
+
"cgl": "conglomerate",
|
|
145
|
+
"gr": "grained",
|
|
146
|
+
"crs": "coarse",
|
|
147
|
+
"med": "medium",
|
|
148
|
+
"f": "fine",
|
|
149
|
+
"fg": "fine grain",
|
|
150
|
+
"vf": "very fine",
|
|
151
|
+
"sl": "slightly",
|
|
152
|
+
"spar": "sparry",
|
|
153
|
+
"cmt": "cemented",
|
|
154
|
+
"lam": "laminated",
|
|
155
|
+
"xbed": "cross-bedded",
|
|
156
|
+
"bioturb": "bioturbated",
|
|
157
|
+
"arg": "argillaceous",
|
|
158
|
+
"calc": "calcareous",
|
|
159
|
+
"calcar": "calcareous",
|
|
160
|
+
"calclut": "calcilutite",
|
|
161
|
+
"lut": "lutite",
|
|
162
|
+
"carb": "carbonaceous",
|
|
163
|
+
"glauc": "glauconitic",
|
|
164
|
+
"pyr": "pyritic",
|
|
165
|
+
"gy": "grey",
|
|
166
|
+
"wh": "white",
|
|
167
|
+
"crm": "cream",
|
|
168
|
+
"shale": "shale",
|
|
169
|
+
"siltstone": "siltstone",
|
|
170
|
+
"stylolite": "stylolite",
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# Categories of geological terms (expanded form) used for structured naming.
|
|
174
|
+
# The order of keys in this dictionary determines the final name structure.
|
|
175
|
+
CORE_WORD_CATEGORIES = {
|
|
176
|
+
"FORMATION": [
|
|
177
|
+
"sandstone",
|
|
178
|
+
"shale",
|
|
179
|
+
"siltstone",
|
|
180
|
+
"limestone",
|
|
181
|
+
"dolomite",
|
|
182
|
+
"conglomerate",
|
|
183
|
+
"calcilutite",
|
|
184
|
+
"lutite",
|
|
185
|
+
],
|
|
186
|
+
"GRAIN_SIZE": [
|
|
187
|
+
"grained",
|
|
188
|
+
"coarse",
|
|
189
|
+
"medium",
|
|
190
|
+
"fine",
|
|
191
|
+
"very fine",
|
|
192
|
+
"rubble",
|
|
193
|
+
"sparry",
|
|
194
|
+
],
|
|
195
|
+
"MODIFIER": [
|
|
196
|
+
"slightly",
|
|
197
|
+
"laminated",
|
|
198
|
+
"cross-bedded",
|
|
199
|
+
"bioturbated",
|
|
200
|
+
"argillaceous",
|
|
201
|
+
"calcareous",
|
|
202
|
+
"carbonaceous",
|
|
203
|
+
"glauconitic",
|
|
204
|
+
"pyritic",
|
|
205
|
+
"cemented",
|
|
206
|
+
"stylolite",
|
|
207
|
+
],
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
# Define special case descriptions that should be handled directly, not clustered.
|
|
211
|
+
# The key is the phrase to search for (case-insensitive), and the value is the group name to assign.
|
|
212
|
+
CORE_SPECIAL_CASE_DESCRIPTIONS = {
|
|
213
|
+
"no plug possible": "NO_PLUG_POSSIBLE",
|
|
214
|
+
"fractured": "FRACTURED",
|
|
215
|
+
"preserved sample": "PRESERVED_SAMPLE",
|
|
216
|
+
"rubble": "RUBBLE",
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@staticmethod
|
|
220
|
+
def vars_units(data):
|
|
221
|
+
"""Return a dictionary of units for variables present in the DataFrame.
|
|
222
|
+
|
|
223
|
+
Args:
|
|
224
|
+
data (pd.DataFrame): The DataFrame whose columns will be checked.
|
|
225
|
+
|
|
226
|
+
Returns:
|
|
227
|
+
dict: A dictionary mapping variable names (mnemonics) to their units.
|
|
228
|
+
"""
|
|
229
|
+
return {
|
|
230
|
+
k: v["unit"]
|
|
231
|
+
for k, v in Config.VARS.items()
|
|
232
|
+
if k in data.columns and "unit" in v.keys()
|
|
233
|
+
}
|