Skip to main content

High-performance LAS file parser and writer for Python, written in Rust

Project description

las-rs

A high-performance LAS file parser and writer, written in Rust with first-class Python bindings.

Reads and writes LAS 1.2, 2.0, and 3.0 well log files. Designed as a fast, drop-in alternative to lasio.

Available both as a Rust crate (las_rs on crates.io — pure Rust, no Python dependency) and as a Python package (las-rs on PyPI).

Installation

Python:

pip install las-rs

Prebuilt wheels are available for Python 3.10 -- 3.13 on Linux (x86_64), macOS (ARM), and Windows (x64).

Rust:

cargo add las_rs

The crate is pure Rust by default — no PyO3 or numpy in your dependency tree.

Quick start

import las_rs

# Read a LAS file
las = las_rs.read("welllog.las")

# Access header metadata
print(las.well["WELL"].value)   # Well name
print(las.well["STRT"].value)   # Start depth
print(las.index_unit)           # "M", "FT", etc.

# Access curve data (numpy arrays)
gr = las["GR"]
depth = las.index

# Iterate curves
for name, data in las.items():
    print(name, data.shape)

# Convert to pandas DataFrame
df = las.df()

Reading options

las = las_rs.read(
    "welllog.las",
    encoding="latin-1",              # Auto-detected if omitted
    ignore_header_errors=True,       # Continue past malformed headers
    ignore_data=True,                # Parse headers only (fast)
    null_policy=["-999", "-999.25"], # Custom null markers
    dtypes={"STATUS": str},          # Keep specific curves as strings
)

read() accepts a file path, a pathlib.Path, a string containing LAS content, or any file-like object with a .read() method.

Working with curves

import numpy as np

# Add a curve
las.append_curve("CALC", data=np.zeros(len(las.index)), unit="GAPI", descr="Computed")

# Update a curve
las.update_curve(mnemonic="GR", data=new_data)

# Delete a curve
las.delete_curve(mnemonic="CALC")

# Stack selected curves into a 2D array
matrix = las.stack_curves(["GR", "NPHI", "RHOB"])

# Get full curve metadata
curve = las.get_curve("GR")
print(curve.mnemonic, curve.unit, curve.descr)

Writing and export

# Write LAS file
las.write("output.las", version=2.0)

# Export to CSV
las.to_csv("output.csv", units=True)

# JSON
json_str = las.json

Depth conversion

depth_m  = las.depth_m    # Index converted to meters
depth_ft = las.depth_ft   # Index converted to feet

Rust

The same engine is usable directly from Rust, without the Python layer:

use las_rs::{read_file, parse, ReadOptions, NullPolicy};

// Read a file from disk (encoding auto-detected).
let las = read_file("welllog.las")?;

// Header metadata.
println!("well:       {:?}", las.well_value("WELL"));
println!("index unit: {:?}", las.index_unit);

// Curve data — NULLs are represented as f64::NAN.
for name in las.curve_mnemonics() {
    let n = las.curve_data(name).map_or(0, |d| d.len());
    println!("{name}: {n} samples");
}

// Access the index (first) curve and a named curve.
let depth = las.index().unwrap_or(&[]);
if let Some(gr) = las.curve_data("GR") {
    println!("first GR sample at depth {}: {}", depth[0], gr[0]);
}

// Parse from an in-memory string, with custom options.
let opts = ReadOptions { null_policy: Some(NullPolicy::Common), ..Default::default() };
let las2 = las_rs::parse_with("~VERSION\nVERS. 2.0:\n~ASCII\n", &opts)?;

// Write back out.
las.write_file("out.las")?;
let text: String = las.to_las_string()?;
# let _ = (parse, las2, text);
Ok::<(), las_rs::LasError>(())

Full API docs: docs.rs/las_rs.

License

MIT

Project details


Download files

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

Source Distribution

las_rs-0.2.0.tar.gz (111.7 kB view details)

Uploaded Source

Built Distributions

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

las_rs-0.2.0-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

las_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

las_rs-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

las_rs-0.2.0-cp312-cp312-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.12Windows x86-64

las_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

las_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

las_rs-0.2.0-cp311-cp311-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.11Windows x86-64

las_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

las_rs-0.2.0-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

las_rs-0.2.0-cp310-cp310-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.10Windows x86-64

las_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

las_rs-0.2.0-cp310-cp310-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

File details

Details for the file las_rs-0.2.0.tar.gz.

File metadata

  • Download URL: las_rs-0.2.0.tar.gz
  • Upload date:
  • Size: 111.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for las_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c05d1f67cbd6e1d3f45225e62bd10320f4541170235eec4f02fc680b7e53bc80
MD5 e1e18f18ec506cd84a438645c87b5188
BLAKE2b-256 0862dce29430db7848294188c02f14ff314ad28516e1bd423adf76f0cedb05f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0.tar.gz:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for las_rs-0.2.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 de288222e93cc49c27a7d14c941e14af68c505a23ae709ecd40b9abc11eced90
MD5 60210ed4a8087cd9a6661dcaf8096267
BLAKE2b-256 544c90cc4544f826a74d807158f1d6fbab5c656be467e7b4f1e3a07fc3a8d8bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 195efdec1aa66a2298cbb0f82c3733d3b3d47fe1cad2665b45e46a95cdbbc456
MD5 987b0d2194a72c03e6620ae9b29b7ad6
BLAKE2b-256 d685b17eb4bf6e2684aede330bcb899be8dfc4820bc9f1ca31e91328cdec837a

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b41780e357e3079b8175e33b1ceb69b5d8759c2cf7b81386686a1f3835a9cd0e
MD5 08df980fca744293f1afc5002523f2a4
BLAKE2b-256 1e2af0e3e9b53506e14ebfd9379016433476ad64bae18590f8c62eb07f6b1fa7

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for las_rs-0.2.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d9e101b2278c87beae12bd0d857a7ef7da181c8091a4e5a6ec22d4f617558801
MD5 b4285de510d80310f582ba9a6b8a63b8
BLAKE2b-256 4e07120504a437d8268c5a670d0e3fcf28515690fb0d69d165eef0db04fd03f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp312-cp312-win_amd64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ad251322d07ec79a1dc5b53fd6b3a89faea2e9c585c74807541c70e1d6ff336
MD5 3f8023540667f963ae2a8f6767c679eb
BLAKE2b-256 e3ef705a82b644fe2fe5eb51421ff2068637a50bf6f3186596a6b67b3af6630a

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ce3b1bf97765018a58285b75a55e88930294d063ca46c079b88dc3b6dc59cff7
MD5 5ddd9fe58efe54be1a1774c5e9165a13
BLAKE2b-256 6e8891b9040bdd49e40f9aa9504103eeef7aad0d33101828b3f5d924da4d4fc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for las_rs-0.2.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5a5ec2df89acc892c7e6b9e29089942298b58e50012aa403002623c3c85270b7
MD5 14f2f921d76c0c7742942c531143acb6
BLAKE2b-256 6283f3106a491e77b205e866bc0cb1bc0c5f8e3882af47fcbc016fa0b77a9db9

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp311-cp311-win_amd64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a387065344f544cead40b81b2227d581b592a86afaacbd6284c2290edca9e8df
MD5 78334b7c805208cd9f53a4c481fa9c9c
BLAKE2b-256 e08dcf7756779cc42224c992b5cd99252299981f9e5427089b28e9faee03c958

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b8d2eb1a3a780ddcee2a01d1103cc8f75bc52769ddfa7e914d81089d1849037
MD5 1325ec3cbc4222e2ea1ec8d3873981dd
BLAKE2b-256 71c35fc2de38b7d760c031ce8e35161ec068b5c618e9dec63e0554d981e58121

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for las_rs-0.2.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 875f901c4762bbc8c736b5f9c486258a3e31ac638cfc63470df5ddb950ad2ec6
MD5 211ab40a348437d062e8cb8088896d43
BLAKE2b-256 9072cb3796af22fafa0ea7b80178dfbb38202fe74737b35c929f597a48a8c5c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp310-cp310-win_amd64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0da8d42d40f9c0913f206149ac76967d97a22e6f1a0a2097c1101b45b392c96a
MD5 9c25eb6da70b88064fcf2fba79468342
BLAKE2b-256 1f802f01ab4e8d68127e1d096f63a5cfecfce9f10a6d0292156064eadd24382f

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file las_rs-0.2.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9263cf195ccaca046f8e8945def1f100372c4663079f7ab9a427753da8c6d301
MD5 accffa17c9dcdf2f50066584554329b7
BLAKE2b-256 767b64f45efb31ace890d5b88df2787b2b4a2bf6f082f89d04fde35d3572e06e

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.0-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: publish.yml on kkollsga/las-rs

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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