Unsupervised waveform classification is a proven technology for objective seismic facies analysis, yet its application often remains confined to proprietary commercial software. This tutorial bridges that gap by presenting a complete, hands-on workflow that empowers geoscientists to implement this technique using open-source Python libraries. The methodology is built around the K-Means clustering algorithm and is demonstrated through a progressive series of examples: a foundational 2D synthetic model, a more complex 2.5D meandering channel system, and a final application to a real-world 3D seismic volume. Applying this workflow to real data successfully identifies distinct seismic facies and delineates key geological features such as channels and fan systems. To ensure practical reproducibility and emphasise the hands-on nature of this tutorial, the entire workflow is accompanied by open-source Jupyter notebooks. Readers will learn the essential, practical steps to independently execute the entire analysis, from extracting waveform data around a horizon to determining the optimal number of facies with the elbow method and visualising the final, interpretable maps. The key takeaway is the ability to move beyond being a user of black-box software to becoming a creator of customised analytical workflows and code. This guide provides the practical knowledge needed to apply a powerful, data-driven interpretation technique, enabling greater flexibility, understanding, and innovation without the need for a commercial licence.
Introduction
Seismic exploration ultimately seeks to construct a geologically consistent reservoir model that captures both the spatial distribution of petrophysical properties and the heterogeneities that govern fluid flow. Because the recorded seismic signal arises from reflectivity contrasts between subsurface layers, amplitude variations within a seismic trace commonly reflect changes in depositional environment, lithologic composition, or fluid saturation. When those variations are examined collectively, the resulting seismic character can be interpreted in terms of seismic facies, providing quantitative insight into stratigraphic architecture and sedimentological processes.
In this context, facies are bodies of rock with distinctive attributes (texture, composition, and fossil content) that record the conditions of their depositional environment (Reading 1996). Their seismic analogue, seismic facies, are defined as mappable units composed of groups of reflections whose parameters differ from adjacent units and are recognised from reflector-related characteristics such as reflection amplitude, waveform frequency, geometry and internal/external configuration, lateral continuity, and, where appropriate, interval velocity (Sheriff 1976; Mitchum et al. 1977; Vail 1987). Classifying these seismic facies is foundational from basin screening and prospect evaluation through to reservoir characterisation and field development, because assigning depositional facies to chronostratigraphic units provides an early indication of hydrocarbon system viability and where to focus subsequent work. More broadly, seismic facies analysis offers an effective route to infer lithology and depositional environment, insights that are critical for reliable reservoir models (Fashagba et al. 2020).
Against this backdrop, unsupervised waveform classification groups traces or horizon-centered snippets are similar in seismic character and produce data-driven seismic facies maps without imposing prior geological labels, which is precisely the objective of the workflow developed below. Equally important, waveform-based facies maps are a qualitative interpretation aid. By organising seismic character into coherent patterns beyond simple amplitude contrasts, they help the interpreter hypothesise depositional processes and lithologic variability more rapidly and consistently (Sheriff 1976; Fashagba et al. 2020).
A seismic wavelet, the compact pulse emitted or encoded by the source and recorded by the receivers, forms the fundamental building block of every seismic‐processing workflow (Robinson and Treitel 2008). Mathematically, a wavelet is a finite‐energy signal whose amplitude is largely confined to a limited interval on the time axis (Robinson 1962; 1964a; 1964b). Because different lithologies and fluid contents modify the propagating wavelet in characteristic ways, its shape has long been exploited to build seismic facies and stratigraphic models (Xu and Haq 2022) and to pinpoint reservoirs in structurally complex settings (Pico et al. 2019). Today, machine‐learning algorithms automate the extraction, clustering, and classification of these wavelets, allowing interpreters to map subtle spatial variations in waveform expression and deepen their understanding of reservoir heterogeneity. Seismic waveforms, or discrete segments of traces, are therefore classified to highlight facies changes within a user‐defined interval, whether that interval spans two distinct geologic formations or simply a constant time or depth window of interest. Within this interpretive framework, seismic waveform classification stands out as one of the most powerful unsupervised pattern‐recognition techniques currently available, via commercial software. By grouping traces with similar shapes and spectral attributes, the method produces purely data‐driven facies classes that require no a priori geologic constraint, only the definition of the analysis interval (Andersen and Boyd 2004).
The unsupervised classification itself is performed with the K‐means algorithm (MacQueen 1967). K-means is a partitioning algorithm that assigns each observation to one of k clusters by iteratively updating centroids to minimise within the Sum of Squared Errors (SSE). To determine the optimum number of clusters, the elbow criterion is applied to the within‐cluster sum‐of‐squares metric. The elbow method identifies the k at which further decreases in the Sum of Squared Errors (SSE) yield diminishing returns, the ‘elbow’ in the SSE-versus-k curve (Thorndike 1953). In K- means, SSE is the total squared distance from each data point to its assigned cluster centroid; lower SSE indicates tighter, more compact clusters. We selected the smallest k beyond which additional clusters produce only marginal SSE reduction.
The resulting class probabilities, or, equivalently, similarity volumes, are rendered as colour variations along the reflector of interest, yielding a seismic‐waveform distribution map that can be related directly to depositional facies (Priezzhev and Manral 2012). Because every seismic trace is classified solely based on its intrinsic waveform, the interpreter gains an unbiased view of how seismic character evolves across the survey area and, by implication, how geologic facies vary laterally and vertically.
All code, figures, and intermediate outputs referenced in this article are provided in three self‐contained Jupyter Notebooks (Python) hosted at https://github.com/roderickperez/seismicWaveformClassification.git. Readers are encouraged to rerun the notebooks, adjust parameters such as wavelet frequency, noise level, or K‐means initialisation, and observe first-hand how each modification influences both the synthetic data and the final classification results.