Modelamiento Geológico basado en Machine Learning con Python y hatariTools - Tutorial

Este tutorial cubre un caso aplicado de modelamiento de unidades geológicas realizado en el embalse Queens Mary, Londres, Reino Unido, basado en 266 perforaciones. El modelo geológico se realizó en Python con la librería hatariTools para crear un modelo geológico basado en la litología de las perforaciones.

El código genera una nube de puntos de litologías de perforación que se transforman y escalan en un clasificador de red neuronal como el Multi-layer Perceptron classifier. Para validar los resultados del modelo geológico se realiza un análisis de la matriz de confusión de la red neuronal. El tutorial también incluye una visualización en 3D georreferenciada y una comparación de la litología de pozos y la geología interpolada como formato Vtk en Paraview.


Tutorial

Código

#!pip install -U "hatariTools[3dvisualization]"
from hatariTools.geospatialIA.geologicalModeling import geoModel
#start geoModel object
geoModel = geoModel()
Hatarilabs

build faster, analyze more

Follow us:

Hatarilabs Hatarilabs Hatarilabs Hatarilabs Hatarilabs Hatarilabs
/-------------------------------------------/

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 ----------/

Datos de ingreso

Puedes descargar los datos de ingreso desde este link:

owncloud.hatarilabs.com/s/5W2sTGaVxPFIEo6

Password: Hatarilabs

 

Suscríbete a nuestro boletín electrónico

Suscríbase a nuestro boletín gratuito para recibir noticias, datos interesantes y fechas de nuestros cursos en recursos hídricos.

 

Posted on October 2, 2025 and filed under TutorialModflow, TutorialPython, Modelamiento.