Logical Record Handler
Handles LIS Logical Records.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLr
Specialisation of exception for Logical Records.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrNotImplemented
Logical Records that have no implementation here.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionCbWrite
Raised when creating a component block with Python native types that has illogical or conflicting data.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_NORMAL_DATA = 0
Normal data record containing log data
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_ALTERNATE_DATA = 1
Alternate data.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_JOB_ID = 32
Job identification
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_WELL_DATA = 34
Well site data
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TOOL_INFO = 39
Tool string info
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_ENCRYPTED_TABLE = 42
Encrypted table dump
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TABLE_DUMP = 47
Table dump
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DATA_FORMAT = 64
Data format specification record
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DATA_DESCRIPTOR = 65
Data descriptor (not defined in the LIS79 Description Reference Manual)
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TU10_BOOT = 95
TU10 software boot
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_BOOTSTRAP_LOADER = 96
Bootstrap loader
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_CP_KERNEL = 97
CP-kernel loader boot
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_PROGRAM_FILE_HEAD = 100
Program file header
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_PROGRAM_OVER_HEAD = 101
Program overlay header
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_PROGRAM_OVER_LOAD = 102
Program overlay load
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_FILE_HEAD = 128
File header
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_FILE_TAIL = 129
File trailer
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TAPE_HEAD = 130
Tape header
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TAPE_TAIL = 131
Tape trailer
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_REEL_HEAD = 132
Reel header
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_REEL_TAIL = 133
Reel trailer
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_EOF = 137
Logical EOF (end of file)
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_BOT = 138
Logical BOT (beginning of tape)
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_EOT = 139
Logical EOT (end of tape)
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_EOM = 141
Logical EOM (end of medium)
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_OPERATOR_INPUT = 224
Operator command inputs
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_OPERATOR_RESPONSE = 225
Operator response inputs
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_SYSTEM_OUTPUT = 227
System outputs to operator
FLIC comment
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_BLANK_RECORD = 234
Blank record/CSU comment
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_PICTURE = 85
Picture
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_IMAGE = 86
Image
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_ALL = (0, 1, 32, 34, 39, 42, 47, 64, 65, 95, 96, 97, 100, 101, 102, 128, 129, 130, 131, 132, 133, 137, 138, 139, 141, 224, 225, 227, 232, 234, 85, 86)
All possible Logical Records Types
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_LOG_DATA = (0, 1)
Logical Records Types for Log data
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_TABLE_DATA = (32, 34, 39)
Logical Records Types for Table data
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DELIMITER_START = (132, 130, 128)
Logical Records Types for delimiter start records.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DELIMITER_END = (133, 131, 129)
Logical Records Types for delimiter end records.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DELIMITER = (132, 130, 128, 133, 131, 129)
Logical Records Types for all delimiter records.
Delimeter records ‘bookend’ dynamic and static data that makes up a LIS file.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_MARKER = (137, 138, 139, 141)
Logical Records Types for all marker records.
Marker records terminate original physical media such as a tape.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_DELIMITER_MARKER = (132, 130, 128, 133, 131, 129, 137, 138, 139, 141)
Logical Records Types for all delimiter and marker records.
-
TotalDepth.LIS.core.LogiRec.isDelimiter(theType)
Returns True if the Logical Record Type is a Delimiter record.
-
TotalDepth.LIS.core.LogiRec.LR_TYPE_UNKNOWN_INTERNAL_FORMAT = (42, 47, 95, 96, 97, 100, 101, 102, 224, 225, 227, 232, 234, 85, 86)
Logical Records Types with no known format so just treat these as unformatted binary data
-
TotalDepth.LIS.core.LogiRec.LR_DESCRIPTION_MAP = {0: 'Normal data record containing log data', 1: 'Alternate data.', 130: 'Tape header', 131: 'Tape trailer', 132: 'Reel header', 133: 'Reel trailer', 65: 'Data descriptor (not defined in the LIS79 Description Reference Manual)', 64: 'Data format specification record', 96: 'Bootstrap loader', 128: 'File header', 139: 'Logical EOT (end of tape)', 141: 'Logical EOM (end of medium)', 85: 'Picture', 86: 'Image', 95: 'TU10 software boot', 32: 'Job identification', 97: 'CP-kernel loader boot', 34: 'Well site data', 227: 'System outputs to operator', 100: 'Program file header', 101: 'Program overlay header', 102: 'Program overlay load', 39: 'Tool string info', 129: 'File trailer', 42: 'Encrypted table dump', 225: 'Operator response inputs', 47: 'Table dump', 232: 'FLIC comment', 137: 'Logical EOF (end of file)', 224: 'Operator command inputs', 234: 'Blank record/CSU comment', 138: 'Logical BOT (beginning of tape)'}
Map of {Logical Records Type : description, ...}
-
TotalDepth.LIS.core.LogiRec.LR_DESCRIPTION_UNKNOWN = 'Unknown Logical Record type.'
Description string for unknown Logical Records Type
-
TotalDepth.LIS.core.LogiRec.STRUCT_LR_HEAD = <Struct object at 0x10275ae68>
Logical Record header (type and attributes)
-
TotalDepth.LIS.core.LogiRec.STRUCT_LR_FILE_HEAD_TAIL = <Struct object at 0x10275a6c0>
Logical Record field interpretation via the struct module
-
TotalDepth.LIS.core.LogiRec.STRUCT_LR_REEL_TAPE_HEAD_TAIL = <Struct object at 0x10275a5a8>
Logical Record reel/tape head/tail via the struct module
-
TotalDepth.LIS.core.LogiRec.STRUCT_COMPONENT_BLOCK_PREAMBLE = <Struct object at 0x103553a78>
Component Block preamble as a struct.Struct()
-
TotalDepth.LIS.core.LogiRec.STRUCT_ENTRY_BLOCK_PREAMBLE = <Struct object at 0x1035d0ed8>
Entry Block preamble as a struct.Struct()
-
TotalDepth.LIS.core.LogiRec.STRUCT_DSB = <Struct object at 0x1027244c8>
Datum Specification Block structure.
NOTE: Due to the funny way API codes are done we read then as a single
32 bit unsigned integer and then do a decimal masking operation to
extract the four sub-fields
-
class TotalDepth.LIS.core.LogiRec.LrBase(theType, theAttr)
Base class for Logical Records.
Constructed with and integer type and integer attributes.
-
__init__(theType, theAttr)
Base class constructor, theType and theAttr are bytes.
-
init(theLen)
Returns a string of spaces of the supplied length.
-
__str__()
String representation.
-
desc
Description ot the LR type.
-
__weakref__
list of weak references to the object (if defined)
-
class TotalDepth.LIS.core.LogiRec.LrMarker(theType, theAttr)
A marker record such as EOF BOT EOT EOM.
-
class TotalDepth.LIS.core.LogiRec.LrEOF(attr=0)
A EOF marker record.
-
class TotalDepth.LIS.core.LogiRec.LrEOFRead(theFile)
A EOF marker record read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrBOT(attr=0)
A BOT marker record.
-
class TotalDepth.LIS.core.LogiRec.LrBOTRead(theFile)
A BOT marker record read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrEOT(attr=0)
A EOT marker record.
-
class TotalDepth.LIS.core.LogiRec.LrEOTRead(theFile)
A EOT marker record read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrEOM(attr=0)
A EOM marker record.
-
class TotalDepth.LIS.core.LogiRec.LrEOMRead(theFile)
A EOM marker record read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrWithDateField(theType, theAttr)
ABC for classes that have the YY/MM/DD date field.
-
ymd
Returns the YY/MM/DD date field to a year, month, day tuple or None.
-
class TotalDepth.LIS.core.LogiRec.LrFileHeadTail(theType, theAttr)
Parent class of FileHead, FileTail that have identical structure.
-
read(theFile)
Read from a LIS physical file.
-
contFileName
Continuation file name.
-
class TotalDepth.LIS.core.LogiRec.LrFileHead(theType, theAttr)
Specific class of File Head.
-
prevFileName
Previous file name.
-
class TotalDepth.LIS.core.LogiRec.LrFileHeadRead(theFile)
Specific class of File head read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrFileTail(theType, theAttr)
Specific class of File Tail.
-
nextFileName
Next file name.
-
class TotalDepth.LIS.core.LogiRec.LrFileTailRead(theFile)
Specific class of File tail read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrReelTapeHeadTail(theType, theAttr)
Parent class of Reel/Tape Head/Tail that have identical structure.
-
class TotalDepth.LIS.core.LogiRec.LrTapeHeadTail(theType, theAttr)
Tape head or tail Logical Record.
-
class TotalDepth.LIS.core.LogiRec.LrTapeHead(theType, theAttr)
Tape head Logical Record.
-
prevTapeName
Previous tape name.
-
class TotalDepth.LIS.core.LogiRec.LrTapeHeadRead(theFile)
Specific class of Tape head read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrTapeTail(theType, theAttr)
Tape tail Logical Record.
-
nextTapeName
Next tape name.
-
class TotalDepth.LIS.core.LogiRec.LrTapeTailRead(theFile)
Specific class of Tape tail read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrReelHeadTail(theType, theAttr)
Reel head or tail Logical Record.
-
class TotalDepth.LIS.core.LogiRec.LrReelHead(theType, theAttr)
Reel head Logical Record.
-
prevReelName
Previous reel name.
-
class TotalDepth.LIS.core.LogiRec.LrReelHeadRead(theFile)
Specific class of Reel head read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrReelTail(theType, theAttr)
Reel tail Logical Record.
-
nextReelName
Next reel name.
-
class TotalDepth.LIS.core.LogiRec.LrReelTailRead(theFile)
Specific class of Reel tail read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrMisc(theType, theAttr)
Miscellaneous Logical Record.
-
class TotalDepth.LIS.core.LogiRec.LrMiscRead(theFile)
Miscellaneous Logical Record read from a LIS file.
-
TotalDepth.LIS.core.LogiRec.COMPONENT_BLOCK_TABLE = 73
Type of first Component Blocks in the table
-
TotalDepth.LIS.core.LogiRec.COMPONENT_BLOCK_DATUM_BLOCK_START = 0
Type of first Component Blocks in the Datum Block i.e. row
-
TotalDepth.LIS.core.LogiRec.COMPONENT_BLOCK_DATUM_BLOCK_ENTRY = 69
Component Block type that describes an entry in a Datum Block i.e. a cell
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTable
Specialisation of exception for Table Logical Records.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTableInit
Table __init__() issues.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTableInternaStructuresCorrupt
Raised when there are inconsistencies with the IR of the table.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTableCompose
Table creation (not from file) issues.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTableRow
TableRow issues.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionLrTableRowInit
TableRow __init__() issues.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionCbEngValInit
CbEngVal.__init__() issues such as unknown rep code.
-
class TotalDepth.LIS.core.LogiRec.CbEngVal
Contains the data from a Component Block and has an EngVal
-
CB_TYPES = (73, 0, 69)
Allowable Component Block types
-
setValue(v)
Sets the value to v.
-
lisBytes()
Return a bytes() array from the internal representation.
-
value
The value of the Component Block or None.
-
status
Returns True if the value is b’ALLO’, False otherwise.
-
__weakref__
list of weak references to the object (if defined)
-
class TotalDepth.LIS.core.LogiRec.CbEngValRead(theFile)
Contains the data from a Component Block and has an EngVal read from a file.
-
__init__(theFile)
Initialise. This will raise a TypeError if theFile.unpack returns None
i.e. when not enough data to create a Component Block.
-
class TotalDepth.LIS.core.LogiRec.CbEngValWrite(t, v, m, **kwargs)
A Component Block and has an EngVal created directly.
-
__init__(t, v, m, **kwargs)
Initialise component block with type, value, mnemonic and optional key words.
-
class TotalDepth.LIS.core.LogiRec.TableRow(theCb)
Represents a row of a table and consists of CbEngVal objects.
-
genCells()
yields each CbEngVal.
-
__len__()
The number of cells in the row.
-
value
The name of the row i.e. the value of block 0.
-
addCb(theCb)
Adds a component block onto the end of the row.
Returns the mnemonic field from the component block.
-
__getitem__(key)
If key is an integer or slice this returns a CbEngVal by index(es).
If key is a bytes() object then this returns a CbEngVal by label.
May raise a KeyError or IndexError.
-
__contains__(key)
Returns True if this row has a column named key.
-
__weakref__
list of weak references to the object (if defined)
-
class TotalDepth.LIS.core.LogiRec.LrTable(theType, theAttr)
Table-like Logical Record.
-
__init__(theType, theAttr)
Base class constructor. theType, theAttr are byte objects i.e. integers 0 to 255
-
genRows()
yields each TableRow.
TODO: parameter to sort or reverse.
-
genRowNames(sort=0)
yields each TableRow name.
If sort > 0 then the results are sorted. If sort < 0 the results are reverse sorted
-
retRowByMnem(m)
Returns the TableRow from a Mnem.Mnem object. i.e. the table row that has a b’MNEM’
column whose value matches m.
May raise a KeyError. Note: an IndexError would mean that self.__mnemRowIndex is corrupt.
-
isSingleParam
True it this table is a list of single parameters (i.e. type 0 blocks).
-
value
The name of the table or None i.e. the value of the first block.
-
__getitem__(key)
If key is an integer or slice this returns block by index(es).
If key is a bytes() object then this returns row by label.
May raise a KeyError or IndexError.
-
__contains__(key)
Returns True if this row has a row named key.
-
__len__()
Number of rows in the table.
-
rowLabels()
Returns dictionary view of row values (unordered).
-
rowMnems()
Returns dictionary view of row Mnem.Mnem objects (unordered).
-
colLabels()
Returns ordered super-set of column values. Not all rows have these.
-
startNewRow(theCbEv)
Starts a new row from the component block. Returns theCbEv.mnem value.
-
addDatumBlock(theCbEv)
Adds a component block to the last row. Returns theCbEv value.
-
genRowValuesInColOrder(theRow)
Yields table cells in a particular row in column order.
-
genLisBytes()
Yields chunks of binary LIS data (actually each component block).
-
class TotalDepth.LIS.core.LogiRec.LrTableRead(theFile)
A table-like Logical Record read from a LIS file.
-
class TotalDepth.LIS.core.LogiRec.LrTableWrite(theType, theName, theMnemS, theTable)
Creates a table from internal Python data structures.
theType is the table type e.g. b’FILM’
theMnemS is the list of column names, theTable members must fit this size.
If an element of the table is a tuple or a list it is assumed to be (value, units).
-
__init__(theType, theName, theMnemS, theTable)
Construct a table from internal data that must be bytes/float/int.
theType is the table type e.g. b’FILM’
theMnemS is the list of column names, theTable members must fit this size.
If an element of the table is a tuple or a list it is assumed to be (value, units).
-
exception TotalDepth.LIS.core.LogiRec.ExceptionEntryBlock
Specialisation of exception for Entry Blocks.
-
exception TotalDepth.LIS.core.LogiRec.ExceptionEntryBlockSetInit
Exception for EntryBlockSet.__init__().
-
class TotalDepth.LIS.core.LogiRec.EntryBlockRead
An entry block read from a LIS file.
-
class TotalDepth.LIS.core.LogiRec.EntryBlockSet
Represents the set of Entry Blocks in a DFSR.
-
ATTR_MAP = {'dsbType': 2, 'optLogScale': 5, 'frameSpacingUnits': 9, 'depthUnits': 14, 'absentValue': 12, 'recordingMode': 13, 'dataType': 1, 'upDown': 4, 'depthRepCode': 15, 'frameSpacing': 8}
Map of supported attributes i.e. those that are ‘interesting’
-
EB_DOC = {0: 'Terminator, size is chosen to make total size even.', 1: 'Data Record Type. The type of the IFLR (0 | 1) that this describes.', 2: 'Datum Spec Block Type. How to interpret the DSBs. Only 0 is defined.', 3: 'Data Frame Size. Not required.', 4: 'Up/Down. 1=up, 255=down, 0=neither.', 5: 'Optical Log Scale. 1=Feet, 255=Meters, 0=Time.', 6: 'Data Reference Point. The distance of the data reference point above the tool reference point. Essentially add this to depth to find the depth axis of un-memorised data such as tension.', 7: 'Units for Data Reference Point.', 8: 'Frame Spacing.', 9: 'Units for Frame Spacing.', 10: 'Undefined.', 11: 'Maximum Frames per Record.', 12: 'Absent value.', 13: 'Depth Recording Mode. 1=Indirect X, 0=Direct X', 14: 'Units of Depth when depth Recording Mode=1', 15: 'Representation Code for depth when Depth Recording Mode=1', 16: 'Datum Spec Block sub-Type. How to interpret the DSBs (0 | 1)'}
Documentation about each Entry Block
-
BLOCKS_TO_SKIP = (10,)
List of block numbers that are not written out, also _setLisSizeEven()
and lisSize() ignore these.
-
__getattr__(name)
Returns the Entry Block corresponding to the name.
-
__getitem__(key)
This returns an Entry block by integer index.
-
logUp
True if the logging direction is up (X decreasing).
Note: not logUp and not logDown is possible to be True e.g. time log.
-
logDown
True if the logging direction is down (X increasing).
Note: not logUp and not logDown is possible to be True e.g. time log.
-
xInc
True if the logging X increases (down or time log).
-
opticalLogScale
Returns the Units corresponding to Entry Block 5: ‘Optical Log Scale’
This will be a LENG or TIME unit or empty if undefined.
-
lisSize()
Returns the totla size of the Entry Block set.
-
setEntryBlock(theEb)
Sets an Entry Block.
-
readFromFile(theFile)
Reads from a File object. NOTE: theFile.hasLd() must be True so
the Logical Record Header must have been read already.
-
lisBytes()
Returns the Entry Block set as an array of bytes.
-
lisByteList()
Returns a list of bytes() objects, one for each entry block.
-
__weakref__
list of weak references to the object (if defined)
-
exception TotalDepth.LIS.core.LogiRec.ExceptionDatumSpecBlock
Specialisation of exception for Datum Specification Blocks.
-
class TotalDepth.LIS.core.LogiRec.DatumSpecBlock
This represents as Datum Specification Block.
-
isNull
True if this block is compromised in any way and should be ignored
when composing a DFSR. The critical test is whether the data from this
channel will be in the frame.
-
samples(theSc)
Returns the number of samples in a sub-channel.
-
bursts(theSc)
Returns the (samples, burst) for a sub-channel (bursts are invariant over sub-channels).
-
values()
Returns the total number of discrete values per frame for a single channel.
-
subChMnem(theSc)
Returns the curve Mnemonic for a particular sub-channel or None if unknown.
-
__weakref__
list of weak references to the object (if defined)
-
class TotalDepth.LIS.core.LogiRec.DatumSpecBlockRead(theF)
This represents as Datum Specification Block read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrDFSR(theType, theAttr)
Data Format Specification Record.
-
class TotalDepth.LIS.core.LogiRec.LrDFSRRead(theFile)
Data Format Specification Record read from a file.
-
class TotalDepth.LIS.core.LogiRec.LrNormalAlternateData(theType, theAttr)
Class for Normal and Alternate data i.e. curve data.
-
class TotalDepth.LIS.core.LogiRec.LrNormalAlternateDataRead(theFile)
Class for Normal and Alternate data i.e. curve data.
-
class TotalDepth.LIS.core.LogiRec.LrFactory
Provides a despatch mechanism for generating Logical Records.
This can be sub-classed to create different sets of Logical Records.
For example the Indexer creates minimal logical records.
-
__weakref__
list of weak references to the object (if defined)
-
class TotalDepth.LIS.core.LogiRec.LrFactoryRead
A factory for generating complete Logical Records from a file.
-
retLrFromFile(theFile)
Given a LIS file this reads one Logical Record, and returns the
appropriate Logical Record object or None.