Welcome to the latest x lines of Python post, in which we have a crack at some fundamental subsurface workflows... in as few lines of code as possible. Ideally, x < 10.
We've met curves once before in the series — in the machine learning edition, in which we cheated by loading the data from a CSV file. Today, we're going to get it from an LAS file — the popular standard for wireline log data.
Just as we previously used the pandas library to load CSVs, we're going to save ourselves a lot of bother by using an existing library — lasio by Kent Inverarity. Indeed, we'll go even further by also using Agile's library welly, which uses lasio behind the scenes.
The actual data loading is only 1 line of Python, so we have plenty of extra lines to try something more ambitious. Here's what I go over in the Jupyter notebook that goes with this post:
- Load an LAS file with lasio.
- Look at its header.
- Look at its curve data.
- Inspect the curves as a pandas DataFrame.
- Load the LAS file with welly.
- Look at welly's Curve objects.
- Plot part of a curve.
- Smooth a curve.
- Export a set of curves as a matrix.
- BONUS: fix some broken things in the file header.
Each one of those steps is a single line of Python. Together, I think they cover many of the things we'd like to do with well data once we get our hands on it. Have a play with the notebook and explore what you can do.
Next time we'll take things a step further and dive into some seismic petrophysics.