Machine Learning application in Petrophysics Industry: A Sonic Log Synthesis prediction story | by Aboze Brain John Jnr | Towards Data Science

Petrophysics is the study of the properties of rock and a brief description about the interactions of liquids. It is mainly used in the Oil and Gas industry to study the behavior of different kinds of reservoirs. It also explains the chemistry of pores of the subsurface and how they are connected. It helps in controlling the migration and accumulation of hydrocarbons, while explaining the chemical and physical properties, Petrophysics also explains many other related terms such as lithology, water saturation, density, permeability and porosity.
Petrophysics emphasizes those properties relating to the pore system and its fluid distribution and flow characteristics. These properties and their relationships are used to identify and evaluate:
Hydrocarbon reservoirs
Hydrocarbon sources
Seals
Aquifers
The petrophysicist or petrophysical engineer practices the science of petrophysics as a member of the reservoir management team. The petrophysicist provides answers on products needed and used by team members, as well as physical and chemical insights needed by other teammates. The reservoir and fluid characteristics to be determined are:
Thickness (bed boundaries)
Lithology (rock type)
Porosity
Fluid saturations and pressures
Fluid identification and characterization
Permeability (absolute)
Fractional flow (oil, gas, water)
It is easy to define these characteristics and to appreciate their part in the assessment of reserves. The difficult part comes in determining their actual value at a level of certainty needed to make economic decisions leading to development and production. The seven characteristics listed are interdependent (i.e., to properly determine porosity from a wireline log, one must know the lithology, fluid saturations, and fluid types). The science of petrophysics is then used to unscramble the hidden world of rock and fluid properties in reservoirs from just below the Earth’s surface to ones more than four miles deep. The petrophysicist then takes on many characteristics of the fictional sleuth Sherlock Holmes to extrapolate, from the most meager of clues, the true picture of the subsurface reservoir using dogged determination to wrest all possible information from the available data, all the while enjoying the thrill of the hunt.
Archie’s general method is to subdivide the problem into smaller segments and iterate using all data until all data agree. One starting point is to determine rock types (petrofacies) wherein we identify:
Pore type
Pore size distribution
Pore throat type
Pore throat distribution
When coupled with fluid type, one can establish a capillary pressure model that will lead to understanding in-situ fluid saturations and fluid flow. However, the tools available to the petrophysicist are:
Mud logging (solids, liquids, gasses, volumes, rates, concentrations, and temperature)
Measurement while drilling (MWD) and Logging while drilling (LWD)
Wireline logging (open- and cased-hole)
Core sampling and core analysis
Fluid sampling (wireline and/or drillstem tests)
Compressional traveltime (DTC) and shear traveltime (DTS) logs are not acquired in all the wells drilled in a field due to financial or operational constraints. Under such circumstances, machine-learning techniques can be used to predict DTC and DTS logs to improve subsurface characterization. The goal of this Petrophysical Data-Driven Analytics project is to develop data-driven models by processing “easy-to-acquire” conventional logs from casr study ‘Well 1’, and use the data-driven models to generate synthetic DTC and DTS logs in case study ‘Well 2’. A robust data-driven model for the desired sonic-log synthesis will result in low prediction errors, which can be quantified in terms of root mean squared error (RME) by comparing the synthesized and the original DTC and DTS logs.
Well datasets (comprising of Well 1 & Well 2) are provided, and the goal is to build a generalizable data-driven models using the Well 1 dataset. Following that, you will deploy the newly developed data-driven models on the Well 2 dataset to synthesize DTS and DTC logs. The data-driven model uses feature sets derived from the following seven logs: caliper, neutron, gamma ray, deep resistivity, medium resistivity, photoelectric factor and density. The data-driven model should synthesize two target logs: DTC and DTS logs.
The location of the data is a GitHub repository sourced from the Github repository maintained by the amazing team at Petrophysical Data-Driven Analytics
The only way to find the best algorithm for a given problem is to try and test all algorithms
It is time expensive to try out all possible machine learning algorithms for this project, so in the context for this article we will be using eXtreme Gradient Boosting (XGBoost) Algorithm. From the problem statement, we to predict two features making it a Multi-target regression problem. The XGBoost Regressor coupled with SKlearn’s MultiOutputRegressor would be applied.
The name XGBoost, though, actually refers to the engineering goal to push the limit of computations resources for boosted tree algorithms. Which is the reason why many people use XGBoost.
It is an implementation of gradient boosting machines created by Tianqi Chen, now with contributions from many developers. It belongs to a broader collection of tools under the umbrella of the Distributed Machine Learning Community or DMLC who are also the creators of the popular mxnet deep learning library. It is free open source software available for use under the permissive Apache-2 license that supports the following main interfaces:
Command Line Interface (CLI).
Python interface as well as a model in scikit-learn.
C++ (the language in which the library is written).
R interface as well as a model in the caret package.
Julia.
Java and JVM languages like Scala and platforms like Hadoop.
The library is laser focused on
Computational speed: Generally, XGBoost is fast. Really fast when compared to other implementations of gradient boosting.Model performance: XGBoost dominates structured or tabular datasets on classification and regression predictive modeling problems. The evidence is that it is the go-to algorithm for competition winners on the Kaggle competitive data science platform.
Computational speed: Generally, XGBoost is fast. Really fast when compared to other implementations of gradient boosting.
Model performance: XGBoost dominates structured or tabular datasets on classification and regression predictive modeling problems. The evidence is that it is the go-to algorithm for competition winners on the Kaggle competitive data science platform.
XGBoost package can be install into the python environment by using the Python Package Index (PyPI) for a stable version.
pip install xgboost
Here, we start with importing all the python libraries we would be needing for this project.
warning : Warning control for suppressing deprecated functions in python packages.
numpy : For scientific computing.
pandas : For data wrangling and analysis
matplotlib: For visualizations of graphs and charts.
xgboost : The machine learning algorithm used for prediction.
MultiOutputRegressor : This provides the multi-target regression environment.
StandardScaler : To scale the data
train_test_split : To split the data
RandomizedSearchCV : For random parameter tuning
mean_square_error : Performance metric used to evaluate the predictions.
Firstly, most times during data entry missing values are replaced with -999 , so it is ideal to identify it as a missing value indicator for the system. Here, white spaces as well as Nan and NaN were also identified as missing value indicator in the dataset.
Data description of the respective features is as follows:
CAL: Caliper log (unit in inch)
CNC: Neuron log (unit in dec)
GR: Gamma Ray log (unit in API)
HRD: Deep Resistivity log (unit in Ohm per meter)
HRM: Medium Resistivity log (unit in Ohm per meter)
PE: Photo-electric Factor (unit in Barn)
ZDEN: Density log (unit in Grams per cubit meter)
DTC: Compressional Travel-time lo (unit in nanosecond per foot)
DTS: Shear Travel-time log (unit in nanosecond per foot)
DTC and DTS are called Sonic logs, which can be computed from the waveforms recorded at the receiver. The descriptive statistics is also computed.
Checking for Missing values
It can be observed that a colossal amount of missing values exists in the training data. Let’s have a view what the distribution of the data.
Most of the feature’s histograms are uni-molar and others are skewed, filling the former with the previous value in the dataframe and the latter with the median will be highly logical. The filling with previous value method will be supported by pandas fillna backfill method and the median by the median.() method.
The Feature engineering in the context of this publication is focused mainly gamma ray log (GR) feature. From the histogram, outliers can be observed, as GR values conventionally fall between 0–200. We will be creating two new features out of GR, while bounding it to the upper and lower limits. The two new features to be created are:
gamma ray index (IGR)natural gamma radiation (NGR)
gamma ray index (IGR)
natural gamma radiation (NGR)
The gamma ray log (GR) feature should be dropped after using it to create other features to reduce redundancy in the data.
The training data is split with a 70:30 ratio
Most machine models work best when various variables are put on the same scale.
The XGBoost Regression is instantiated with already tuned hyperparameters. Hyperparameter tuning is a very time expensive procedure and was skipped in the article but can be referred and looked up in notebook on github. The model was fitted to the training data to aid the learning process.
The final output of the model — predictions. Lower values of RMSE indicate better fit and the model is looking good! Lastly, the model is applied to data it hasn’t seen — ‘test’ data.
I hope this article will broadening the horizons of the application of Machine Learning in the Petrophysics Industry. hanks for reading and stay safe.