serdar_bay
serdar_bay

Reputation: 289

An error when reading LAS file using python lasio

I am trying to read a LAS file in python using lasio. I have a situation where the following code performs without a problem on Windows, but raises an error in MacOS.

import lasio
las = lasio.read('myFile.las')
las = las.df().reset_index()

On Windows, this returns a dataframe as intended. However, when I try the same on Mac, it gives the following error:

Output exceeds the size limit. Open the full output data in a text editor
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
/Users/serdarbayramov/Desktop/Toolkit/testing.ipynb Cell 29 in <cell line: 2>()
      1 import lasio
----> 2 las = lasio.read('Encino Mountz CL HAN 1H 11Jul.las')
      3 las

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/lasio/__init__.py:86, in read(file_ref, **kwargs)
     63 def read(file_ref, **kwargs):
     64     """Read a LAS file.
     65 
     66     Note that only versions 1.2 and 2.0 of the LAS file specification
   (...)
     84 
     85     """
---> 86     return LASFile(file_ref, **kwargs)

File /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/lasio/las.py:80, in LASFile.__init__(self, file_ref, **read_kwargs)
     71 self.sections = {
     72     "Version": default_items["Version"],
     73     "Well": default_items["Well"],
   (...)
     76     "Other": str(default_items["Other"]),
     77 }
     79 if not (file_ref is None):
...
     69     "COMMA": split_on_comma,
     70 }
---> 72 return splitters[provisional_delimiter]

KeyError: 'TAB'

I can't understand what is causing this error. Appreciate any help.

Upvotes: 1

Views: 617

Answers (1)

Lazy0147
Lazy0147

Reputation: 7

In that las file, you can change the delimiter from 'TAB' to 'SPACE' and it should fix that issue.

Upvotes: 0

Related Questions