Exploratory Data Analysis with Well Log Data
By: Andy Mcdonald
Tags: Seaborn, Geoscience, Python, Matplotlib, Petrophysics

Photo by Lukas Blazek on Unsplash

Once data has been collated and sorted through, the next step in the Data Science process is to carry out Exploratory Data Analysis (EDA). This step allows us to identify patterns within the data, understand relationships between the features (well logs) and identify possible outliers that may exist within the dataset. In this stage, we gain an understanding about the data and check whether further processing is required or if cleaning is necessary.

As petrophysicists/geoscientists we commonly use log plots, histograms and crossplots (scatter plots) to analyse and explore well log data. Python provides a great toolset for visualising the data from different perspectives in a quick and easy way.

In this article we will use a subset of the dataset that was released by Xeek and FORCE as part of a competition to predict facies from well logs. We will be visualising the data using a mixture of matplotlib, seaborn and missingno data visualisation libraries.

The visualisations we will cover will allow us to:

Identify where we have or don’t have data

Understand the data distribution

Visualise data affected by bad hole conditions

The notebook for this article can be found on my Python and Petrophysics Github series which can accessed at the link below:

https://github.com/andymcdgeo/Petrophysics-Python-Series

Loading the Data and Libraries

The first step for any project is loading the required libraries and data.

For this workthrough, we are going to call upon a number of plotting libraries: seaborn, matplotlib and missingno as well as math, pandas, and numpy.

import pandas as pd

import matplotlib.pyplot as plt

import seaborn as sns

import math

import missingno as msno

import numpy as np

The dataset we are using forms part of a Machine Learning competition run by Xeek and FORCE (https://xeek.ai/challenges/force-well-logs/overview). The objective of the competition was to predict lithology from a dataset consisting 98 training wells each with varying degrees of log completeness. The objective was to predict lithofacies based on the log measurements.

In order to keep the plots and data manageable in this article I have used a subset of 12 wells from the training data. The data has already been collated into a single csv file with no need to worry about curve mnemonics. To load the subset of data in we can call upon pd.read_csv.

data = pd.read_csv('Data/xeek_train_subset.csv')

Once the data has been loaded, we can confirm the number and names of the wells using the following commands:

# Counts the number of unique values in the WELL column

data['WELL'].nunique()

Which will return 12 as expected.

# Gets the unique names from the WELL column

data['WELL'].unique()

This returns an array object with the well names.

array(['15/9-13', '15/9-15', '15/9-17', '16/1-2', '16/1-6 A', '16/10-1', '16/10-2', '16/10-3', '16/10-5', '16/11-1 ST3', '16/2-11 A', '16/2-16'], dtype=object)

Identifying Gaps

Missing data within well logging can arise for a number of reasons including:

Tool failures & problems

Missing by choice (i.e. tools not run due to budgetary constraints)

Human error

Vintage datasets

Issues arising from the borehole environment

There are a number of ways that we can use to identify where we have data and where we don’t. We will look at 2 ways to visualise missing data.

missingno Library

The first method we will look at is using the missingno library, which provides a nice little toolbox, created by Aleksy Bilgour, as a way to visualise and understand data completeness. More details on the library can be found at https://github.com/ResidentMario/missingno. If you don’t have this library, you can quickly install it using pip install missingno into your terminal.

The missingno toolbox contains a number of different visualisations, but for this article we will focus on the matrix plot and bar plot. The matrix plot can be called by: