Read/write well data from Log ASCII Standard (LAS) files
Project description
Read/write well data from Log ASCII Standard (LAS) files.
This is a Python package to read and write Log ASCII Standard (LAS) files, used for borehole/well data (e.g. geophysical/geological/petrophysical logs). It is compatible with versions 1.2 and 2.0 of the LAS file specification, published by the Canadian Well Logging Society. In principle it is designed to read as many types of LAS files as possible, including ones containing common errors or non-compliant formatting.
It is written entirely in Python and works on any platform. It requires:
the small third-party packages `namedlist <https://pypi.python.org/pypi/namedlist>`__ and `ordereddict <https://pypi.python.org/pypi/ordereddict>`__
`numpy <http://www.numpy.org/>`__.
Install
To install from PyPI use:
$ pip install lasio
If necessary this will download and install the package dependencies.
Alternatively if you would like the latest version (which may contain bugs and errors) make sure you have `setuptools <https://pypi.python.org/pypi/setuptools>`__ and git installed and then:
$ git clone https://github.com/kinverarity1/lasio.git
$ cd lasio
$ python setup.py develop
How to use
Look at the example IPython notebooks here. More detailed examples are coming.
Opening LAS files
>From a filename:
>>> import lasio
>>> l = lasio.read("example.las")
Or a URL:
>>> l = lasio.read("http://someplace.com/example.las")
Getting data
The curve data are available as items:
>>> l["ILD"]
[145, 262, 272, ...]
Or you can iterate through the curves:
>>> for c in l.curves:
... print c.mnemonic, c.unit, c.data
DEPT m [0, 0.05, 0.10, ...]
ILD mS/m [145, 262, 272, ...]
Character encodings
Three options:
Do nothing and hope for no errors.
Specify the encoding (it uses `codecs.open <https://docs.python.org/2/library/codecs.html#codecs.open>`__ internally):
python >>> l = lasio.read("example.las", encoding="windows-1252")
Install a third-party package like `cChardet <https://github.com/PyYoshi/cChardet>`__ (faster) or `chardet <https://pypi.python.org/pypi/chardet>`__ (slower) to automatically detect the character encoding. If these packages are installed this code will use the fastest option:
python >>> l = lasio.read("example.las", autodetect_encoding=True)
Note that by default autodetect_encoding=False.
Development
0.7 (2015-08-08) - all tests passing on Python 2.6 through 3.4
0.6 (2015-08-05) - bugfixes and renamed from las_reader to lasio
0.5 (2015-08-01) - Improvements to writing LAS files
0.4 (2015-07-26) - Improved handling of character encodings, other internal improvements
0.3 (2015-07-23) - Added Python 3 support, now reads LAS 1.2 and 2.0
0.2 (2015-07-08) - Tidied code and published on PyPI
Contributions
Contributions are very welcome. Please fork kinverarity1/lasio on GitHub and submit a PR request containing any changes you have made.
Suggested improvements, bug reports, shortcomings, desirable features, examples of LAS files which do not load as you expected, are all also welcome either via GitHub or by email.
Thanks to the following people in chronological order for their help:
@VelizarVESSELINOV
@diverdude
License
The code is freely available for any kind of use or modification under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for lasio-0.7.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f69ef5b9c432ac74314aac7b7d94914012f5821373919a4617a3ffc25c72a8de |
|
MD5 | 2f0cf25d91b6a0700e8e8a7c4f7f82d0 |
|
BLAKE2b-256 | 4d5010eed9efe9a86b5ae5f927723f590b39030b8a362d788e39383d3ffec8f0 |