Skip to main content

A high-performance LAS (Log ASCII Standard) file reader written in Rust

Project description

las_read_rs 🦀

PyPI version CI

High-performance LAS (Log ASCII Standard) file reader written in Rust with Python bindings. A faster alternative to pure Python implementations, capable of parsing large geophysical log files efficiently.

⚡ Performance

Benchmarked with a 92 MB LAS file (400 curves, 21,842 points each):

Library Read Time Speedup
las_read_rs (Rust) ~1.0s 9x faster 🚀
lasio (Python) ~9.0s baseline

🚀 Installation

pip install las_read_rs

Optional dependencies for export features:

pip install pandas          # For DataFrame and CSV export
pip install openpyxl        # For Excel export
pip install polars          # For Polars DataFrame

📖 Quick Start

import lasio_rs

# Read a LAS file
las = lasio_rs.read("well_log.las")

# Access metadata
print(las.version['VERS'].value)  # "2.0"
print(las.well['WELL'].value)     # Well name

# Access curve data directly
depth = las['DEPT']  # Returns list of floats
gr = las['GR']       # Gamma Ray values

# List all curves
for curve_name in las.keys():
    curve = las.curves[curve_name]
    print(f"{curve_name} ({curve.unit}): {len(curve.data)} points")

📊 DataFrame Conversion

# Convert to pandas DataFrame
df = las.to_df()
print(df.head())

# Convert to polars DataFrame
df_polars = las.to_polars()

💾 Export Formats

CSV Export

las.to_csv("output.csv")

Excel Export

las.to_excel("output.xlsx", sheet_name="Well Data")

LAS Export (2.0 and 3.0)

# Export as LAS 2.0
las.to_las("output_v2.las", version="2.0")

# Export as LAS 3.0
las.to_las("output_v3.las", version="3.0")

🔧 API Reference

lasio_rs.read(path)

Reads a LAS file and returns a LASFile object.

LASFile Properties

Property Description
version Version section (VERS, WRAP)
well Well information (STRT, STOP, STEP, NULL, WELL, etc.)
curves Curve metadata and data
params Parameter section

LASFile Methods

Method Description
las[mnemonic] Get curve data as list
las.keys() List curve mnemonics
las.to_df() Convert to pandas DataFrame
las.to_polars() Convert to polars DataFrame
las.to_csv(path) Export to CSV
las.to_excel(path) Export to Excel
las.to_las(path, version) Export to LAS format

🏗️ Building from Source

Requirements:

  • Python 3.7+
  • Rust (cargo, rustc)
  • maturin
git clone https://github.com/jemilianofl/lasio-rs.git
cd lasio-rs
pip install maturin
maturin develop --release

📋 Supported LAS Versions

  • ✅ LAS 2.0
  • ✅ LAS 3.0 (read support)
  • ✅ Export to LAS 2.0/3.0

🤝 Compatibility with lasio

las_read_rs provides a similar API to the popular lasio library:

# lasio style
import lasio
las = lasio.read("file.las")
depth = las['DEPT']

# las_read_rs style (same!)
import lasio_rs
las = lasio_rs.read("file.las")
depth = las['DEPT']

📄 License

MIT

🙏 Acknowledgments

  • Built with PyO3 for Python bindings
  • Uses nom for parsing
  • Inspired by lasio

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

las_read_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl (909.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file las_read_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for las_read_rs-0.1.5-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 46cfb2d442474a76bed03908b967503ad872a62c5a34c64a815f5488f21e4f67
MD5 016e81a984db201d3af1dd438b4913df
BLAKE2b-256 990fecf7e7763d3bcd61242807ca8e57f82832dc51cbcd14146ee32ff1d2cf6e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page