lasio: Read/Write Well Data from LAS Files

0.32 · active · verified Fri Apr 17

The `lasio` library (version 0.32) provides robust tools for reading and writing well data from Log ASCII Standard (LAS) files, supporting both LAS 1.2 and 2.0 specifications. It is actively maintained with regular updates for bug fixes and feature enhancements, typically releasing new minor versions a few times a year.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to read a LAS file (simulated from a string for simplicity) using `lasio.read()`, access well header information, retrieve curve data, and convert the data into a Pandas DataFrame.

import lasio
import io

# Simulate a LAS file content for demonstration
las_content = """~VERSION
VERS.      2.00:  LAS Version
WRAP.      NO:   No line wrapping
~WELL
STRT.M     10.00: START DEPTH
STOP.M     20.00: STOP DEPTH
STEP.M     0.50:  STEP
NULL.      -999.25: NULL VALUE
WELL.      EXAMPLE WELL: WELL
COMP.      EXAMPLE CO: COMPANY
~CURVE
DEPT.M     : Depth
GR.API     : Gamma Ray
NEUT.V/V   : Neutron
~A  DEPT      GR      NEUT
  10.000   100.0   0.300
  10.500   105.0   0.310
  11.000   110.0   0.320
  11.500   112.0   0.315
  12.000   115.0   0.325
"""

# Read the LAS file from a string (or from a path: lasio.read('path/to/file.las'))
las_file_obj = io.StringIO(las_content)
l = lasio.read(las_file_obj)

# Access well information
print(f"Well Name: {l.well.WELL.value}")
print(f"Company: {l.well.COMP.value}")

# Access curve data
print(f"Gamma Ray Curve (first 3 values): {l['GR'][:3].tolist()}")
print(f"Depth Curve (last 2 values): {l['DEPT'][-2:].tolist()}")

# Convert to Pandas DataFrame
df = l.df()
print("\nDataFrame head:")
print(df.head())

view raw JSON →