quick-pp 0.2.5__tar.gz → 0.2.52__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.52/PKG-INFO +145 -0
- quick_pp-0.2.52/README.md +112 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/pyproject.toml +2 -1
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/__init__.py +1 -1
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/mlflow_model_deployment.py +0 -11
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/las_handler.py +0 -20
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/predict_pipeline.py +0 -22
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/train_pipeline.py +0 -16
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/plotter/plotter.py +8 -24
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/plotter/well_log.py +81 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/porosity.py +2 -4
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/rock_physics/rpm.py +70 -17
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/rock_type.py +1 -1
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/utils.py +2 -2
- quick_pp-0.2.5/AUTHORS.rst +0 -13
- quick_pp-0.2.5/PKG-INFO +0 -119
- quick_pp-0.2.5/README.md +0 -86
- {quick_pp-0.2.5 → quick_pp-0.2.52}/.gitignore +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/LICENSE +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/exceptions.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/main.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/router.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_ssc.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/permeability_choo.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/permeability_others.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/porosity.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/ressum.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_archie.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_b.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_qv.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_rw.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/chat.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/las_handler.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/lithology.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/permeability.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/porosity.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/reservoir_summary.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/services/saturation.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/static/favicon.ico +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/static/logo.png +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/template/chat.html +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/api/template/home.html +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/cli.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/config.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/core_calibration.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/fluid_type.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/carbonate.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/multi_mineral.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/sand_shale.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/sand_silt_clay.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/lithology/thin_beds.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/config.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/feature_engineering.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/machine_learning/utils.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/objects.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/permeability.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/plotter/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/plotter/well_log_config.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/plotter/xplots.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/qaqc.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/ressum.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/rock_physics/__init__.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/rock_physics/geomechanics.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/rock_physics/geophysics.py +0 -0
- {quick_pp-0.2.5 → quick_pp-0.2.52}/quick_pp/saturation.py +0 -0
quick_pp-0.2.52/PKG-INFO
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quick-pp
|
|
3
|
+
Version: 0.2.52
|
|
4
|
+
Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
|
|
5
|
+
Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
|
|
6
|
+
Author-email: Imran Fadhil <imranfadhil@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: analysis,geoscience,log,petrophysics,quick_pp,well
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Natural Language :: English
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Requires-Dist: click>=7.0
|
|
17
|
+
Requires-Dist: fastapi
|
|
18
|
+
Requires-Dist: loguru
|
|
19
|
+
Requires-Dist: matplotlib==3.8.0
|
|
20
|
+
Requires-Dist: mlflow
|
|
21
|
+
Requires-Dist: orjson
|
|
22
|
+
Requires-Dist: pandas
|
|
23
|
+
Requires-Dist: psycopg2-binary
|
|
24
|
+
Requires-Dist: ptitprince
|
|
25
|
+
Requires-Dist: python-multipart
|
|
26
|
+
Requires-Dist: ruptures
|
|
27
|
+
Requires-Dist: salib==1.5.1
|
|
28
|
+
Requires-Dist: scikit-learn
|
|
29
|
+
Requires-Dist: setuptools<81
|
|
30
|
+
Requires-Dist: statsmodels
|
|
31
|
+
Requires-Dist: welly
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# quick_pp
|
|
35
|
+
|
|
36
|
+
A Python package for quick-look preliminary petrophysical estimations.
|
|
37
|
+
|
|
38
|
+

|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
You can install `quick_pp` directly from PyPI:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install quick_pp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For development or to use the `qpp_assistant`, you'll need to clone the repository and install dependencies:
|
|
49
|
+
|
|
50
|
+
1. **Clone the repository:**
|
|
51
|
+
```bash
|
|
52
|
+
git clone https://github.com/imranfadhil/quick_pp.git
|
|
53
|
+
cd quick_pp
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
2. **Create and activate a virtual environment** (tested with Python 3.11):
|
|
57
|
+
```bash
|
|
58
|
+
uv venv --python 3.11
|
|
59
|
+
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
3. **Install the required packages:**
|
|
63
|
+
```bash
|
|
64
|
+
uv pip install -r requirements.txt
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
|
|
69
|
+
### Jupyter Notebook Examples
|
|
70
|
+
|
|
71
|
+
The included notebooks demonstrate the core functionalities:
|
|
72
|
+
|
|
73
|
+
- `01_data_handler`: Create a MOCK `qppp` project file.
|
|
74
|
+
- `02_EDA`: Perform a quick exploratory data analysis.
|
|
75
|
+
- `03_*`: Carry out petrophysical interpretation of the MOCK wells.
|
|
76
|
+
|
|
77
|
+
> **Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
|
|
78
|
+
|
|
79
|
+
### `qpp_assistant` Setup
|
|
80
|
+
|
|
81
|
+
To use the `qpp_assistant`, follow these steps after the development installation:
|
|
82
|
+
|
|
83
|
+
1. Specify the required credentials in a `.env` file (you can use `.env copy` as a template).
|
|
84
|
+
2. Run Docker Compose: `docker-compose up -d`.
|
|
85
|
+
3. Build your flow in Langflow at `http://localhost:7860`.
|
|
86
|
+
4. Run the main application: `python main.py app`.
|
|
87
|
+
5. Test your flow in the qpp Assistant at `http://localhost:8888/qpp_assistant`.
|
|
88
|
+
|
|
89
|
+
## CLI
|
|
90
|
+
|
|
91
|
+
### Train a Machine Learning Model
|
|
92
|
+
|
|
93
|
+
**Requirements:**
|
|
94
|
+
- The input data must be a Parquet file located at `/data/input/<data_hash>___.parquet`.
|
|
95
|
+
- The Parquet file must contain the input and target features as specified in `MODELLING_CONFIG` in `config.py`.
|
|
96
|
+
|
|
97
|
+
**Command:**
|
|
98
|
+
|
|
99
|
+
> quick_pp train <model_config> <data_hash>
|
|
100
|
+
|
|
101
|
+
quick_pp train mock mock
|
|
102
|
+
|
|
103
|
+
### Run the MLflow Server
|
|
104
|
+
|
|
105
|
+
**Command:**
|
|
106
|
+
```bash
|
|
107
|
+
quick_pp mlflow-server
|
|
108
|
+
```
|
|
109
|
+
You can access the MLflow UI at `http://localhost:5015`.
|
|
110
|
+
|
|
111
|
+
### Run Predictions
|
|
112
|
+
|
|
113
|
+
> **Note:** Trained models must be registered in MLflow before running predictions.
|
|
114
|
+
|
|
115
|
+
> quick_pp predict <model_config> <data_hash>
|
|
116
|
+
|
|
117
|
+
**Example:**
|
|
118
|
+
```bash
|
|
119
|
+
quick_pp predict mock mock
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Deploy Trained Models as an API
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
quick_pp model-deployment
|
|
126
|
+
```
|
|
127
|
+
You can access the deployed model's Swagger UI at `http://localhost:5555/docs`.
|
|
128
|
+
|
|
129
|
+
### Start the Main Application
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
quick_pp app
|
|
133
|
+
```
|
|
134
|
+
- **API Docs:** `http://localhost:8888/docs`
|
|
135
|
+
- **qpp_assistant:** `http://localhost:8888/qpp_assistant` (you can log in with any username and password).
|
|
136
|
+
|
|
137
|
+
To use the mcp tools, you would need to first add the following SSE URLS through the interface;
|
|
138
|
+
http://localhost:8888/mcp - quick_pp tools.
|
|
139
|
+
|
|
140
|
+
http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
|
|
141
|
+
|
|
142
|
+
## Documentation
|
|
143
|
+
|
|
144
|
+
Documentation is available at:
|
|
145
|
+
<https://quick-pp.readthedocs.io/en/latest/index.html>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# quick_pp
|
|
2
|
+
|
|
3
|
+
A Python package for quick-look preliminary petrophysical estimations.
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
You can install `quick_pp` directly from PyPI:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install quick_pp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
For development or to use the `qpp_assistant`, you'll need to clone the repository and install dependencies:
|
|
16
|
+
|
|
17
|
+
1. **Clone the repository:**
|
|
18
|
+
```bash
|
|
19
|
+
git clone https://github.com/imranfadhil/quick_pp.git
|
|
20
|
+
cd quick_pp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
2. **Create and activate a virtual environment** (tested with Python 3.11):
|
|
24
|
+
```bash
|
|
25
|
+
uv venv --python 3.11
|
|
26
|
+
source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Install the required packages:**
|
|
30
|
+
```bash
|
|
31
|
+
uv pip install -r requirements.txt
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### Jupyter Notebook Examples
|
|
37
|
+
|
|
38
|
+
The included notebooks demonstrate the core functionalities:
|
|
39
|
+
|
|
40
|
+
- `01_data_handler`: Create a MOCK `qppp` project file.
|
|
41
|
+
- `02_EDA`: Perform a quick exploratory data analysis.
|
|
42
|
+
- `03_*`: Carry out petrophysical interpretation of the MOCK wells.
|
|
43
|
+
|
|
44
|
+
> **Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
|
|
45
|
+
|
|
46
|
+
### `qpp_assistant` Setup
|
|
47
|
+
|
|
48
|
+
To use the `qpp_assistant`, follow these steps after the development installation:
|
|
49
|
+
|
|
50
|
+
1. Specify the required credentials in a `.env` file (you can use `.env copy` as a template).
|
|
51
|
+
2. Run Docker Compose: `docker-compose up -d`.
|
|
52
|
+
3. Build your flow in Langflow at `http://localhost:7860`.
|
|
53
|
+
4. Run the main application: `python main.py app`.
|
|
54
|
+
5. Test your flow in the qpp Assistant at `http://localhost:8888/qpp_assistant`.
|
|
55
|
+
|
|
56
|
+
## CLI
|
|
57
|
+
|
|
58
|
+
### Train a Machine Learning Model
|
|
59
|
+
|
|
60
|
+
**Requirements:**
|
|
61
|
+
- The input data must be a Parquet file located at `/data/input/<data_hash>___.parquet`.
|
|
62
|
+
- The Parquet file must contain the input and target features as specified in `MODELLING_CONFIG` in `config.py`.
|
|
63
|
+
|
|
64
|
+
**Command:**
|
|
65
|
+
|
|
66
|
+
> quick_pp train <model_config> <data_hash>
|
|
67
|
+
|
|
68
|
+
quick_pp train mock mock
|
|
69
|
+
|
|
70
|
+
### Run the MLflow Server
|
|
71
|
+
|
|
72
|
+
**Command:**
|
|
73
|
+
```bash
|
|
74
|
+
quick_pp mlflow-server
|
|
75
|
+
```
|
|
76
|
+
You can access the MLflow UI at `http://localhost:5015`.
|
|
77
|
+
|
|
78
|
+
### Run Predictions
|
|
79
|
+
|
|
80
|
+
> **Note:** Trained models must be registered in MLflow before running predictions.
|
|
81
|
+
|
|
82
|
+
> quick_pp predict <model_config> <data_hash>
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
```bash
|
|
86
|
+
quick_pp predict mock mock
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Deploy Trained Models as an API
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
quick_pp model-deployment
|
|
93
|
+
```
|
|
94
|
+
You can access the deployed model's Swagger UI at `http://localhost:5555/docs`.
|
|
95
|
+
|
|
96
|
+
### Start the Main Application
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
quick_pp app
|
|
100
|
+
```
|
|
101
|
+
- **API Docs:** `http://localhost:8888/docs`
|
|
102
|
+
- **qpp_assistant:** `http://localhost:8888/qpp_assistant` (you can log in with any username and password).
|
|
103
|
+
|
|
104
|
+
To use the mcp tools, you would need to first add the following SSE URLS through the interface;
|
|
105
|
+
http://localhost:8888/mcp - quick_pp tools.
|
|
106
|
+
|
|
107
|
+
http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
|
|
108
|
+
|
|
109
|
+
## Documentation
|
|
110
|
+
|
|
111
|
+
Documentation is available at:
|
|
112
|
+
<https://quick-pp.readthedocs.io/en/latest/index.html>
|
|
@@ -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.52"
|
|
8
8
|
description = "Python package to assist in providing quick-look/ preliminary petrophysical estimation."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -41,6 +41,7 @@ dependencies = [
|
|
|
41
41
|
"ruptures",
|
|
42
42
|
"SALib==1.5.1",
|
|
43
43
|
"scikit-learn",
|
|
44
|
+
"setuptools<81",
|
|
44
45
|
"statsmodels",
|
|
45
46
|
"welly",
|
|
46
47
|
]
|
|
@@ -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.52' # Need to be updated manually when releasing a new version/ change in pyproject.toml
|
|
@@ -10,11 +10,6 @@ from mlflow.pyfunc import load_model
|
|
|
10
10
|
import mlflow.tracking as mlflow_tracking
|
|
11
11
|
from importlib import resources
|
|
12
12
|
|
|
13
|
-
# # Uncomment below 3 lines to run >> if __name__ == "__main__"
|
|
14
|
-
# import os
|
|
15
|
-
# import sys
|
|
16
|
-
# sys.path.append(os.getcwd())
|
|
17
|
-
|
|
18
13
|
from quick_pp.api.fastapi_mlflow.applications import build_app
|
|
19
14
|
from quick_pp.machine_learning.utils import get_model_info, run_mlflow_server
|
|
20
15
|
from quick_pp import logger
|
|
@@ -94,9 +89,3 @@ except Exception as e:
|
|
|
94
89
|
|
|
95
90
|
duration = round((datetime.now() - start_time).total_seconds() / 60, 3)
|
|
96
91
|
logger.info(f"Completed mounting {model_count} models in {duration} minutes")
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
if __name__ == '__main__':
|
|
100
|
-
import uvicorn
|
|
101
|
-
|
|
102
|
-
uvicorn.run("quick_pp.api.mlflow_model_deployment:app", host='0.0.0.0', port=5555, reload=False)
|
|
@@ -5,11 +5,6 @@ import numpy as np
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
import mmap
|
|
7
7
|
import welly
|
|
8
|
-
import welly.las
|
|
9
|
-
|
|
10
|
-
# # Uncomment to run module as a standalone script
|
|
11
|
-
# import sys
|
|
12
|
-
# sys.path.append(os.getcwd())
|
|
13
8
|
|
|
14
9
|
from quick_pp import logger
|
|
15
10
|
|
|
@@ -314,18 +309,3 @@ def export_to_las(well_data, well_name, folder='', vars_units=None):
|
|
|
314
309
|
# Write to LAS format
|
|
315
310
|
well_path = os.path.join(folder, f"{well_name}.las")
|
|
316
311
|
las.write(well_path)
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
if __name__ == '__main__':
|
|
320
|
-
from tkinter import Tk, filedialog
|
|
321
|
-
|
|
322
|
-
root = Tk()
|
|
323
|
-
file_objects = filedialog.askopenfiles(title='Choose well Log ASCII Standard (LAS) files to be combined',
|
|
324
|
-
filetypes=(('LAS Files', '*.LAS *.las'), ('All Files', '*.*')),
|
|
325
|
-
mode='rb')
|
|
326
|
-
root.destroy()
|
|
327
|
-
if file_objects:
|
|
328
|
-
# Test read_las_file function
|
|
329
|
-
merged_df, _ = read_las_files(file_objects)
|
|
330
|
-
fname = 'well_df.csv'
|
|
331
|
-
merged_df.to_csv(fname)
|
|
@@ -5,10 +5,6 @@ from mlflow.pyfunc import load_model
|
|
|
5
5
|
import mlflow.tracking as mlflow_tracking
|
|
6
6
|
from tqdm import tqdm
|
|
7
7
|
|
|
8
|
-
# # Uncomment below 2 lines to run >> if __name__ == "__main__"
|
|
9
|
-
# import sys
|
|
10
|
-
# sys.path.append(os.getcwd())
|
|
11
|
-
|
|
12
8
|
from quick_pp.machine_learning.config import MODELLING_CONFIG, RAW_FEATURES
|
|
13
9
|
from quick_pp.machine_learning.feature_engineering import generate_fe_features
|
|
14
10
|
from quick_pp.machine_learning.utils import get_latest_registered_models, unique_id, run_mlflow_server
|
|
@@ -150,21 +146,3 @@ def predict_pipeline(
|
|
|
150
146
|
pred_df = postprocess_data(pred_df)
|
|
151
147
|
save_predictions(pred_df, output_file_name, plot=plot_predictions)
|
|
152
148
|
logger.info("Prediction pipeline completed successfully")
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if __name__ == "__main__":
|
|
156
|
-
import argparse
|
|
157
|
-
|
|
158
|
-
parser = argparse.ArgumentParser(description="Prediction pipeline")
|
|
159
|
-
parser.add_argument("--model-config", type=str, required=True, help="Path to model config")
|
|
160
|
-
parser.add_argument("--data", type=str, required=True, help="Path to input data parquet file")
|
|
161
|
-
parser.add_argument("--output", type=str, default='test', help="Path to save predictions parquet file")
|
|
162
|
-
args = parser.parse_args()
|
|
163
|
-
|
|
164
|
-
# Set up MLflow
|
|
165
|
-
os.makedirs('data/output', exist_ok=True)
|
|
166
|
-
|
|
167
|
-
logger.info(f"Model config: {args.model_config}")
|
|
168
|
-
logger.info(f"Data hash: {args.data}")
|
|
169
|
-
|
|
170
|
-
predict_pipeline(args.model_config, args.data, args.output)
|
|
@@ -8,10 +8,6 @@ import mlflow.sklearn as mlflow_sklearn
|
|
|
8
8
|
from mlflow.models.signature import infer_signature
|
|
9
9
|
import importlib.util
|
|
10
10
|
|
|
11
|
-
# # Uncomment below 3 lines to run >> if __name__ == "__main__"
|
|
12
|
-
# import sys
|
|
13
|
-
# sys.path.append(os.getcwd())
|
|
14
|
-
|
|
15
11
|
from quick_pp.machine_learning.config import MODELLING_CONFIG
|
|
16
12
|
from quick_pp.machine_learning.feature_engineering import generate_fe_features
|
|
17
13
|
from quick_pp.machine_learning.utils import run_mlflow_server
|
|
@@ -204,15 +200,3 @@ def train_pipeline(model_config: str, data_hash: str, env: str = 'local'):
|
|
|
204
200
|
model, "model", signature=signature, input_example=X_test.sample(5),
|
|
205
201
|
registered_model_name=reg_model_name)
|
|
206
202
|
logger.info(f"Model logged and registered as: {reg_model_name}")
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if __name__ == "__main__":
|
|
210
|
-
|
|
211
|
-
# Set up folders
|
|
212
|
-
os.makedirs('./mlruns', exist_ok=True)
|
|
213
|
-
os.makedirs('data/input', exist_ok=True)
|
|
214
|
-
|
|
215
|
-
# Example usage
|
|
216
|
-
data_hash = "x2x2" # Update with your hash for your data in the 'data/input/' folder
|
|
217
|
-
model_config = "carbonate" # Update with your model config
|
|
218
|
-
train_pipeline(model_config, data_hash)
|
|
@@ -18,7 +18,6 @@ plt.rcParams.update(
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def update_fluid_contacts(well_data, well_config: dict):
|
|
21
|
-
logger.debug(f"Updating fluid contacts for well with config: {well_config}")
|
|
22
21
|
"""Update fluid flags based on fluid contacts.
|
|
23
22
|
|
|
24
23
|
Args:
|
|
@@ -58,7 +57,6 @@ def update_fluid_contacts(well_data, well_config: dict):
|
|
|
58
57
|
|
|
59
58
|
|
|
60
59
|
def generate_zone_config(zones: list = ['ALL']):
|
|
61
|
-
logger.info(f"Generating zone config for zones: {zones}")
|
|
62
60
|
"""Generate zone configuration.
|
|
63
61
|
|
|
64
62
|
Args:
|
|
@@ -67,6 +65,7 @@ def generate_zone_config(zones: list = ['ALL']):
|
|
|
67
65
|
Returns:
|
|
68
66
|
dict: Zone configuration
|
|
69
67
|
"""
|
|
68
|
+
logger.info(f"Generating zone config for zones: {zones}")
|
|
70
69
|
zone_config = {}
|
|
71
70
|
for zone in zones:
|
|
72
71
|
zone_config[zone] = {
|
|
@@ -76,7 +75,6 @@ def generate_zone_config(zones: list = ['ALL']):
|
|
|
76
75
|
|
|
77
76
|
|
|
78
77
|
def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
|
|
79
|
-
logger.info(f"Updating zone config for zone: {zone} with contacts: {fluid_contacts}")
|
|
80
78
|
"""Update zone configuration with fluid contacts.
|
|
81
79
|
|
|
82
80
|
Args:
|
|
@@ -87,6 +85,7 @@ def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
|
|
|
87
85
|
Returns:
|
|
88
86
|
dict: Updated zone configuration
|
|
89
87
|
"""
|
|
88
|
+
logger.info(f"Updating zone config for zone: {zone} with contacts: {fluid_contacts}")
|
|
90
89
|
if zone in zone_config:
|
|
91
90
|
zone_config[zone].update(fluid_contacts)
|
|
92
91
|
else:
|
|
@@ -95,7 +94,6 @@ def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
|
|
|
95
94
|
|
|
96
95
|
|
|
97
96
|
def generate_well_config(well_names: list = ['X']):
|
|
98
|
-
logger.info(f"Generating well config for wells: {well_names}")
|
|
99
97
|
"""Generate well configuration.
|
|
100
98
|
|
|
101
99
|
Args:
|
|
@@ -104,6 +102,7 @@ def generate_well_config(well_names: list = ['X']):
|
|
|
104
102
|
Returns:
|
|
105
103
|
dict: Well configuration
|
|
106
104
|
"""
|
|
105
|
+
logger.info(f"Generating well config for wells: {well_names}")
|
|
107
106
|
well_config = {}
|
|
108
107
|
for i, well in enumerate(well_names):
|
|
109
108
|
well_config[well] = {
|
|
@@ -115,9 +114,7 @@ def generate_well_config(well_names: list = ['X']):
|
|
|
115
114
|
return well_config
|
|
116
115
|
|
|
117
116
|
|
|
118
|
-
def update_well_config(
|
|
119
|
-
well_config: dict, well_name: str, zone: str = '', fluid_contacts: dict = {}, sorting: int = 0):
|
|
120
|
-
logger.info(f"Updating well config for well: {well_name}, zone: {zone}, sorting: {sorting}")
|
|
117
|
+
def update_well_config(well_config: dict, well_name: str, zone: str = '', fluid_contacts: dict = {}, sorting: int = 0):
|
|
121
118
|
"""Update well configuration with fluid contacts.
|
|
122
119
|
|
|
123
120
|
Args:
|
|
@@ -130,6 +127,7 @@ def update_well_config(
|
|
|
130
127
|
Returns:
|
|
131
128
|
dict: Updated well configuration
|
|
132
129
|
"""
|
|
130
|
+
logger.info(f"Updating well config for well: {well_name}, zone: {zone}, sorting: {sorting}")
|
|
133
131
|
if zone in well_config[well_name]['zones']:
|
|
134
132
|
well_config[well_name]['zones'][zone].update(fluid_contacts)
|
|
135
133
|
elif zone:
|
|
@@ -141,12 +139,12 @@ def update_well_config(
|
|
|
141
139
|
|
|
142
140
|
|
|
143
141
|
def assert_well_config_structure(well_config):
|
|
144
|
-
logger.debug("Asserting well config structure.")
|
|
145
142
|
"""Assert well configuration structure.
|
|
146
143
|
|
|
147
144
|
Args:
|
|
148
145
|
well_config (dict): Dictionary containing well sorting and fluid contacts.
|
|
149
146
|
"""
|
|
147
|
+
logger.debug("Asserting well config structure.")
|
|
150
148
|
required_keys = {'sorting', 'zones'}
|
|
151
149
|
optional_keys = {'GUT', 'GDT', 'GOC', 'GWC', 'OUT', 'ODT', 'OWC', 'WUT'}
|
|
152
150
|
for well, config in well_config.items():
|
|
@@ -160,7 +158,6 @@ def assert_well_config_structure(well_config):
|
|
|
160
158
|
|
|
161
159
|
|
|
162
160
|
def stick_plot(data, well_config: dict, zone: str = 'ALL'):
|
|
163
|
-
logger.info(f"Generating stick plot for zone: {zone}")
|
|
164
161
|
"""Generate stick plot with water saturation and fluid contacts for specified zone.
|
|
165
162
|
|
|
166
163
|
Example of well_config:
|
|
@@ -188,6 +185,7 @@ def stick_plot(data, well_config: dict, zone: str = 'ALL'):
|
|
|
188
185
|
data (pandas.DataFrame): Pandas dataframe containing well log data.
|
|
189
186
|
well_config (dict): Dictionary containing well sorting and fluid contacts.
|
|
190
187
|
"""
|
|
188
|
+
logger.info(f"Generating stick plot for zone: {zone}")
|
|
191
189
|
assert 'SWT' in data.columns, 'SWT column not found in data.'
|
|
192
190
|
assert_well_config_structure(well_config)
|
|
193
191
|
|
|
@@ -235,7 +233,6 @@ def neutron_density_xplot(nphi, rhob,
|
|
|
235
233
|
fluid_point: tuple = (1.0, 1.0),
|
|
236
234
|
wet_clay_point: tuple = (),
|
|
237
235
|
dry_silt_point: tuple = (), **kwargs):
|
|
238
|
-
logger.info("Generating neutron-density crossplot.")
|
|
239
236
|
"""Neutron-Density crossplot with lithology lines based on specified end points.
|
|
240
237
|
|
|
241
238
|
Args:
|
|
@@ -250,6 +247,7 @@ def neutron_density_xplot(nphi, rhob,
|
|
|
250
247
|
Returns:
|
|
251
248
|
matplotlib.pyplot.Figure: Neutron porosity and bulk density cross plot.
|
|
252
249
|
"""
|
|
250
|
+
logger.info("Generating neutron-density crossplot.")
|
|
253
251
|
A = dry_min1_point
|
|
254
252
|
C = dry_clay_point
|
|
255
253
|
D = fluid_point
|
|
@@ -299,17 +297,3 @@ def neutron_density_xplot(nphi, rhob,
|
|
|
299
297
|
fig.tight_layout()
|
|
300
298
|
|
|
301
299
|
return fig
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
def sonic_density_xplot():
|
|
305
|
-
logger.info("Called sonic_density_xplot (not implemented)")
|
|
306
|
-
""" TODO: Implement sonic density crossplot
|
|
307
|
-
"""
|
|
308
|
-
pass
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
def sonic_neutron_xplot():
|
|
312
|
-
logger.info("Called sonic_neutron_xplot (not implemented)")
|
|
313
|
-
""" TODO: Implement sonic neutron crossplot
|
|
314
|
-
"""
|
|
315
|
-
pass
|
|
@@ -8,6 +8,25 @@ from quick_pp.plotter.well_log_config import COLOR_DICT, TRACE_DEFS, XAXIS_DEFS
|
|
|
8
8
|
|
|
9
9
|
# --- Helper to add traces from trace_defs ---
|
|
10
10
|
def add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs):
|
|
11
|
+
"""Adds traces to the figure based on a definitions dictionary.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
fig (plotly.graph_objects.Figure): The Plotly figure to add traces to.
|
|
15
|
+
df (pd.DataFrame): The DataFrame containing the log data.
|
|
16
|
+
index (pd.Series): The depth index for the y-axis.
|
|
17
|
+
no_of_track (int): The total number of tracks in the plot.
|
|
18
|
+
trace_defs (dict): A dictionary defining the traces to be plotted.
|
|
19
|
+
**kwargs: Additional keyword arguments to pass to `go.Scatter`.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
plotly.graph_objects.Figure: The figure with the added traces.
|
|
23
|
+
|
|
24
|
+
Notes:
|
|
25
|
+
- Skips 'COAL_FLAG' and 'ZONES' as they are handled separately.
|
|
26
|
+
- Updates trace styles from `trace_defs`.
|
|
27
|
+
- Manages x-axis visibility for overlapping traces.
|
|
28
|
+
|
|
29
|
+
"""
|
|
11
30
|
trace_ix = 0
|
|
12
31
|
for col, trace_def in trace_defs.items():
|
|
13
32
|
# Skip special cases handled separately
|
|
@@ -37,6 +56,20 @@ def add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs):
|
|
|
37
56
|
|
|
38
57
|
|
|
39
58
|
def add_crossover_traces(df):
|
|
59
|
+
"""Calculates and adds gas crossover shading traces to the DataFrame.
|
|
60
|
+
|
|
61
|
+
If 'NPHI' and 'RHOB' are present, this function calculates the region
|
|
62
|
+
where neutron porosity crosses over bulk density, indicating potential
|
|
63
|
+
gas zones. It adds 'RHOB_ON_NPHI_SCALE', 'GAS_XOVER_TOP', and
|
|
64
|
+
'GAS_XOVER_BOTTOM' columns to the DataFrame for plotting.
|
|
65
|
+
|
|
66
|
+
Args:
|
|
67
|
+
df (pd.DataFrame): The DataFrame containing log data.
|
|
68
|
+
|
|
69
|
+
Returns:
|
|
70
|
+
pd.DataFrame: The DataFrame with added crossover-related columns.
|
|
71
|
+
|
|
72
|
+
"""
|
|
40
73
|
if 'NPHI' in df.columns and 'RHOB' in df.columns and 'NPHI_XOVER_BOTTOM' not in df.columns:
|
|
41
74
|
rhob_min, rhob_max = 1.95, 2.95
|
|
42
75
|
nphi_min_scale, nphi_max_scale = 0.45, -0.15
|
|
@@ -54,6 +87,20 @@ def add_crossover_traces(df):
|
|
|
54
87
|
|
|
55
88
|
|
|
56
89
|
def add_rock_flag_traces(df):
|
|
90
|
+
"""Prepares rock flag data for plotting by one-hot encoding.
|
|
91
|
+
|
|
92
|
+
If a 'ROCK_FLAG' column exists, this function:
|
|
93
|
+
1. Converts it to integer type.
|
|
94
|
+
2. Assigns a unique color to each flag value in `COLOR_DICT`.
|
|
95
|
+
3. One-hot encodes the 'ROCK_FLAG' column into separate 'ROCK_FLAG_X' columns.
|
|
96
|
+
|
|
97
|
+
Args:
|
|
98
|
+
df (pd.DataFrame): The DataFrame containing log data.
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
pd.DataFrame: The DataFrame with one-hot encoded rock flag columns.
|
|
102
|
+
|
|
103
|
+
"""
|
|
57
104
|
if 'ROCK_FLAG' in df.columns:
|
|
58
105
|
# Add ROCK_FLAG colors
|
|
59
106
|
df['ROCK_FLAG'] = df['ROCK_FLAG'].fillna(0).astype(int)
|
|
@@ -75,6 +122,17 @@ def add_rock_flag_traces(df):
|
|
|
75
122
|
|
|
76
123
|
|
|
77
124
|
def fix_missing_volumetrics(df):
|
|
125
|
+
"""Ensures standard volumetric columns exist in the DataFrame.
|
|
126
|
+
|
|
127
|
+
Iterates through a predefined list of volumetric curve names. If a column
|
|
128
|
+
exists, it fills missing values with 0. If it doesn't exist, it is not added.
|
|
129
|
+
|
|
130
|
+
Args:
|
|
131
|
+
df (pd.DataFrame): The DataFrame containing log data.
|
|
132
|
+
|
|
133
|
+
Returns:
|
|
134
|
+
pd.DataFrame: The DataFrame with NaNs filled in volumetric columns.
|
|
135
|
+
"""
|
|
78
136
|
volumetrics = ['VCLAY', 'VSILT', 'VSAND', 'VCALC', 'VDOLO', 'VGAS', 'VOIL', 'VHC']
|
|
79
137
|
for col in volumetrics:
|
|
80
138
|
df[col] = df[col].fillna(0) if col in df.columns else None
|
|
@@ -82,6 +140,18 @@ def fix_missing_volumetrics(df):
|
|
|
82
140
|
|
|
83
141
|
|
|
84
142
|
def fix_missing_depths(df):
|
|
143
|
+
"""Resamples the DataFrame to a regular depth interval.
|
|
144
|
+
|
|
145
|
+
This function ensures the DataFrame has a consistent depth step by
|
|
146
|
+
creating a complete depth range and merging the original data onto it.
|
|
147
|
+
This prevents gaps in the final plot.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
df (pd.DataFrame): The DataFrame containing log data with a 'DEPTH' column.
|
|
151
|
+
|
|
152
|
+
Returns:
|
|
153
|
+
pd.DataFrame: A resampled DataFrame with consistent depth steps.
|
|
154
|
+
"""
|
|
85
155
|
depth_min = df['DEPTH'].min()
|
|
86
156
|
depth_max = df['DEPTH'].max()
|
|
87
157
|
depth_step = df['DEPTH'].diff().mode()[0].round(4) # Most common depth step
|
|
@@ -206,6 +276,17 @@ def plotly_log(well_data, well_name: str = '', depth_uom="", trace_defs: dict =
|
|
|
206
276
|
)
|
|
207
277
|
|
|
208
278
|
def add_zone_markers(fig, df):
|
|
279
|
+
"""Adds horizontal lines and labels for formation tops.
|
|
280
|
+
|
|
281
|
+
If a 'ZONES' column is present, this function identifies changes in
|
|
282
|
+
the zone names and adds a horizontal line and a text annotation to the
|
|
283
|
+
plot for each formation top.
|
|
284
|
+
|
|
285
|
+
Args:
|
|
286
|
+
fig (plotly.graph_objects.Figure): The figure to add markers to.
|
|
287
|
+
df (pd.DataFrame): The DataFrame containing 'DEPTH' and 'ZONES' columns.
|
|
288
|
+
|
|
289
|
+
"""
|
|
209
290
|
if 'ZONES' in df.columns:
|
|
210
291
|
tops_df = df[['DEPTH', 'ZONES']].dropna().reset_index()
|
|
211
292
|
if not tops_df.empty and sum([1 for c in tops_df.ZONES.unique() if 'ZONE_' in c]) < 30:
|
|
@@ -143,7 +143,7 @@ def density_porosity(rhob, rho_matrix, rho_fluid: float = 1.0):
|
|
|
143
143
|
return phi_d
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
def dt_matrix(vsand=0,
|
|
146
|
+
def dt_matrix(vsand=0, vclay=0, vcalc=0, vdolo=0, vheavy=0,
|
|
147
147
|
dt_sand: float = 0, dt_silt: float = 0, dt_clay: float = 0,
|
|
148
148
|
dt_calc: float = 0, dt_dolo: float = 0, dt_heavy: float = 0):
|
|
149
149
|
"""Estimate average matrix sonic transit time based on dry sand, dry silt dry calcite and
|
|
@@ -151,7 +151,6 @@ def dt_matrix(vsand=0, vsilt=0, vclay=0, vcalc=0, vdolo=0, vheavy=0,
|
|
|
151
151
|
|
|
152
152
|
Args:
|
|
153
153
|
vsand (float): Volume of sand.
|
|
154
|
-
vsilt (float): Volume of silt.
|
|
155
154
|
vclay (float): Volume of clay.
|
|
156
155
|
vcalc (float): Volume of calcite.
|
|
157
156
|
vdolo (float): Volume of dolomite.
|
|
@@ -169,12 +168,11 @@ def dt_matrix(vsand=0, vsilt=0, vclay=0, vcalc=0, vdolo=0, vheavy=0,
|
|
|
169
168
|
logger.debug("Calculating matrix sonic transit time from mineral volumes")
|
|
170
169
|
minerals_log_value = Config.MINERALS_LOG_VALUE
|
|
171
170
|
dt_sand = dt_sand or minerals_log_value['DTC_QUARTZ']
|
|
172
|
-
dt_silt = dt_silt or minerals_log_value['DTC_SILT']
|
|
173
171
|
dt_clay = dt_clay or minerals_log_value['DTC_SHALE']
|
|
174
172
|
dt_calc = dt_calc or minerals_log_value['DTC_CALCITE']
|
|
175
173
|
dt_dolo = dt_dolo or minerals_log_value['DTC_DOLOMITE']
|
|
176
174
|
|
|
177
|
-
dt_matrix = (vsand * dt_sand +
|
|
175
|
+
dt_matrix = (vsand * dt_sand + vclay * dt_clay +
|
|
178
176
|
vcalc * dt_calc + vdolo * dt_dolo + vheavy * dt_heavy)
|
|
179
177
|
logger.debug(f"Matrix sonic transit time range: {dt_matrix.min():.1f} - {dt_matrix.max():.1f} us/ft")
|
|
180
178
|
return dt_matrix
|