Skip to main content

Las-py

las-py is a zero-dependency Python library for parsing .Las file (Geophysical/Canadian well log files).

Currently supports only version 2.0 of LAS Specification. For more information about this format, see the Canadian Well Logging Society web page

  • What's new in 1.1.0

    • Export to csv
    • Export to csv without rows containing null values
    • Bug fixes
  • To Install

        $pip insatll las-py
    
  • Usage

        from las_py import Laspy
    
        my_las = Laspy('path_to_las_file.las')
    
  • Read data

       data = my_las.data
       print(data)
       #[[2650.0, 177.825, -999.25, -999.25], [2650.5, 182.5, -999.25,-999.25], [2651.0,180.162, -999.25, -999.25], [2651.5, 177.825, -999.25, -999.25], [2652.0, 177.825, -999.25, -999.25] ...]
    
        # get data with rows that has null value stripped
       data = my_las.data_stripped
       print(data)
       #[[2657.5, 212.002, 0.16665, 1951.74597], [2658.0, 201.44, 0.1966, 1788.50696], [2658.5, 204.314, 0.21004, 1723.21204], [2659.0, 212.075, 0.22888, 1638.328], [2659.5, 243.536, 0.22439, 1657.91699]...]
    
  • Get the log headers

        headers = my_las.header
        print(headers)
        # ['DEPTH', 'GR', 'NPHI', 'RHOB']
    
  • Get the log headers descriptions

        hds_and_desc = my_las.header_and_descr
        print(hds_and_desc)
        # {DEPTH': 'DEPTH', 'GR': 'Gamma Ray', 'NPHI': 'Neutron Porosity','RHOB': 'Bulk density'}
    
  • Get a particular column, say Gamma Ray log

        GR = my_las.column('GR')
        print(GR)
        # [-999.25, -999.25, -999.25, -999.25, -999.25, 122.03, 123.14, ...]
    
        # get column with null values stripped
        GR = my_las.column_stripped('GR')
        print(GR)
        # [61.61, 59.99, 54.02, 50.87, 54.68, 64.39, 77.96, ...]
    

    Note this returns the column, after all the data has been stripped off their null values, which means that valid data in a particular column would be stripped off if there is another column that has a null value at that particular row

  • Get the Well Parameters

    Presents a way of accessing the details individual well parameters.

    The details include the following:

      1. descr - Description/ Full name of the well parameter
      2. units - Its unit measurements
      3. value - Value
    
      start = my_las.well.STRT.value # 1670.0
      stop = my_las.well.STOP.value #  1669.75
      null_value = my_las.well.NULL.value #  -999.25
      # Any other well parameter present in the file, canbe gotten with the same syntax above
    
  • Get the Curve Parameters

    Presents a way of accessing the details individual log columns.

    The details include the following:

      1. descr - Description/ Full name of the log column
      2. units - Unit of the log column measurements
      3. value - API value of the log column
    
      NPHI = my_las.curve.NPHI.descr # 'Neutron Porosity'
      RHOB = my_las.curve.RHOB.descr # 'Bulk density'
      # This is the same for all log column present in the file
    
  • Get the Parameters of the well

    The details include the following:

      1. descr - Description/ Full name of the log column
      2. units - Unit of the log column measurements
      3. value - API value of the log column
    
      BHT = my_las.param.BHT.descr # 'BOTTOM HOLE TEMPERATURE'
      BHT_valaue = my_las.param.BHT.value # 35.5
      BHT_units = my_las.param.BHT.units # 'DEGC'
      # This is the same for all well parameters present in the file
    
  • Get the number of rows and columns

        rows = my_las.row_counts # 4
        columns = my_las.column_counts # 3081
    
  • Get the version and wrap

        version = my_las.version # '2.0'
        wrap = my_las.wrap # 'YES'
    
  • Get other information

        other = my_las.other
        print(other)
        # Note: The logging tools became stuck at 625 metres causing the data
        # between 625 metres and 615 metres to be invalid.
    
  • Export to CSV

    This writes a csv file to the current working directory, with headers of the well and data section only.

        my_las.to_csv('result')
        # result.csv has been created Successfully!
    

    result.csv

    DEPT RHOB GR NPHI
    0.5 -999.25 -999.25 -0.08
    1.0 -999.25 -999.25 -0.08
    1.5 -999.25 -999.25 -0.04
    ... ... ... ...
    1.3 -999.25 -999.25 -0.08

    Or get the version of csv with null values stripped

        my_las.to_csv_stripped('clean')
        # clean.csv has been created Successfully!
    

    clean.csv

    DEPT RHOB GR NPHI
    80.5 2.771 18.6 -6.08
    81.0 2.761 17.4 -6.0
    81.5 2.752 16.4 -5.96
    ... ... ... ...
    80.5 2.762 16.2 -5.06
  • Support

    las-py is an MIT-licensed open source project. You can help it grow by becoming a sponsor/supporter. Donate on Patreon

Metadata

Release files for las-py 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for las-py 1.1.0
File Size Uploaded Provenance Actions
las_py-1.1.0.tar.gz 5.3 kB Without provenance Details for las_py-1.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for las-py 1.1.0
File Interpreter ABI Platform Actions
las_py-1.1.0-py3-none-any.whl Python 3 none any Details for las_py-1.1.0-py3-none-any.whl

Total release size: 11.4 kB

Release files / las_py-1.1.0.tar.gz

Download URL las_py-1.1.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
da954128c80cffc2c997af5ff034c5cfcfbe9698bd709b01d190cbd1e35aa337
BLAKE2b-256 checksum
How to use checksums
83e5aa29844dbb68a68ae0031c55a196b6414e0674bdfefa137d0755d13bc8ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release files / las_py-1.1.0-py3-none-any.whl

Download URL las_py-1.1.0-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0ac1b2489ce410da25b030ad0e706ad3fce599b3beeea121b315adc4d358707
BLAKE2b-256 checksum
How to use checksums
570b8b043bc47437e2fa0d1223323b2742b19d3a44a37f685afe6ebe7c2afab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for las-py 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page