Science and engineering

Machine learning for geoscience

Geoscientists use machine learning to predict rock type from well logs, to map soils and minerals from spatial data, and to detect and catalogue earthquakes. Models combine measurements taken at very different scales, from boreholes to satellites.

Where to start

Learn tabular classification and spatial data handling with Xarray and GeoPandas first. Split by well or region rather than by row, because neighbouring samples share geology.

How machine learning is used in geoscience

Predicting rock type from well logs

Classifiers learn the relationship between log curves such as gamma ray, resistivity and density and the facies described in cored wells. They then label uncored wells quickly and consistently, leaving geologists to check difficult intervals.

Real example: SEG 2016 machine learning contest. A public contest from The Leading Edge in which teams trained facies classifiers on well-log data, with submissions and code published on GitHub.

Mapping soils and surface properties

Models relate point samples to environmental covariates such as terrain, climate, vegetation and geology, then predict a continuous map with an uncertainty for each cell. This is called digital soil mapping.

Real example: SoilGrids 2.0 (Poggio et al., SOIL, 2021). Produces global maps of soil properties at 250 m resolution with machine learning, using about 240,000 soil observations and over 400 environmental covariates, with quantified spatial uncertainty.

Detecting and cataloguing earthquakes

Deep learning models scan continuous seismic records, detect earthquakes and pick P and S wave arrivals. The resulting catalogues include many more small events than manual review can produce.

Real example: EQTransformer (Mousavi et al., Nature Communications, 2020). An attention-based deep learning model for simultaneous earthquake detection and phase picking in seismic records.

Can geoscientists learn machine learning?

Yes. Geoscientists who are comfortable with data and statistics can add machine learning step by step: Python, spatial and tabular data handling, classical models with spatially aware validation, then deep learning for images and waveforms.

  1. Python. Read well logs, rasters and seismic files with Python libraries such as lasio, rasterio and ObsPy. Taught in the Python track of Foundations of AI
  2. Data handling. Clean and join tables of samples, logs and coordinates with pandas. Taught in the Data Tools track of Foundations of AI
  3. Statistics and geostatistics. Spatial correlation, kriging and uncertainty are the baselines every machine learning map is compared with. Taught in the Statistics track of Foundations of AI
  4. Classical models with spatial validation. Random forests and gradient boosting, validated by holding out whole wells or regions. Taught in the Machine Learning track of Foundations of AI
  5. Deep learning for images and waveforms. Convolutional networks and transformers for imagery, seismic sections and earthquake records. Covered by the Deep Learning course (coming next)

Moving into machine learning for geoscience

If you already work in the field

Geoscientists know what the measurements mean, where they are unreliable and what a geologically sensible map looks like. Add Python and classical machine learning, then rework a project you know, such as a facies or soil map, and compare the result with your existing interpretation. Geological surveys, energy and mining companies and research institutes all hire for this mix.

If you come from data science or ML

Data scientists should learn the basics of the relevant subfield, such as stratigraphy, soils or seismology, plus coordinate systems and why spatial correlation breaks random train-test splits. Working through an open geoscience dataset with a domain partner is the fastest way to learn which errors matter.

Roles that do this work: Geoscience data scientistGeostatisticianPetrophysicistDigital soil mapping scientistSeismologist

Tools you will use

ToolWhat you use it for
XarrayHandle gridded geoscience data such as climate, seismic and satellite cubes.
GeoPandasJoin samples, wells and mapped units by location.
VerdeGrid and interpolate scattered spatial measurements with cross-validation.
lasioRead well-log LAS files into tables for modelling.
scikit-learnTrain lithology classifiers and spatial regression models.

Public data to practise on

Your first project

Download the FORCE 2020 well-log data, predict lithology from gamma-ray, density, neutron and sonic logs with gradient boosting, and compare it with a majority-class baseline using balanced accuracy on held-out wells.

Keep the result, your code and a short note on what didn't work. That record is worth more than the score.

Common questions

Is machine learning used in geoscience?
Yes, widely: for well-log interpretation, mineral and soil mapping, seismic interpretation, earthquake detection and remote sensing. Results are usually checked against field observations and expert interpretation.
Why is spatial cross-validation important in geoscience?
Nearby samples are similar, so random splits put near-copies of test points in the training set and inflate accuracy. Holding out whole wells, regions or blocks gives a realistic estimate of performance where you have no data.
Which Python libraries do geoscientists use for machine learning?
scikit-learn and PyTorch for models, pandas and GeoPandas for tables, rasterio and xarray for gridded data, lasio for well logs and ObsPy for seismology are common choices.
Do I need a geoscience degree to work in this area?
For most geoscience roles, yes or equivalent experience, because interpretation is the core of the job. Data scientists without the degree usually work in mixed teams and learn the domain on the job.

First Principles, the SchoolWhool newsletter

One machine learning idea, explained properly, every week.

The intuition, the common mistake, and a five-minute way to try it yourself. Written by Gaurav.

Learn the machine learning behind it, from first principles.

Start with Python from zero, free. Every stage after that builds on the last, and a person answers your doubts.