In [1]:
import os
import lasio
from lasio import read

import logging ; logging.getLogger().setLevel(logging.DEBUG)

egfn = lambda fn: os.path.join("/home/kent/code/lasio/tests/examples", fn)

def test(fn, **kwargs):
    print read(egfn(fn), **kwargs).other

In [2]:
test("sample_extended_chars_utf8.las")


DEBUG:lasio.las:LAS content is type <type 'str'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [3]:
test("sample_extended_chars_utf8wbom.las")


DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [4]:
test("sample_extended_chars_utf8wbom.las", autodetect_encoding=True)


DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [5]:
test("sample_extended_chars_utf8wbom.las", encoding="utf-8")


DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [6]:
test("sample_extended_chars_utf8wbom.las", encoding="utf-8-sig")


DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [7]:
test("sample_extended_chars_utf16le.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.0, 'encoding': u'ASCII'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-7-ad611ae66506> in <module>()
----> 1 test("sample_extended_chars_utf16le.las", autodetect_encoding=True)

<ipython-input-1-6bdaa69c0cb9> in test(fn, **kwargs)
      8 
      9 def test(fn, **kwargs):
---> 10     print read(egfn(fn), **kwargs).other

/home/kent/code/lasio/lasio/las.pyc in read(file_ref, **kwargs)
    923 
    924     '''
--> 925     return LASFile(file_ref, **kwargs)

/home/kent/code/lasio/lasio/las.pyc in __init__(self, file_ref, **kwargs)
    164 
    165         if not (file_ref is None):
--> 166             self.read(file_ref, **kwargs)
    167 
    168     def read(self, file_ref, **kwargs):

/home/kent/code/lasio/lasio/las.pyc in read(self, file_ref, **kwargs)
    195             reader.version = self.version['VERS'].value
    196         except KeyError:
--> 197             raise KeyError("No key VERS in ~V section")
    198 
    199         # Validate version

KeyError: 'No key VERS in ~V section'

In [8]:
test("sample_extended_chars_utf16lebom.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.9900000095367432, 'encoding': u'UTF-16'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: The ºᶟᵌᴬń tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [9]:
test("sample_extended_chars_utf16be.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.0, 'encoding': u'ASCII'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-9-ea3e5ff9882c> in <module>()
----> 1 test("sample_extended_chars_utf16be.las", autodetect_encoding=True)

<ipython-input-1-6bdaa69c0cb9> in test(fn, **kwargs)
      8 
      9 def test(fn, **kwargs):
---> 10     print read(egfn(fn), **kwargs).other

/home/kent/code/lasio/lasio/las.pyc in read(file_ref, **kwargs)
    923 
    924     '''
--> 925     return LASFile(file_ref, **kwargs)

/home/kent/code/lasio/lasio/las.pyc in __init__(self, file_ref, **kwargs)
    164 
    165         if not (file_ref is None):
--> 166             self.read(file_ref, **kwargs)
    167 
    168     def read(self, file_ref, **kwargs):

/home/kent/code/lasio/lasio/las.pyc in read(self, file_ref, **kwargs)
    195             reader.version = self.version['VERS'].value
    196         except KeyError:
--> 197             raise KeyError("No key VERS in ~V section")
    198 
    199         # Validate version

KeyError: 'No key VERS in ~V section'

In [10]:
test("sample_extended_chars_utf16bebom.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.5, 'encoding': u'WINDOWS-1252'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-10-39f455127324> in <module>()
----> 1 test("sample_extended_chars_utf16bebom.las", autodetect_encoding=True)

<ipython-input-1-6bdaa69c0cb9> in test(fn, **kwargs)
      8 
      9 def test(fn, **kwargs):
---> 10     print read(egfn(fn), **kwargs).other

/home/kent/code/lasio/lasio/las.pyc in read(file_ref, **kwargs)
    923 
    924     '''
--> 925     return LASFile(file_ref, **kwargs)

/home/kent/code/lasio/lasio/las.pyc in __init__(self, file_ref, **kwargs)
    164 
    165         if not (file_ref is None):
--> 166             self.read(file_ref, **kwargs)
    167 
    168     def read(self, file_ref, **kwargs):

/home/kent/code/lasio/lasio/las.pyc in read(self, file_ref, **kwargs)
    195             reader.version = self.version['VERS'].value
    196         except KeyError:
--> 197             raise KeyError("No key VERS in ~V section")
    198 
    199         # Validate version

KeyError: 'No key VERS in ~V section'

In [11]:
test("sample_extended_chars_cp1252.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.5, 'encoding': u'WINDOWS-1252'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: ºThe logging tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [12]:
test("sample_extended_chars_cp1252.las", encoding="cp1252")


DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: ºThe logging tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [13]:
test("sample_extended_chars_iso88591.las", autodetect_encoding=True)


DEBUG:lasio.las:Using cchardet
DEBUG:lasio.las:cchardet results={'confidence': 0.5, 'encoding': u'WINDOWS-1252'}
DEBUG:lasio.las:LAS content is type <type 'unicode'>
INFO:lasio.las:LAS file shape = (3, 8)
DEBUG:lasio.las:checking for nulls (NULL = -999.25)
Note: ºThe logging tools became stuck at 625 meters causing the data
between 625 meters and 615 meters to be invalid.

In [ ]:


In [ ]: