# lasio
<p align="center">
<a href="https://lasio.readthedocs.io/en/stable/"><strong>Documentation</strong> (stable)</a> •
<a href="https://lasio.readthedocs.io/en/latest/"><strong>Documentation</strong> (main branch)</a>
</p>
[![Run tests](https://github.com/kinverarity1/lasio/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/kinverarity1/lasio/actions/workflows/ci-tests.yml)
[![PyPI version](https://img.shields.io/pypi/v/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://black.readthedocs.io/en/stable/the_black_code_style/index.html)
[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kinverarity1/lasio/blob/master/LICENSE)
Read and write Log ASCII Standard files with Python.
This is a Python 3.7+ package to read and write Log ASCII Standard
(LAS) files, used for borehole data such as geophysical, geological, or
petrophysical logs. It's compatible with versions 1.2 and 2.0 of the LAS file
specification, published by the [Canadian Well Logging
Society](https://www.cwls.org/products/#products-las). Support for LAS 3 is
[being worked on](https://github.com/kinverarity1/lasio/issues/5).
lasio is primarily for reading and writing data and metadata to and from
LAS files. It is designed to read as many LAS files as possible, including
those containing common errors and non-compliant formatting. It can be used
directly, but you may want to consider using some other packages, depending
on your priorities:
- [welly](https://github.com/agile-geoscience/welly) is a Python package that
uses lasio for I/O but provides a **lot** more functionality aimed at working
with curves, wells, and projects. I would recommend starting there in most
cases, to avoid re-inventing the wheel!
- [lascheck](https://github.com/MandarJKulkarni/lascheck) is focused on
checking whether your LAS file meets the specifications.
- [lasr](https://github.com/donald-keighley/lasr) is an R package which
is designed to read large amounts of data quickly from LAS files; this is
a great thing to check out if speed is a priority for you, as lasio is not
particularly fast.
- LiDAR surveys are also called "LAS files", but they are quite different and
lasio will not help you -- check out [laspy](https://github.com/laspy/laspy)
instead.
lasio [stopped](https://github.com/kinverarity1/lasio/issues/364)
supporting Python 2.7 in August 2020. The final version of lasio with Python 2.7 support
is version 0.26.
## Code of conduct
See our [code of conduct](https://lasio.readthedocs.io/en/latest/contributing.html#code-of-conduct).
## Quick start
For the minimum working requirements, you'll need numpy installed. Install
lasio with:
```bash
$ pip install lasio
```
To make sure you have everything, use this to ensure pandas, chardet, and
openpyxl are also installed:
```bash
$ pip install lasio[all]
```
Example session:
```python
>>> import lasio
```
You can read the file using a filename, file-like object, or URL:
```python
>>> las = lasio.read("sample_rev.las")
```
Data is accessible both directly as numpy arrays
```python
>>> las.keys()
['DEPT', 'DT', 'RHOB', 'NPHI', 'SFLU', 'SFLA', 'ILM', 'ILD']
>>> las['SFLU']
array([ 123.45, 123.45, 123.45, ..., 123.45, 123.45, 123.45])
>>> las['DEPT']
array([ 1670. , 1669.875, 1669.75 , ..., 1669.75 , 1670. ,
1669.875])
```
and as ``CurveItem`` objects with associated metadata:
```python
>>> las.curves
[CurveItem(mnemonic=DEPT, unit=M, value=, descr=1 DEPTH, original_mnemonic=DEPT, data.shape=(29897,)),
CurveItem(mnemonic=DT, unit=US/M, value=, descr=2 SONIC TRANSIT TIME, original_mnemonic=DT, data.shape=(29897,)),
CurveItem(mnemonic=RHOB, unit=K/M3, value=, descr=3 BULK DENSITY, original_mnemonic=RHOB, data.shape=(29897,)),
CurveItem(mnemonic=NPHI, unit=V/V, value=, descr=4 NEUTRON POROSITY, original_mnemonic=NPHI, data.shape=(29897,)),
CurveItem(mnemonic=SFLU, unit=OHMM, value=, descr=5 RXO RESISTIVITY, original_mnemonic=SFLU, data.shape=(29897,)),
CurveItem(mnemonic=SFLA, unit=OHMM, value=, descr=6 SHALLOW RESISTIVITY, original_mnemonic=SFLA, data.shape=(29897,)),
CurveItem(mnemonic=ILM, unit=OHMM, value=, descr=7 MEDIUM RESISTIVITY, original_mnemonic=ILM, data.shape=(29897,)),
CurveItem(mnemonic=ILD, unit=OHMM, value=, descr=8 DEEP RESISTIVITY, original_mnemonic=ILD, data.shape=(29897,))]
```
Header information is parsed into simple HeaderItem objects, and stored in a
dictionary for each section of the header:
```python
>>> las.version
[HeaderItem(mnemonic=VERS, unit=, value=1.2, descr=CWLS LOG ASCII STANDARD -VERSION 1.2, original_mnemonic=VERS),
HeaderItem(mnemonic=WRAP, unit=, value=NO, descr=ONE LINE PER DEPTH STEP, original_mnemonic=WRAP)]
>>> las.well
[HeaderItem(mnemonic=STRT, unit=M, value=1670.0, descr=, original_mnemonic=STRT),
HeaderItem(mnemonic=STOP, unit=M, value=1660.0, descr=, original_mnemonic=STOP),
HeaderItem(mnemonic=STEP, unit=M, value=-0.125, descr=, original_mnemonic=STEP),
HeaderItem(mnemonic=NULL, unit=, value=-999.25, descr=, original_mnemonic=NULL),
HeaderItem(mnemonic=COMP, unit=, value=ANY OIL COMPANY LTD., descr=COMPANY, original_mnemonic=COMP),
HeaderItem(mnemonic=WELL, unit=, value=ANY ET AL OIL WELL #12, descr=WELL, original_mnemonic=WELL),
HeaderItem(mnemonic=FLD, unit=, value=EDAM, descr=FIELD, original_mnemonic=FLD),
HeaderItem(mnemonic=LOC, unit=, value=A9-16-49, descr=LOCATION, original_mnemonic=LOC),
HeaderItem(mnemonic=PROV, unit=, value=SASKATCHEWAN, descr=PROVINCE, original_mnemonic=PROV),
HeaderItem(mnemonic=SRVC, unit=, value=ANY LOGGING COMPANY LTD., descr=SERVICE COMPANY, original_mnemonic=SRVC),
HeaderItem(mnemonic=DATE, unit=, value=25-DEC-1988, descr=LOG DATE, original_mnemonic=DATE),
HeaderItem(mnemonic=UWI, unit=, value=100091604920, descr=UNIQUE WELL ID, original_mnemonic=UWI)]
>>> las.params
[HeaderItem(mnemonic=BHT, unit=DEGC, value=35.5, descr=BOTTOM HOLE TEMPERATURE, original_mnemonic=BHT),
HeaderItem(mnemonic=BS, unit=MM, value=200.0, descr=BIT SIZE, original_mnemonic=BS),
HeaderItem(mnemonic=FD, unit=K/M3, value=1000.0, descr=FLUID DENSITY, original_mnemonic=FD),
HeaderItem(mnemonic=MATR, unit=, value=0.0, descr=NEUTRON MATRIX(0=LIME,1=SAND,2=DOLO), original_mnemonic=MATR),
HeaderItem(mnemonic=MDEN, unit=, value=2710.0, descr=LOGGING MATRIX DENSITY, original_mnemonic=MDEN),
HeaderItem(mnemonic=RMF, unit=OHMM, value=0.216, descr=MUD FILTRATE RESISTIVITY, original_mnemonic=RMF),
HeaderItem(mnemonic=DFD, unit=K/M3, value=1525.0, descr=DRILL FLUID DENSITY, original_mnemonic=DFD)]
```
The data is stored as a 2D numpy array:
```python
>>> las.data
array([[ 1670. , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],
[ 1669.875, 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],
[ 1669.75 , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],
...,
[ 1669.75 , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],
[ 1670. , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],
[ 1669.875, 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ]])
```
You can also retrieve and load data as a ``pandas`` DataFrame, build LAS files
from scratch, write them back to disc, and export to Excel, amongst other
things.
See the [package documentation](https://lasio.readthedocs.io/en/latest/) for
more details.
## Contributing
Contributions are invited and welcome.
See [Contributing](https://lasio.readthedocs.io/en/latest/contributing.html) for how to get started.
## License
[MIT](https://github.com/kinverarity1/lasio/blob/master/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/kinverarity1/lasio",
"name": "lasio",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": "",
"keywords": "science geophysics io",
"author": "Kent Inverarity",
"author_email": "kinverarity@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/fa/ae/6f9d71e4d859e87ad983bbf31cded9b483d0ab839dc96a074c2cbb181a22/lasio-0.31.tar.gz",
"platform": null,
"description": "# lasio\r\n\r\n<p align=\"center\">\r\n<a href=\"https://lasio.readthedocs.io/en/stable/\"><strong>Documentation</strong> (stable)</a> \u00e2\u20ac\u00a2\r\n<a href=\"https://lasio.readthedocs.io/en/latest/\"><strong>Documentation</strong> (main branch)</a>\r\n</p>\r\n\r\n[![Run tests](https://github.com/kinverarity1/lasio/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/kinverarity1/lasio/actions/workflows/ci-tests.yml)\r\n[![PyPI version](https://img.shields.io/pypi/v/lasio.svg)](https://pypi.python.org/pypi/lasio/)\r\n[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://black.readthedocs.io/en/stable/the_black_code_style/index.html)\r\n[![License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kinverarity1/lasio/blob/master/LICENSE)\r\n\r\nRead and write Log ASCII Standard files with Python.\r\n\r\nThis is a Python 3.7+ package to read and write Log ASCII Standard\r\n(LAS) files, used for borehole data such as geophysical, geological, or\r\npetrophysical logs. It's compatible with versions 1.2 and 2.0 of the LAS file\r\nspecification, published by the [Canadian Well Logging\r\nSociety](https://www.cwls.org/products/#products-las). Support for LAS 3 is \r\n[being worked on](https://github.com/kinverarity1/lasio/issues/5).\r\n\r\nlasio is primarily for reading and writing data and metadata to and from \r\nLAS files. It is designed to read as many LAS files as possible, including\r\nthose containing common errors and non-compliant formatting. It can be used\r\ndirectly, but you may want to consider using some other packages, depending\r\non your priorities:\r\n\r\n- [welly](https://github.com/agile-geoscience/welly) is a Python package that \r\n uses lasio for I/O but provides a **lot** more functionality aimed at working\r\n with curves, wells, and projects. I would recommend starting there in most \r\n cases, to avoid re-inventing the wheel!\r\n- [lascheck](https://github.com/MandarJKulkarni/lascheck) is focused on\r\n checking whether your LAS file meets the specifications.\r\n- [lasr](https://github.com/donald-keighley/lasr) is an R package which \r\n is designed to read large amounts of data quickly from LAS files; this is \r\n a great thing to check out if speed is a priority for you, as lasio is not \r\n particularly fast.\r\n- LiDAR surveys are also called \"LAS files\", but they are quite different and\r\n lasio will not help you -- check out [laspy](https://github.com/laspy/laspy)\r\n instead.\r\n\r\nlasio [stopped](https://github.com/kinverarity1/lasio/issues/364) \r\nsupporting Python 2.7 in August 2020. The final version of lasio with Python 2.7 support \r\nis version 0.26.\r\n\r\n## Code of conduct\r\n\r\nSee our [code of conduct](https://lasio.readthedocs.io/en/latest/contributing.html#code-of-conduct).\r\n\r\n## Quick start\r\n\r\nFor the minimum working requirements, you'll need numpy installed. Install\r\nlasio with:\r\n\r\n```bash\r\n$ pip install lasio\r\n```\r\n\r\nTo make sure you have everything, use this to ensure pandas, chardet, and\r\nopenpyxl are also installed:\r\n\r\n```bash\r\n$ pip install lasio[all]\r\n```\r\n\r\nExample session:\r\n\r\n```python\r\n>>> import lasio\r\n```\r\n\r\nYou can read the file using a filename, file-like object, or URL:\r\n\r\n```python\r\n>>> las = lasio.read(\"sample_rev.las\")\r\n```\r\n\r\nData is accessible both directly as numpy arrays\r\n\r\n```python\r\n>>> las.keys()\r\n['DEPT', 'DT', 'RHOB', 'NPHI', 'SFLU', 'SFLA', 'ILM', 'ILD']\r\n>>> las['SFLU']\r\narray([ 123.45, 123.45, 123.45, ..., 123.45, 123.45, 123.45])\r\n>>> las['DEPT']\r\narray([ 1670. , 1669.875, 1669.75 , ..., 1669.75 , 1670. ,\r\n 1669.875])\r\n```\r\n\r\nand as ``CurveItem`` objects with associated metadata:\r\n\r\n```python\r\n>>> las.curves\r\n[CurveItem(mnemonic=DEPT, unit=M, value=, descr=1 DEPTH, original_mnemonic=DEPT, data.shape=(29897,)),\r\nCurveItem(mnemonic=DT, unit=US/M, value=, descr=2 SONIC TRANSIT TIME, original_mnemonic=DT, data.shape=(29897,)),\r\nCurveItem(mnemonic=RHOB, unit=K/M3, value=, descr=3 BULK DENSITY, original_mnemonic=RHOB, data.shape=(29897,)),\r\nCurveItem(mnemonic=NPHI, unit=V/V, value=, descr=4 NEUTRON POROSITY, original_mnemonic=NPHI, data.shape=(29897,)),\r\nCurveItem(mnemonic=SFLU, unit=OHMM, value=, descr=5 RXO RESISTIVITY, original_mnemonic=SFLU, data.shape=(29897,)),\r\nCurveItem(mnemonic=SFLA, unit=OHMM, value=, descr=6 SHALLOW RESISTIVITY, original_mnemonic=SFLA, data.shape=(29897,)),\r\nCurveItem(mnemonic=ILM, unit=OHMM, value=, descr=7 MEDIUM RESISTIVITY, original_mnemonic=ILM, data.shape=(29897,)),\r\nCurveItem(mnemonic=ILD, unit=OHMM, value=, descr=8 DEEP RESISTIVITY, original_mnemonic=ILD, data.shape=(29897,))]\r\n```\r\n\r\nHeader information is parsed into simple HeaderItem objects, and stored in a\r\ndictionary for each section of the header:\r\n\r\n```python\r\n>>> las.version\r\n[HeaderItem(mnemonic=VERS, unit=, value=1.2, descr=CWLS LOG ASCII STANDARD -VERSION 1.2, original_mnemonic=VERS),\r\nHeaderItem(mnemonic=WRAP, unit=, value=NO, descr=ONE LINE PER DEPTH STEP, original_mnemonic=WRAP)]\r\n>>> las.well\r\n[HeaderItem(mnemonic=STRT, unit=M, value=1670.0, descr=, original_mnemonic=STRT),\r\nHeaderItem(mnemonic=STOP, unit=M, value=1660.0, descr=, original_mnemonic=STOP),\r\nHeaderItem(mnemonic=STEP, unit=M, value=-0.125, descr=, original_mnemonic=STEP),\r\nHeaderItem(mnemonic=NULL, unit=, value=-999.25, descr=, original_mnemonic=NULL),\r\nHeaderItem(mnemonic=COMP, unit=, value=ANY OIL COMPANY LTD., descr=COMPANY, original_mnemonic=COMP),\r\nHeaderItem(mnemonic=WELL, unit=, value=ANY ET AL OIL WELL #12, descr=WELL, original_mnemonic=WELL),\r\nHeaderItem(mnemonic=FLD, unit=, value=EDAM, descr=FIELD, original_mnemonic=FLD),\r\nHeaderItem(mnemonic=LOC, unit=, value=A9-16-49, descr=LOCATION, original_mnemonic=LOC),\r\nHeaderItem(mnemonic=PROV, unit=, value=SASKATCHEWAN, descr=PROVINCE, original_mnemonic=PROV),\r\nHeaderItem(mnemonic=SRVC, unit=, value=ANY LOGGING COMPANY LTD., descr=SERVICE COMPANY, original_mnemonic=SRVC),\r\nHeaderItem(mnemonic=DATE, unit=, value=25-DEC-1988, descr=LOG DATE, original_mnemonic=DATE),\r\nHeaderItem(mnemonic=UWI, unit=, value=100091604920, descr=UNIQUE WELL ID, original_mnemonic=UWI)]\r\n>>> las.params\r\n[HeaderItem(mnemonic=BHT, unit=DEGC, value=35.5, descr=BOTTOM HOLE TEMPERATURE, original_mnemonic=BHT),\r\nHeaderItem(mnemonic=BS, unit=MM, value=200.0, descr=BIT SIZE, original_mnemonic=BS),\r\nHeaderItem(mnemonic=FD, unit=K/M3, value=1000.0, descr=FLUID DENSITY, original_mnemonic=FD),\r\nHeaderItem(mnemonic=MATR, unit=, value=0.0, descr=NEUTRON MATRIX(0=LIME,1=SAND,2=DOLO), original_mnemonic=MATR),\r\nHeaderItem(mnemonic=MDEN, unit=, value=2710.0, descr=LOGGING MATRIX DENSITY, original_mnemonic=MDEN),\r\nHeaderItem(mnemonic=RMF, unit=OHMM, value=0.216, descr=MUD FILTRATE RESISTIVITY, original_mnemonic=RMF),\r\nHeaderItem(mnemonic=DFD, unit=K/M3, value=1525.0, descr=DRILL FLUID DENSITY, original_mnemonic=DFD)]\r\n```\r\n\r\nThe data is stored as a 2D numpy array:\r\n\r\n```python\r\n>>> las.data\r\narray([[ 1670. , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],\r\n [ 1669.875, 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],\r\n [ 1669.75 , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],\r\n ...,\r\n [ 1669.75 , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],\r\n [ 1670. , 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ],\r\n [ 1669.875, 123.45 , 2550. , ..., 123.45 , 110.2 , 105.6 ]])\r\n```\r\n\r\nYou can also retrieve and load data as a ``pandas`` DataFrame, build LAS files\r\nfrom scratch, write them back to disc, and export to Excel, amongst other\r\nthings.\r\n\r\nSee the [package documentation](https://lasio.readthedocs.io/en/latest/) for\r\nmore details.\r\n\r\n## Contributing\r\n\r\nContributions are invited and welcome.\r\n\r\nSee [Contributing](https://lasio.readthedocs.io/en/latest/contributing.html) for how to get started.\r\n\r\n## License\r\n\r\n[MIT](https://github.com/kinverarity1/lasio/blob/master/LICENSE)\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Read/write well data from Log ASCII Standard (LAS) files",
"version": "0.31",
"project_urls": {
"Homepage": "https://github.com/kinverarity1/lasio"
},
"split_keywords": [
"science",
"geophysics",
"io"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6270a73c7cefe343162b4085645dacf2c236c0870d348854d2a226ba84f90cab",
"md5": "96f0bed82b34438677ed6fe1e3ca1bac",
"sha256": "30204596b0f3eb9118af99a622f177fba2b6c245db0512f9f57c437020599db4"
},
"downloads": -1,
"filename": "lasio-0.31-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "96f0bed82b34438677ed6fe1e3ca1bac",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3",
"size": 47414,
"upload_time": "2023-05-18T08:55:25",
"upload_time_iso_8601": "2023-05-18T08:55:25.680833Z",
"url": "https://files.pythonhosted.org/packages/62/70/a73c7cefe343162b4085645dacf2c236c0870d348854d2a226ba84f90cab/lasio-0.31-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "faae6f9d71e4d859e87ad983bbf31cded9b483d0ab839dc96a074c2cbb181a22",
"md5": "286719ece1a94a6be021ad4dd1519938",
"sha256": "5dd3c4baa3f2c89bc95ca8e052dc37fe86363c687199c93fd0fae80c597e63e5"
},
"downloads": -1,
"filename": "lasio-0.31.tar.gz",
"has_sig": false,
"md5_digest": "286719ece1a94a6be021ad4dd1519938",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 2542258,
"upload_time": "2023-05-18T08:55:35",
"upload_time_iso_8601": "2023-05-18T08:55:35.194509Z",
"url": "https://files.pythonhosted.org/packages/fa/ae/6f9d71e4d859e87ad983bbf31cded9b483d0ab839dc96a074c2cbb181a22/lasio-0.31.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-18 08:55:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kinverarity1",
"github_project": "lasio",
"travis_ci": true,
"coveralls": true,
"github_actions": true,
"lcname": "lasio"
}