Taking well log plots one step further using Python and matplotlib

Final well log plot generated using Python’s matplotlib library and contains variable fill on the gamma ray, and a neutron-density crossover fill. Image by author.

Well log plots are a common visualization tool within geoscience and petrophysics. They allow easy visualization of data (for example, Gamma Ray, Neutron Porosity, Bulk Density, etc) that has been acquired along the length (depth) of a wellbore.

I have previously covered different aspects of making these plots in the following articles:

In this article, I will show how to combine these different methods into a single…


Appending Multiple LAS Files to a Pandas Dataframe

Crossplots of density vs neutron porosity from multiple wells using the Python library matplotlib. Imagae created by the author.

Log ASCII Standard (LAS) files are a common Oil & Gas industry format for storing and transferring well log data. The data contained within is used to analyze and understand the subsurface, as well as identify potential hydrocarbon reserves. In my previous article: Loading and Displaying Well Log Data, I covered how to load a single LAS file using the LASIO library.

In this article, I expand upon that by showing how to load multiple las files from a subfolder into a single pandas dataframe. Doing this allows us to work with data from multiple wells and visualize the data…


Using fill_betweenx() in matplotlib to add variable color fills and hatches for geological lithology data

Well log plot with gamma ray, neutron porosity and bulk density data plotted alongside lithology data.
Well log plot with gamma ray, neutron porosity and bulk density data plotted alongside lithology data.
Well log plot with gamma ray, neutron porosity and bulk density data plotted alongside lithology data. Image created by the author.

Adding lithology information to a well log plot can enhance a petrophysical or geological interpretation. It can be used to understand why some log responses may behave the way they do. This data may have been sourced from a previous mineralogical interpretation or from mud logs.

In my previous article: Enhancing Visualization of Well Logs With Plot Fills, we saw: how to apply fixed color fill between a curve and the edge of a track, how to apply a density-neutron crossover fill and how to apply a variable fill based upon the value of curve being plotted.

In this article…


Utilizing the power of matplotlib to display wellbore image data

Logging While Drilling image data displayed using matplotlib in Python. Image created by the author.

Introduction

Borehole image logs are false-color pseudo images of the borehole wall generated from different logging measurements/tools. How borehole images are acquired differs between wireline logging and logging while drilling (LWD). In the wireline environment measurements are made from buttons on pads that are pressed up against the borehole wall and provide limited coverage, but at a high resolution. In contrast, in the LWD environment measurements are made from sensors built into tools that form part of the drillstring/tool assembly, and using the tool rotation, provide full 360-degree coverage. LWD image data is often split into sectors, the number of which…


Applying Color Infill to Well Log Data Using matplotlib and fill_betweenx()

Log plot shading using fill_betweenx. [Image Created by Author]

Matplotlib is a great library to work with in Python and it is one that I always go back to time and time again to work with well logs. Due to its high degree of flexibility it can be tricky to get started with it at first, but once you have mastered the basics it can become a powerful tool for data visualization.

When working with well log data it can be common to apply color fills to the data to help quickly identify areas of interest. For example, identifying lithologies or hydrocarbon bearing intervals. Most of the time when…


A short guide on applying a linear regression in Python to semi-log data

Photo by Ekaterina Novitskaya on Unsplash

Core data analysis is a key component in the evaluation of a field or discovery, as it provides direct samples of the geological formations in the subsurface over the interval of interest. It is often considered the ‘ground truth’ by many and is used as a reference for calibrating well log measurements and petrophysical analysis. Core data is expensive to obtain and not acquired on every well at every depth. Instead, it may be acquired at discrete intervals on a small number of wells within a field and then used as a reference for other wells.

Once the core data…


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. …


Exploring where data is and where it isn’t

Photo by Vilmos Heim on Unsplash

Exploratory Data Analysis (EDA) is an integral part of Data Science. The same is true for the petrophysical domain and can often be referred to as the Log QC or data review stage of a project. It is at this stage that we begin to go through the data in detail and identify what data we really have, where we have it and what is the quality of the gathered data.

A significant portion of the time that we spend (in some cases up to 90%! — Kohlleffel, 2015) working with well log data is spent trying to understand it…


Photo by Maxwell Nelson on Unsplash

Hands-on Tutorials

Normalization of well log data is a common and routine process within a petrophysical workflow and is used to correct for variations in logging curves between wells. These variations can arise due a number of different reasons such as incorrect tool calibrations, varying tool vintage and changes in borehole environmental conditions between the wells.

In this article we will go over:

What is normalization?

Normalization is the process of re-scaling or re-calibrating the well logs so that they are consistent with other…


Photo by Chris Ried on Unsplash

Anyone who has worked or is currently working within the oil and gas industry will understand that there are a large variety of formats that well log data can be stored in. Some of the common formats that we as petrophysicists work with include LAS, ASCII and CSV files. Many of these formats can easily be loaded into a Python script ot Jupyter Notebook.

Many months back, I put together a series of Jupyter Notebooks illustrating different ways of working with well log data. These can be accessed at the link below, along with a Jupyter Notebook version of this…

Andy McDonald

Petrophysicist | Geoscientist | Data Scientist with a strong interest in data analytics, machine learning and artificial intelligence.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store