Geological Modeling based on Machine Learning with Python and hatariTools - Tutorial
/This tutorial covers an applied case of geological unit modeling done on the Queens Mary Reservoir, London, UK based on 266 drillings. The geological model was done in Python with the machine learning library Scikit Learn to create a geological model based on lithology from drillings.
The code generates a point cloud of drilling lithologies that are transformed and scaled for a neural network classifier like the Multi-layer Perceptron classifier. To validate the results of the geological model, an analysis of the confusion matrix from the neural network is performed. The tutorial includes a georeferenced 3D visualization and comparison from well lithology and interpolated geology as Vtk format in Paraview.
Tutorial
Code
#!pip install -U "hatariTools[3dvisualization]"
from hatariTools.geospatialIA.geologicalModeling import geoModel
#start geoModel object
geoModel = geoModel()
Follow us: |
|
|
|
|
|
|
/-------------------------------------------/
The geological modeling engine has been started
/-------------------------------------------/
#define files and folder, make sure that output folder exists
fileDict = {
'locationFile':'../Csv/locationData.csv',
'litoFile':'../Csv/litoData.csv',
'outputDir':'../Output'
}
geoModel.defineFileDict(fileDict)
The file dictionary has been added.
#define lito dict for reclass
litoDict = {
'soil':1,
'dirty ballast':2,
'sandy ballast':3,
'london clay':4,
'loam':5,
'sand':6,
'other':7
}
geoModel.defineLitoDict(litoDict)
The lithology dictionary has been added.
#set the header dictionary for the location file
locHeaderDict = {
'id':'LOCA_ID',
'easting':'LOCA_NATE',
'northing':'LOCA_NATN',
'elevation':'LOCA_GL'
}
geoModel.defineLocDict(locHeaderDict)
The location header dictionary has been added.
#set the header dictionary for the lithology file
litoHeaderDict = {
'id':'LOCA_ID',
'top':'GEOL_TOP',
'bottom':'GEOL_BASE',
'litoCode':'litoCode'
}
geoModel.defineLitoFileDict(litoHeaderDict)
The lithology header dictionary has been added.
#process point cloud
geoModel.generatePointCloud(resolution=0.3)
#generate vtk representation of the lithology
geoModel.generateLitoRepresentation()
geoModel.buildNeuralClassifier()
C:\Users\saulm\anaconda3\Lib\site-packages\sklearn\neural_network\_multilayer_perceptron.py:602: ConvergenceWarning: lbfgs failed to converge after 3000 iteration(s) (status=1):
STOP: TOTAL NO. OF ITERATIONS REACHED LIMIT
Increase the number of iterations to improve the convergence (max_iter=3000).
You might also want to scale the data as shown in:
https://scikit-learn.org/stable/modules/preprocessing.html
self.n_iter_ = _check_optimize_result("lbfgs", opt_res, self.max_iter)
geoModel.generatePredictedGrid(cellHeight=0.3, cellWidth=20)
/---------- size of predicted grid ----------/
Cols: 125, Rows: 95, Lays: 77
Processing 0 cells
Processing 100000 cells
Processing 200000 cells
Processing 300000 cells
Processing 400000 cells
Processing 500000 cells
Processing 600000 cells
Processing 700000 cells
Processing 800000 cells
Processing 900000 cells
/---------- plot sample layer ----------/
Input data
You can download the input data from this link:
owncloud.hatarilabs.com/s/5W2sTGaVxPFIEo6
Password: Hatarilabs