<commit_before># lasio

[![Python Version](https://img.shields.io/pypi/pyversions/lasio.svg)](https://www.python.org/downloads/)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kinverarity1/lasio/blob/master/LICENSE)
[![PyPI Version](http://img.shields.io/pypi/v/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![PyPI Downloads](https://img.shields.io/pypi/dd/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![PyPI Format](https://img.shields.io/pypi/format/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![Build Status](https://travis-ci.org/kinverarity1/lasio.svg)](https://travis-ci.org/kinverarity1/lasio) 
[![Coverage Status](https://coveralls.io/repos/kinverarity1/lasio/badge.svg?branch=master&service=github)](https://coveralls.io/github/kinverarity1/lasio?branch=master)
[![GitHub Issues](http://githubbadges.herokuapp.com/kinverarity1/lasio/issues.svg)](https://github.com/kinverarity1/lasio/issues)
[![GitHub PRs](http://githubbadges.herokuapp.com/kinverarity1/lasio/pulls.svg)](https://github.com/kinverarity1/lasio/pulls)

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][CWLS]. 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``][namedlist] and [``ordereddict``][ordereddict]
  - [``numpy``][numpy]. 

### Install

To install from [PyPI][PyPI] use:

```bash
$ 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``][setuptools] and ``git`` installed and then:

```bash
$ git clone https://github.com/kinverarity1/lasio.git
$ cd lasio
$ python setup.py develop 
```

### How to use

Look at the [example IPython notebooks here](http://nbviewer.ipython.org/github/kinverarity1/lasio/tree/master/notebooks/). More detailed examples are coming.

#### Opening LAS files

From a filename:

```python
>>> import lasio
>>> l = lasio.read("example.las")
```

Or a URL:

```python
>>> l = lasio.read("http://someplace.com/example.las")
```

#### Getting data

The curve data are available as items:

```python
>>> l["ILD"]
[145, 262, 272, ...]
```

Or you can iterate through the curves:

```python
>>> 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:

1. Do nothing and [hope for no errors](https://docs.python.org/2.7/howto/unicode.html#encodings).

2. 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")
   ```

3. Install a third-party package like [``cChardet``][cChardet] (faster) or [``chardet``][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](https://github.com/kinverarity1/lasio/issues/new) or by [email](<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.

[CWLS]: http://www.cwls.org/las/ "Canadian Well Logging Society"
[numpy]: http://www.numpy.org/  "NumPy website"
[namedlist]: https://pypi.python.org/pypi/namedlist "namedlist"
[ordereddict]: https://pypi.python.org/pypi/ordereddict "ordereddict"
[setuptools]: https://pypi.python.org/pypi/setuptools "setuptools"
[chardet]:  https://pypi.python.org/pypi/chardet "chardet"
[cChardet]: https://github.com/PyYoshi/cChardet "cChardet"
[PyPI]: https://pypi.python.org/pypi/lasio "Python Package Index"

<commit_msg>shuffle<commit_after># lasio

[![PyPI Version](http://img.shields.io/pypi/v/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![PyPI Downloads](https://img.shields.io/pypi/dd/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![Build Status](https://travis-ci.org/kinverarity1/lasio.svg)](https://travis-ci.org/kinverarity1/lasio) 
[![Coverage Status](https://coveralls.io/repos/kinverarity1/lasio/badge.svg?branch=master&service=github)](https://coveralls.io/github/kinverarity1/lasio?branch=master)
[![GitHub Issues](http://githubbadges.herokuapp.com/kinverarity1/lasio/issues.svg)](https://github.com/kinverarity1/lasio/issues)
[![GitHub PRs](http://githubbadges.herokuapp.com/kinverarity1/lasio/pulls.svg)](https://github.com/kinverarity1/lasio/pulls)
[![Python Version](https://img.shields.io/pypi/pyversions/lasio.svg)](https://www.python.org/downloads/)
[![PyPI Format](https://img.shields.io/pypi/format/lasio.svg)](https://pypi.python.org/pypi/lasio/)
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/kinverarity1/lasio/blob/master/LICENSE)

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][CWLS]. 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``][namedlist] and [``ordereddict``][ordereddict]
  - [``numpy``][numpy]. 

### Install

To install from [PyPI][PyPI] use:

```bash
$ 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``][setuptools] and ``git`` installed and then:

```bash
$ git clone https://github.com/kinverarity1/lasio.git
$ cd lasio
$ python setup.py develop 
```

### How to use

Look at the [example IPython notebooks here](http://nbviewer.ipython.org/github/kinverarity1/lasio/tree/master/notebooks/). More detailed examples are coming.

#### Opening LAS files

From a filename:

```python
>>> import lasio
>>> l = lasio.read("example.las")
```

Or a URL:

```python
>>> l = lasio.read("http://someplace.com/example.las")
```

#### Getting data

The curve data are available as items:

```python
>>> l["ILD"]
[145, 262, 272, ...]
```

Or you can iterate through the curves:

```python
>>> 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:

1. Do nothing and [hope for no errors](https://docs.python.org/2.7/howto/unicode.html#encodings).

2. 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")
   ```

3. Install a third-party package like [``cChardet``][cChardet] (faster) or [``chardet``][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](https://github.com/kinverarity1/lasio/issues/new) or by [email](<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.

[CWLS]: http://www.cwls.org/las/ "Canadian Well Logging Society"
[numpy]: http://www.numpy.org/  "NumPy website"
[namedlist]: https://pypi.python.org/pypi/namedlist "namedlist"
[ordereddict]: https://pypi.python.org/pypi/ordereddict "ordereddict"
[setuptools]: https://pypi.python.org/pypi/setuptools "setuptools"
[chardet]:  https://pypi.python.org/pypi/chardet "chardet"
[cChardet]: https://github.com/PyYoshi/cChardet "cChardet"
[PyPI]: https://pypi.python.org/pypi/lasio "Python Package Index"


{'fraction_non_alphanumeric': 0.15014272121788771, 'fraction_numerical': 0.02302568981921979, 'mean_word_length': 3.9370596524189763, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 48, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '584191', 'n_tokens_mistral': 3902, 'n_tokens_neox': 3452, 'n_words': 934}