TotalDepth.LIS.core.RepCode (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

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.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.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.

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

Returns the 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.minMaxValue(r)

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

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.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.read49(theFile)

Returns a Representation Code 49 value from a File object.

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.to50(theVal)

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

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

Returns a Representation Code 50 value from a File object.

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

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

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

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

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

Returns a Representation Code 56 value from a File object.

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

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

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

Converts theVal to representation code 66 integer from theWord.

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

Returns a Representation Code 66 value from a File object.

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

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

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

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

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

Returns a Representation Code 68 value from a File object.

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

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

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

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

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

Returns a Representation Code 70 value from a File object.

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

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

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

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

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

Returns a Representation Code 73 value from a File object.

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

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

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

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

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

Returns a Representation Code 77 value from a File object.

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

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

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

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

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

Returns a Representation Code 79 value from a File object.

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

Testing

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