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.1.tar.gz (114.1 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.1-cp313-cp313-win_amd64.whl (1.2 MB view details)

Uploaded CPython 3.13Windows x86-64

las_rs-0.2.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

las_rs-0.2.1-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.1-cp312-cp312-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

las_rs-0.2.1-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.1-cp311-cp311-macosx_11_0_arm64.whl (1.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

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

Uploaded CPython 3.10Windows x86-64

las_rs-0.2.1-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.1-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.1.tar.gz.

File metadata

  • Download URL: las_rs-0.2.1.tar.gz
  • Upload date:
  • Size: 114.1 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.1.tar.gz
Algorithm Hash digest
SHA256 0baa15fa543f973891ec5eb7c2f3c3a280e288886774a1581540ea33e7aeacaf
MD5 27ec6dc921c5ff4bd0e19d18dc49dc76
BLAKE2b-256 e3c6268148744c19815d35b4e6067dcc21ab43d399b92d581dc8cac08d51621e

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1.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.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.1-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.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 88b9a0d0bc63fbf7dc19f2eef206602a37ea0abb5220053cda82849486f42b05
MD5 a1b8e44dedb7be33c8bccc0f7ae1b2a8
BLAKE2b-256 08091c11fc7fb81cdf02eda03c4590576ae53839cfa1c75114a31e47a821f9a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ca92e8992aca685aa96d28ab5c159a7a82338531b395f8204c45d1ca894bbdd0
MD5 c5b3c01590cb95a113cd0ccadb59e4c9
BLAKE2b-256 69999591706b4429a147b78390073de94bc1f651606176c8b168b9534138c976

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2d90c4b073f578d5226dd80a659284b68c5570542fc2fc7bb653fc75da20c9ae
MD5 4fd670ae206b340e117aef812615f967
BLAKE2b-256 e50192c37a2594e69bc02e84c600f8135d583e2160412248470c09b0a24e509d

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.1-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.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 92fe5cacd01147d86ee0ba4296d8aa7748e73469036e35da60c9f8763929415f
MD5 c1915816528274e80942874d065f2950
BLAKE2b-256 b361b983150bacfb8480b06afd4a7dd56f11ee27a132a1ef079479f1377ca592

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4b74586c60a98197c03172da8336755140400fccb5f0b2c8457063364b9e72ef
MD5 f5fbcac6d4f5b6dc5a9b697d7bdf4f56
BLAKE2b-256 5fd3ef9b6db9a85ac3ece0cbd1e7dddaed1f9c23a287df0a9cb06923a6d18bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 23db3c4e8f9627ea5093c895bd9c95ed34883e406c9e16fea4062352f2fcc754
MD5 92f2e34823068672bca341f819704b4f
BLAKE2b-256 0de54ac8a7983d2a6358342f9938bf8a527546483a8815eff428def4d5975aa0

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.1-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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a0db72e4eec4b2e53264b2a720eaac26a9fe2c32e5ca73129a6ab6ba0f119158
MD5 1899321a0e288b67a54326e3fbd14b5a
BLAKE2b-256 bca50f4cea6d821524f5e017f33aa99ab316935f6d5def294f4e8ac7f3bf5a9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 31245bcd28bdaba0b469de52c88e22e34309e0de489d5a346676a4d40be0c107
MD5 fa434974c7f008d255150d733fb1240a
BLAKE2b-256 35c1caf20efb15c4823513bae0e20e230ff4c471bbc53ba671dd1015972f1f95

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f196eeb2d70aea0ac8a6fb9434afdfdb9765f3a40344c0fe925b739769a8f954
MD5 99b0e810113fe4f2b033fb13ee698b02
BLAKE2b-256 79dd375b417dcf2fcae90894f413a7d1a86cf8dab2eabf338903610f5084c809

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: las_rs-0.2.1-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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 f056a1be44348ec76a97a2e68a2490d128bcfeaf72be1aa56cd6729f320db598
MD5 dc8ed1adb2c03374429b269811f85d0c
BLAKE2b-256 b1afcb8f94b5d46d8656f9fc63d997495767bc09684a8f7c6d0e107fc2a702e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4317ab66eb9d05b50b58eafef97f529b9d4b2f0d3663c0a5b3ec39cd7d9a31ce
MD5 43a6bd0432439cfb85f082167450a438
BLAKE2b-256 593ea7e66f59a221b3051373bf16554b9aff889ffc997f116fdd968d254190fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for las_rs-0.2.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 767f0c8dd906b5649004ae3242fd95351bb55dceebce8b40aa1e645ab5350228
MD5 b9dbe8abc909444c38cc1c0d918df2e8
BLAKE2b-256 bc013fb7347724360b65d62da23655f3a1c3c2651a482fa50796632fd654fb89

See more details on using hashes here.

Provenance

The following attestation bundles were made for las_rs-0.2.1-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