LAS Read

Reads LAS files.

Created on Jan 11, 2012

exception TotalDepth.LAS.core.LASRead.ExceptionLASRead

Specialisation of exception for LASRead.

exception TotalDepth.LAS.core.LASRead.ExceptionLASReadSection

Specialisation of exception for LASRead when handling sections.

exception TotalDepth.LAS.core.LASRead.ExceptionLASReadSectionArray

Specialisation of exception for LASRead when handling array section.

exception TotalDepth.LAS.core.LASRead.ExceptionLASReadData

Specialisation of exception for LASRead when reading data.

exception TotalDepth.LAS.core.LASRead.ExceptionLASKeyError

Equivalent to KeyError when looking stuff up.

TotalDepth.LAS.core.LASRead.LAS_FILE_EXT = '.las'

LAS file extension

TotalDepth.LAS.core.LASRead.LAS_FILE_EXT_LOWER = '.las'

LAS lower case file extension

TotalDepth.LAS.core.LASRead.hasLASExtension(fp)

Returns True if the file extansion is a LAS one.

TotalDepth.LAS.core.LASRead.RE_COMMENT = <_sre.SRE_Pattern object at 0x102522490>

Regex to match a comment

TotalDepth.LAS.core.LASRead.DEBUG_LINE_BY_LINE = False

logging.debug call here can add about 50% of the processing time

TotalDepth.LAS.core.LASRead.genLines(f)

Given an file-like object this generates non-blank, non-comment lines. It’s a co-routine so can accept a line to put back.

TotalDepth.LAS.core.LASRead.SECT_TYPES = 'VWCPOA'

All section identifiers

TotalDepth.LAS.core.LASRead.SECT_TYPES_WITH_DATA_LINES = 'VWCP'

Section with data lines

TotalDepth.LAS.core.LASRead.SECT_TYPES_WITH_INDEX = 'VWCPA'

Section with index value in column 0

TotalDepth.LAS.core.LASRead.RE_SECT_HEAD = <_sre.SRE_Pattern object at 0x10278d288>

Regex to match a section heasd

TotalDepth.LAS.core.LASRead.SECT_DESCRIPTION_MAP = {'A': 'ASCII Log Data', 'C': 'Curve Information Section', 'O': 'Other Information Section', 'P': 'Parameter Information Section', 'W': 'Well Information Section', 'V': 'Version Information Section'}

Map of section identifiers to description

TotalDepth.LAS.core.LASRead.RE_LINE_FIELD_0 = <_sre.SRE_Pattern object at 0x10272c468>

The ‘MENM’ field, no spaces, dots or colons. ONE group

TotalDepth.LAS.core.LASRead.RE_LINE_FIELD_1 = <_sre.SRE_Pattern object at 0x1029da030>

The data field which is the middle of the line between the first ‘.’ and last ‘:’ This is composed of optional units and value. Units must follow the dot immediately and contain no colons or spaces Note: Group 2 may have leading and trailing spaces TWO groups

TotalDepth.LAS.core.LASRead.RE_LINE_FIELD_2 = <_sre.SRE_Pattern object at 0x1024e9c30>

Data field 2 is after the last ‘:’ THREE groups

class TotalDepth.LAS.core.LASRead.SectLine

Captures the 6 fields: mnem unit valu desc format assoc

__getnewargs__()

Return self as a plain tuple. Used by copy and pickle.

static __new__(_cls, mnem, unit, valu, desc, format, assoc)

Create new instance of SectLine(mnem, unit, valu, desc, format, assoc)

__repr__()

Return a nicely formatted representation string

assoc

Alias for field number 5

desc

Alias for field number 3

format

Alias for field number 4

mnem

Alias for field number 0

unit

Alias for field number 1

valu

Alias for field number 2

class TotalDepth.LAS.core.LASRead.LASSection(sectType)

Contains data on a section.

__len__()

Number of members.

__contains__(theMnem)

Membership test.

addMemberLine(i, l)

Given a line this decomposes it to its _members. i is the position of the line l in the file.

finalise()

Finalisation of section, this updates the internal representation.

__getitem__(key)

Returns an entry, key can be int or str.

mnemS()

Returns an list of mnemonics.

unitS()

Returns an list of mnemonic units.

keys()

Returns the keys in the internal map.

find(m)

Returns the member ordinal for mnemonic m or -1 if not found. This can be used for finding the array column for a particular curve.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.LAS.core.LASRead.LASSectionArray(sectType, wrap, curvSect, null=-999.25)

Contains data on an array section.

addMemberLine(i, l)

Process a line in an array section.

finalise()

Finalisation. TODO: Make a numpy array and get rid of the members. Need to overload __getitem__.

frameSize()

Returns the number of data points in a frame.

class TotalDepth.LAS.core.LASRead.LASBase(id)

Base class for LAS reading and writing. This provides common functionality to child classes.

UNITS_LAS_TO_LIS = {'mts': 'M ', 'F': 'FEET'}

Mapping of commonly seen LAS units to proper LIS units Both key and value must be strings

__len__()

Number of sections.

__getitem__(key)

Returns a section, key can be int or str.

numFrames()

Returns the number of frames of data in an ‘A’ record if I have one.

numDataPoints()

Returns the number of frame data points in an ‘A’ record if I have one.

genSects()

Yields up each section.

nullValue

The NULL value, defaults to -999.25.

xAxisUnits

The X axis units.

xAxisStart

The Xaxis start value as an EngVal.

xAxisStop

The Xaxis end value as an EngVal.

xAxisStep

The Xaxis step value as an EngVal.

logDown()

Returns True if X axis is increasing i.e. for time or down log.

getWsdMnem(m)

Returns a tuple of (value, units) for a Mnemonic that may appear in either a Well section or a Parameter section. Units may be None if empty. Returns (None, None) if nothing found.

getAllWsdMnemonics()

Returns a set of mnemonics from the Well section and the Parameter section.

hasOutpMnem(theMnem)

Returns True if theMnem, a Mnem.Mnem() object is an output in the Curve section. It will use the alternate names table LGFORMAT_LAS from LASConstants to interpret curves that are not exact matches.

curveMnems(ordered=False)

Returns list of curve names actually declared in the Curve section. List will be unordered if ordered is False.

curveUnitsAsStr(m)

Given a curve as a Mnem.Mnem() this returns the units as a string. May raise KeyError.

genOutpPoints(theMnem)

Generates curve values for theMnem, a Mnem.Mnem() object.

__weakref__

list of weak references to the object (if defined)

class TotalDepth.LAS.core.LASRead.LASRead(theFp, theFileID=None)

Reads a LAS file.

__init__(theFp, theFileID=None)

Reads a LAS file from theFp that is either a string (file path) or a file like object.

Previous topic

TotalDepth.LAS API Reference

Next topic

Utility Package Reference

This Page