pyLASDev - LAS 2.0 and Dev files reader/editor/writer

Summary

  1. Description
  2. Requierements
  3. Installation
  4. Examples
  5. Download
  6. TODO and known bugs
  7. License
  8. Author

1. Description

pyLASDev is a small Python package which provides reading and writing of LAS (Log ASCII Standart) 1.2 and 2.0 files. Also it can be used for reading Dev (deviation) files, which are common in geoscience to store deviations and paths (for example, for wells in oil industry).

pyLASDev is written according to LAS 1.2 and 2.0 specifications (can be found here).

2. Requierements

- PLY (Python Lex-Yacc) package (used for parsing).

- NumPy package (numpy arrays used to store log data).

- SetupTools package (optional, for egg file easy installation).

3. Installation

Download the .egg file and install it by using command: easy_install pyLASDev-X.X.egg

4. Examples

Sorry, for now it's the only documentaion on pyLASDev. I'll try to improve it later. In addition, you can use test scripts from the source file archive as examples.

# print all readed mnemonics and values from ~VERSION section
for key in las_info['version'].keys():
        value = las_info['version'][key]
        print key, value

# ===============================
# 2. ~WELL Section
# ==============================

# print all keys (readed mnemonics) from the well section dictionary
print las_info['well'].keys()

# print 'EXAMS' mnemonic value from the well section
print las_info['well']['EXAMS']

# print all readed mnemonics and values from the ~WELLS section
for key in las_info['well'].keys():
        value = las_info['well'][key]
        print key, value

# ==============================
# 3. ~PARAMETERS Section
# ==============================

# print all keys (readed mnemonics) from the parameters section dictionary
print las_info['parameters'].keys()

# print 'WING' mnemonic value from the parameters section
print las_info['parameters']['WING']

# print all readed mnemonics and values from the ~PARAMETERS section
for key in las_info['parameters'].keys():
        value = las_info['parameters'][key]
        print key, value

# =============================
# 4. ~CURVE Section
# =============================

# print name of the first curve
print las_info['curves_order'][0]

# print all curves names in the right order
for k in xrange(len(las_info['curves_order'])):
        curve_name = las_info['curves_order'][k]
        print k, curve_name

# =============================
# 5. ~ASCII Logs Section
# =============================

# Logs dictionary contains NumPy arrays, named as Curves from ~CURVE section

# print DEPTH log from the Logs Section
print las_info['logs']['DEPTH']


# print all arrays and curves names from the Logs Section
for curve_name in las_info['curves_order']:
        log_values = las_info['logs'][key_ordered]
        print curve_name, log_values

# =============================
# Editing LAS File
# =============================

# To edit a LAS File just edit the dictionaries elements as you want, for example:

# add 1 to all elements of the PERM log from the Logs Section
las_info['logs']['PERM'] += 1

# delete the PORO log from the Logs Section
del las_info['logs']['PORO']

# rename the DEPTH to DEPTH_XXX in Logs Section
las_info['logs']['DEPTH_XXX'] = las_info['logs']['DEPTH']
del las_info['logs']['DEPTH']

# also we need to delete this log from the curves list:
las_info['curves_order'].remove('DEPTH')

# etc, enjoy :)

# =============================
# Writing LAS File
# =============================

filename = "somefile_changed.las"

write_las_file(filename, las_info)

5. Download

The most recent egg builds (together with the source code) can be downloaded from the project site.

6. TODO and known bugs

- Log data units are not supported for now

- LAS Comments are not supported for now

- Brief errors and debugging information output

7. License

pyLASDev is distributed under BSD license.

8. Author

- Mukharlyamov Artur