When working with well log data, most Python workflows eventually end up producing plots, notebooks, or fancy dashboards.
Before any of that, though, there’s a quieter step that tends to get less attention: opening the files and checking what’s actually in them.
You can do this by opening a LAS file in a text editor, but that doesn’t scale particularly well. It means switching between windows, and if you’re dealing with multiple files, a lot of unnecessary clicking.
This is where the terminal comes back into play.
Most Python users are familiar with the print statement. It’s a quick and easy way to inspect data, but once you have a lot of output with very little structure, it quickly turns into a wall of text that’s hard to scan.
This article looks at how the rich library can be used alongside lasio to make LAS file inspection clearer, faster, and easier to reason about without jumping straight to plots or notebooks.
Why Inspecting LAS files deserves more attention
If you’ve worked with subsurface data for any length of time, you’ll probably recognise this pattern.
You load a LAS file.
Convert it to a DataFrame.
Plot a few curves.
Only then do you notice that something isn’t quite right with what you are seeing.
Units aren’t what you expected.
Some curves are duplicated, synthetic, or derived.
NULL values look odd.
Half the curves don’t have any measured data.
None of these issues are particularly hard to fix.
The real problem is when they show up, which is usually after you’ve already invested time plotting, filtering, or building workflows downstream.
Inspection isn’t the most exciting part on any data based workflow, but it’s where most silent assumptions creep in. If you don’t explicitly check what’s in a file early on, you tend to carry those assumptions forward without realising it. Making inspection easier and more deliberate often improves everything that follows.
What lasio already does well
This is where lasio earns its place in a Python subsurface workflow.
You can see the full details of working with lasioin my earlier article:
Working With LAS Files in Python
A practical look at the LAS format, its structure, and how to work with it using lasio for subsurface well data
Rather than flattening a LAS file into an anonymous table or changing the structure of the content, lasio respects the original structure of the LAS format:
Curves remain curves, not just columns
Units and descriptions are preserved
Header sections are exposed as structured objects
In other words, lasio exposes meaning, not just numbers. It gives you access to the same information you would see if you opened the file in a text editor, but in a way that’s programmatic and consistent.
What lasio doesn’t try to do is make that information especially readable in the terminal. That’s not a limitation, it’s simply not its job. Its role is to parse the file faithfully, not to decide how you should look at it.
That gap is where another tool fits naturally.
Why rich is a good companion
rich is a Python library for formatting terminal output: tables, headings, colour, and simple layout.
I have previously covered rich in my earlier article:
More importantly, richis designed to enhance terminal output clarity, not just for decoration.
Used alongside lasio, it lets you present structured information in a way that’s easy to scan and reason about, without leaving the terminal or jumping straight into notebooks.
Crucially, rich:
Works in a plain terminal
Doesn’t require Jupyter (but can be used inside it)
Encourages quick inspection without visual overload
Used sparingly, it improves legibility without turning scripts into UI projects. The goal here isn’t presentation. It’s making it easier to see what’s in a file before you start doing anything clever with it.
Inspecting curve metadata properly
One of the first questions worth asking of any LAS file is simple:
What curves and information are actually in here?
Printing curve metadata line by line works, but it becomes hard to scan once files get large or messy.
Using rich, we can turn that information into a compact table that makes patterns obvious.
import lasio
from rich.console import Console
from rich.table import Table
las = lasio.read(”159-19A_LFP.las”)
console = Console()
table = Table(title=”LAS Curve Summary”)
table.add_column(”Mnemonic”, style=”cyan”, no_wrap=True)
table.add_column(”Unit”, style=”green”)
table.add_column(”Description”, style=”white”)
for c in las.curves:
table.add_row(
c.mnemonic,
c.unit or “”,
c.descr or “”
)
console.print(table)This immediately highlights:
duplicated curves
missing units
vague descriptions
unexpected additions
You’re not interpreting anything yet. You’re just making the structure visible.
Compare this with the print statement output:
Inspecting header information without scrolling fatigue
The same approach works well for LAS header sections.
Version information, well metadata, and parameters are all structured data, but they’re often printed as long, hard-to-scan lists.
A small helper function keeps things consistent:
def print_header_table(title, section):
table = Table(title=title)
table.add_column(”Mnemonic”, style=”cyan”, no_wrap=True)
table.add_column(”Unit”, style=”green”)
table.add_column(”Value”, style=”yellow”)
table.add_column(”Description”, style=”white”)
for item in section:
table.add_row(
item.mnemonic,
item.unit or “”,
str(item.value),
item.descr or “”
)
console.print(table)Using this function, you can inspect each section cleanly:
print_header_table(”LAS Version Information”, las.version)
print_header_table(”Well Information”, las.well)
if len(las.params) > 0:
print_header_table(”Parameter Information”, las.params)This makes important details such as depth range, step size, NULL value hard to miss.
Las File information quickly displayed in the terminal for multiple sections.
This doesn’t require plots.
A quick completeness check that scales
Once you’ve converted a LAS file to a DataFrame, it’s often useful to know which curves are mostly empty.
This doesn’t require plots.
In a few seconds, you can see:
curves that are mostly missing
curves that are effectively constant
candidates for removal before further analysis
Again, the goal isn’t automation. It’s awareness.
Highlighting data completeness directly in the terminal
Once you start inspecting LAS files regularly, one of the most useful questions you can ask early on is a simple one:
How complete is each curve?
It’s very common for LAS files to contain curves that are only partially populated, completely empty over large intervals, or present only as placeholders. You can discover this later in plots or statistics, but by then you’ve often already invested time downstream.
Using rich, we can fold a basic completeness check directly into the same table we’re already using to inspect curve metadata.
The example below calculates the fraction of missing values for each curve and uses colour to flag potential issues immediately:
Green curves are largely complete
Yellow curves are partially populated and may need attention
Red curves are mostly missing and are often not worth using
Curves that don’t appear in the DataFrame — typically the index curve or duplicate mnemonics — are shown in a dimmed style to distinguish them from usable data.
from rich.console import Console
from rich.table import Table
import numpy as np
import lasio
las = lasio.read(”L05-15-Spliced.las”)
console = Console()
df = las.df()
table = Table(title=”LAS Curve Summary (with completeness)”)
table.add_column(”Mnemonic”, style=”cyan”, no_wrap=True)
table.add_column(”Unit”, style=”green”)
table.add_column(”Missing %”, justify=”right”)
table.add_column(”Description”)
for c in las.curves:
mnemonic = c.mnemonic
if mnemonic not in df.columns:
# Likely the index curve or a duplicate mnemonic
table.add_row(
mnemonic,
c.unit or “”,
“—”,
c.descr or “”,
style=”dim”
)
continue
values = df[mnemonic]
missing_frac = values.isna().mean()
if missing_frac > 0.18:
style = “red”
elif missing_frac > 0.15:
style = “yellow”
else:
style = “green”
table.add_row(
mnemonic,
c.unit or “”,
f”{missing_frac:.0%}”,
c.descr or “”,
style=style
)
console.print(table)What this gives you is a quick, scan-friendly overview of the file:
which curves are present
which ones are mostly usable
which ones are likely derived, patchy, or empty
All without leaving the terminal or generating a single plot.
This kind of table doesn’t replace proper analysis, but it helps you make better decisions earlier.
Instead of asking “why does this curve look strange?” halfway through a workflow, you can decide upfront whether a curve is worth including at all. In practice, this often leads to simpler code, cleaner plots, and fewer silent assumptions creeping in.
The thresholds used here are intentionally simple and conservative. They’re not rules, but they help illustrate the above. The goal isn’t to automate decisions, but to make the state of the data obvious at a glance.
And that’s the recurring theme of this approach:
inspect first, decide deliberately, then move on.
A small but meaningful workflow shift
Used together, lasio and rich encourage a slightly different order of operations:
Load the file
Inspect structure and metadata
Decide what’s usable
Then move on to plots or models
That shift sounds minor, but it’s where a lot of downstream problems quietly disappear.
You don’t need more automation at this stage. You need fewer assumptions.
Summary
Inspecting LAS files rarely feels like the most interesting part of a workflow, but it’s often the most consequential.
Tools like lasio already do the hard work of exposing the structure and metadata of a LAS file. Adding rich on top doesn’t change what the data is, it simply makes that information easier to see and reason about in the terminal.
By surfacing things like curve availability, units, and basic completeness early on, you can avoid carrying silent assumptions further downstream. The aim isn’t to automate decisions or replace plots, but to make the state of the data obvious before doing anything more involved.
You may think this is trivial for a single LAS file and that you can just open it and check the contents, but if you have multiple datasets loaded into Python, you can leverage the rich library to help visualise the contents easily.
A small amount of structured terminal output goes a long way. When inspection is easy, it tends to happen more often, and that usually leads to cleaner workflows and fewer surprises later on.







