LIS Handling of Representation Codes

This describes how TotalDepth.LIS handles representation codes, it covers several modules.

Design

There is a top level module RepCode that imports all sub-modules and provides some fundamental definitions. Sub-modules pRepCode and cRepCOde provide alternative implementations in Python or Cython.

RepCode Module

Description

This provides the main interface to Representation Code processing as well as some fundamental definitions.

This module is the top level module that imports other sub-modules implemented in Python, Cython or C/C++. The Cython implementations take precedence as this module imports the sub-modules thus:

from TotalDepth.LIS.core.pRepCode import *
from TotalDepth.LIS.core.cRepCode import *

Usage

It is designed to use thus:

from TotalDepth.LIS.core import RepCode

Reference

Module for translating raw LIS to an appropriate internal type for LIS Representation Codes (‘RepCodes’).

This aggregates pRepCode and cRepCode with the latter overwriting the former.

Created on 11 Nov 2010

@author: p2ross

exception TotalDepth.LIS.core.RepCode.ExceptionRepCodeNoLength

Exception for indeterminate length when using Rep Code 65.

exception TotalDepth.LIS.core.RepCode.ExceptionRepCodeRead

Exception for unknown Representation codes in look up tables.

exception TotalDepth.LIS.core.RepCode.ExceptionRepCodeWrite

Exception for unknown Representation codes in look up tables.

TotalDepth.LIS.core.RepCode.fromRepCode(theRc, theWord)

Given theRc as a Rep Code type and a word value this returns the internal value.

TotalDepth.LIS.core.RepCode.read49(theFile)

Returns a Representation Code 49 value from a File object.

TotalDepth.LIS.core.RepCode.read50(theFile)

Returns a Representation Code 50 value from a File object.

TotalDepth.LIS.core.RepCode.read56(theFile)

Returns a Representation Code 56 value from a File object.

TotalDepth.LIS.core.RepCode.read66(theFile)

Returns a Representation Code 66 value from a File object.

TotalDepth.LIS.core.RepCode.read68(theFile)

Returns a Representation Code 68 value from a File object.

TotalDepth.LIS.core.RepCode.read70(theFile)

Returns a Representation Code 70 value from a File object.

TotalDepth.LIS.core.RepCode.read73(theFile)

Returns a Representation Code 73 value from a File object.

TotalDepth.LIS.core.RepCode.read77(theFile)

Returns a Representation Code 77 value from a File object.

TotalDepth.LIS.core.RepCode.read79(theFile)

Returns a Representation Code 79 value from a File object.

TotalDepth.LIS.core.RepCode.readBytes(theRc, theB, theLen=None)

Reads a Representation Code from the a bytes() object. If theRc is 65 (string) then theLen must be supplied, up to that length of bytes will be returned.

TotalDepth.LIS.core.RepCode.readBytes130(by)

Reads Dipmeter RepCode 130 and returns a list of (integer) values.

TotalDepth.LIS.core.RepCode.readBytes234(by)

Reads Dipmeter RepCode 234 and returns a list of (integer) values.

TotalDepth.LIS.core.RepCode.readBytes49(arg)

Returns a Representation Code 49 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes50(arg)

Returns a Representation Code 50 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes56(arg)

Returns a Representation Code 56 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes66(arg)

Returns a Representation Code 66 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes68(arg)

Returns a Representation Code 68 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes70(arg)

Returns a Representation Code 70 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes73(arg)

Returns a Representation Code 73 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes77(arg)

Returns a Representation Code 77 value from a bytes object.

TotalDepth.LIS.core.RepCode.readBytes79(arg)

Returns a Representation Code 79 value from a bytes object.

TotalDepth.LIS.core.RepCode.readRepCode(theRc, theFile, theLen=None)

Reads a Representation Code from the file and returns a value. If theRc is 65 (string) then theLen must be supplied, up to that length of bytes will be returned.

TotalDepth.LIS.core.RepCode.writeBytes(v, r)

Takes a value v and a Representation Code r and converts this to a bytes() object.

TotalDepth.LIS.core.RepCode.writeBytes66(v)

Converts a value to a Rep Code 66 and returns the bytes.

TotalDepth.LIS.core.RepCode.writeBytes68(v)

Converts a value to a Rep Code 68 and returns the bytes.

TotalDepth.LIS.core.RepCode.writeBytes73(v)

Converts a value to a Rep Code 73 and returns the bytes.

pRepCode Module

This contains Python implementations.

Usage

This module is not designed to imported directly, use RepCode instead. This module can be imported only for test purposes thus:

from TotalDepth.LIS.core import pRepCode

Reference

Python module for translating raw LIS to an appropriate internal type for LIS Representation Codes (‘RepCodes’).

Created on 11 Nov 2010

@author: p2ross

exception TotalDepth.LIS.core.pRepCode.ExceptionRepCode

Specialisation of exception for Representation codes.

exception TotalDepth.LIS.core.pRepCode.ExceptionRepCodeUnknown

Specialisation of exception for unknown Representation codes.

TotalDepth.LIS.core.pRepCode.from49(theWord)

Returns a double from Rep code 49 0x31, 16bit floating point representation. Value +153 is 0100 1100 1000 1000 or 0x4C88. Value -153 is 1011 0011 1000 1000 or 0xB388.

TotalDepth.LIS.core.pRepCode.from50(theWord)

Returns a double from Rep code 0x32, 32bit floating point representation. Value +153 is 0x00084C80 Value -153 is 0x0008B380

TotalDepth.LIS.core.pRepCode.from56(theWord)

Returns an integer from Rep code 0x38, signed char representation.

TotalDepth.LIS.core.pRepCode.from66(theWord)

Returns a Rep code 0x42, unsigned byte from theWord, expected to be an integer.

TotalDepth.LIS.core.pRepCode.from68(theWord)

Returns a double from a Rep code 68 word (a 32 bit integer).

TotalDepth.LIS.core.pRepCode.from70(theWord)

Returns a double from a Rep code 0x46, 32bit fixed point.

TotalDepth.LIS.core.pRepCode.from73(theWord)

Returns a integer from a Rep code 0x49, 32bit signed integer.

TotalDepth.LIS.core.pRepCode.from77(theWord)

Returns a Rep code 0x4D, 8bit mask from theWord, expected to be an integer.

TotalDepth.LIS.core.pRepCode.from79(theWord)

Returns an integer from Rep code 0x4F, 16bit signed integer.

TotalDepth.LIS.core.pRepCode.isInt(r)

Returns True if the Rep Code is represented by an integer.

TotalDepth.LIS.core.pRepCode.lisSize(r)

Returns the size in bytes for a single instance of a representation code. Zero means variable length. May raise ExceptionRepCodeUnknown.

TotalDepth.LIS.core.pRepCode.maxValue(r)

Returns the maximum value for various representation codes. May raise ExceptionRepCodeUnknown.

TotalDepth.LIS.core.pRepCode.minMaxValue(r)

Returns a pair; (minimum value, maximum value) for various representation codes. May raise ExceptionRepCodeUnknown.

TotalDepth.LIS.core.pRepCode.minValue(r)

Returns the minimum value for various representation codes. May raise ExceptionRepCodeUnknown.

TotalDepth.LIS.core.pRepCode.read49(theFile)

Returns a Representation Code 49 value from a File object.

TotalDepth.LIS.core.pRepCode.read50(theFile)

Returns a Representation Code 50 value from a File object.

TotalDepth.LIS.core.pRepCode.read56(theFile)

Returns a Representation Code 56 value from a File object.

TotalDepth.LIS.core.pRepCode.read66(theFile)

Returns a Representation Code 66 value from a File object.

TotalDepth.LIS.core.pRepCode.read68(theFile)

Returns a Representation Code 68 value from a File object.

TotalDepth.LIS.core.pRepCode.read70(theFile)

Returns a Representation Code 70 value from a File object.

TotalDepth.LIS.core.pRepCode.read73(theFile)

Returns a Representation Code 73 value from a File object.

TotalDepth.LIS.core.pRepCode.read77(theFile)

Returns a Representation Code 77 value from a File object.

TotalDepth.LIS.core.pRepCode.read79(theFile)

Returns a Representation Code 79 value from a File object.

TotalDepth.LIS.core.pRepCode.to49(theVal)

Converts a double to Rep code 49 0x31, 16bit floating point representation. Value +153 is 0100 1100 1000 1000 or 0x4C88. Value -153 is 1011 0011 1000 1000 or 0xB388.

TotalDepth.LIS.core.pRepCode.to50(theVal)

Converts a double to Rep code 0x32, 32bit floating point representation.

TotalDepth.LIS.core.pRepCode.to56(theVal)

Converts a double to Rep code 0x38, signed char representation.

TotalDepth.LIS.core.pRepCode.to66(theVal)

Converts theVal to representation code 66 integer from theWord.

TotalDepth.LIS.core.pRepCode.to68(v)

Returns Representation code 68 as a 32 bit integer from a double.

TotalDepth.LIS.core.pRepCode.to70(v)

Returns Rep code 0x46, 32bit fixed point from an int or double.

TotalDepth.LIS.core.pRepCode.to73(v)

Returns Rep code 0x49, 32bit signed integer from an int or double.

TotalDepth.LIS.core.pRepCode.to77(theVal)

Converts theVal to Rep code 0x4D, 8bit mask from theVal.

TotalDepth.LIS.core.pRepCode.to79(theVal)

Converts a double to Rep code 0x4F, 16bit signed integer.

TotalDepth.LIS.core.pRepCode.wordLength(r)

Returns the word length in bytes used by a representation code. NOTE: This is subtly different from lisSize as it take into account dipmeter sub-channels Zero means variable length. May raise ExceptionRepCodeUnknown.

cRepCode Module

This contains Cython implementations. By the import mechanism used be RepCode these implementations take precedence over the implementations in pRepCode.

Usage

This module is not designed to imported directly, use RepCode instead. This module can be imported only for test purposes thus:

from TotalDepth.LIS.core import cRepCode

Reference

Cython module for translating raw LIS to an appropriate internal type for LIS Representation Codes (‘RepCodes’).

Internal types are double, int or string.

Testing

The unit tests are in test/TestRepCode.py and test/TestRepCode68.py.

Table Of Contents

Previous topic

TotalDepth.LIS API Reference

Next topic

Units

This Page