FileIndexer

#Contents:

Indexes LIS files.

Created on 10 Feb 2011

@author: p2ross

exception TotalDepth.LIS.core.FileIndexer.ExceptionFileIndex

Specialisation of exception for the LIS file indexer.

class TotalDepth.LIS.core.FileIndexer.FileIndex(theF, xAxisIndex=0)

Create an index for the LIS file, theF is a LIS File object.

xAxisIndex is the channel index that is regarded as the X axis (default 0). This is currently ignored in the absence of a reasonable use case.

genAll()

Generates each index object (child class of IndexObjBase).

genLogPasses()

Yields all IndexLogPass objects in the index.

genPlotRecords(fromInternalRecords=True)

This provides the minimal information for creating a Plot. It yields a PlotRecordSet that has (tell_FILM, tell_PRES, tell_AREA, tell_PIP, IndexLogPass) objects that are not separated by delimiter records. tell_FILM is the file offset of the FILM record. tell_PRES is the file offset of the PRES record. tell_AREA is None or the file offset of the AREA record. tell_PIP is None or the file offset of the PIP record. IndexLogPass is a IndexLogPass object.

longDesc()

Returns a string that is the long description of this object.

lrTypeS

Returns a list of Logical Record types (integers) that is in the index.

numLogPasses()

Returns the number of IndexLogPass objects in the index.

class TotalDepth.LIS.core.FileIndexer.IndexFileHead(tell, lrType, theF)

Indexes a File header. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexFileHeadTail(tell, lrType, theF, theClass)

Indexes a File header or trailer. The full Logical record is retained.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexFileTail(tell, lrType, theF)

Indexes a File trailer. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexLogPass(tell, lrType, theF, xAxisIndex=0)

The index of a Log Pass. This contains a LogPass object.

xAxisIndex is the channel index that is regarded as the X axis. This is the indirect axis if present or defaults to channel 0.

add(tell, lrType, theF)

Add an IFLR.

canAdd(iflrType)

Returns the IFLR type that this EFLR can describe.

iflrType()

Returns the IFLR type that this EFLR can describe.

logPass

The LogPass object.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexLrFull(tell, lrType, theF, theClass)

Takes a full LR and assigns it to self._lr.

theClass is a cls that is use to instantiate a Logical Record object at the current file position.

setLogicalRecord(theFile)

Sets the logicalRecord property to an LogiRec object from theFile.

class TotalDepth.LIS.core.FileIndexer.IndexNone(tell, lrType, theF)

NULL class just takes the LR information and skips to next LR.

class TotalDepth.LIS.core.FileIndexer.IndexObjBase(tell, lrType, theF)

Base class for indexed objects.

tell - The file position of the Logical Record as an integer.

lrType - The Logical Record type as an integer.

theF - The LIS File object. The file ID is recorded for later error checking.

canAdd(iflrType)

Returns True if this can accumulate another IFLR.

iflrType()

Returns the IFLR type that this EFLR can describe.

isDelimiter

True if this represents a delimiter record e.g. File Head/Tail.

logicalRecord

The underlying LogiRec object or None.

lrType

The Logical Record type, in integer.

setLogicalRecord(theFile)

Sets the logicalRecord property to an LogiRec object from theFile.

tell

The file offset of the Logical Record.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexReelHead(tell, lrType, theF)

Indexes a Reel header. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexReelHeadTail(tell, lrType, theF, theClass)

Indexes a Reel header or trailer. The full Logical record is retained.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexReelTail(tell, lrType, theF)

Indexes a Reel trailer. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexTable(tell, lrType, theF)

Table type logical records. Here we capture the first component block so that we know the name of the table.

name

The name of the table from the first component block.

setLogicalRecord(theFile)

Sets the logicalRecord property to an LogiRec.LrTable() object.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexTapeHead(tell, lrType, theF)

Indexes a Tape header. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexTapeHeadTail(tell, lrType, theF, theClass)

Indexes a Tape header or trailer. The full Logical record is retained.

tocStr()

Returns a ‘pretty’ string suitable for a table of contents.

class TotalDepth.LIS.core.FileIndexer.IndexTapeTail(tell, lrType, theF)

Indexes a Tape trailer. The full Logical record is retained.

class TotalDepth.LIS.core.FileIndexer.IndexUnknownInternalFormat(tell, lrType, theF)

Binary verbatim class for things like encrypted records, images, raw table dumps and so on.

setLogicalRecord(theFile)

Sets the logicalRecord property to an LogiRec.LrTable() object.

class TotalDepth.LIS.core.FileIndexer.PlotRecordSet

A POD class that can contain a set of references to the essential (plus optional) logical records for plotting.

canPlotFromExternalRecords()

True if I have a valid value that could be yielded, i.e. the minimum information from the file that allows a plot using some external definition of what has to be plotted. In practice this means a LogPass.

canPlotFromInternalRecords()

True if I have a valid value that could be yielded, i.e. the minimum information from the file that allows a plot. In practice this means a FILM, PRES record and a LogPass.

Usage

Examples

Using a LIS Indexer

Source:

myFilePath = "Spam/Eggs.LIS"
# Open a LIS file
myFi = File.FileRead(myFilePath, theFileId=myFilePath, keepGoing=True)
# Index the LIS file
myIdx = FileIndexer.FileIndex(myFi)
# Ask the index for all the LogPass objects, these do not have the frameSet populated yet
for aLr in myIdx.genAll():
    print(aLr)

Typical result:

tell: 0x00000000 type=128 <TotalDepth.LIS.core.FileIndexer.IndexFileHead object at 0x10197ff90>
tell: 0x00000050 type= 34 name=b'TOOL' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x10197ffd0>
tell: 0x000001ea type= 34 name=b'INPU' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x10197fd10>
tell: 0x00002342 type= 34 name=b'OUTP' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b1d0>
tell: 0x00003622 type= 34 name=b'CONS' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bed0>
tell: 0x0000456a type= 34 name=b'CONS' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b590>
tell: 0x000064aa type= 34 name=b'PRES' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0b050>
tell: 0x00006efe type= 34 name=b'FILM' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bfd0>
tell: 0x00006fc6 type= 34 name=b'AREA' <TotalDepth.LIS.core.FileIndexer.IndexTable object at 0x101b0bb50>
<TotalDepth.LIS.core.LogPass.LogPass object at 0x101b06490>
<TotalDepth.LIS.core.LogPass.LogPass object at 0x101b12410>
tell: 0x0017cbee type=129 <TotalDepth.LIS.core.FileIndexer.IndexFileTail object at 0x101b173d0>

Testing

The unit tests are in test/TestFileIndexer.Py

Table Of Contents

Previous topic

The LIS Log Pass

Next topic

TotalDepth.LAS API Reference

This Page