segy_drv_rev1
index
/Users/schwehr/projects/xcore/src/segy-py/segy_drv_rev1.py

Module to read segy files.  No writing at this time.
 
     Copyright (C) 2005  Kurt Schwehr
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
$Id: segy_drv_rev1.py,v 1.9 2005/06/16 20:21:42 schwehr Exp $
 
The SEGY Rev 1 standard was published in 2002:
 
http://seg.org/publications/tech-stand/seg_y_rev1.doc
http://seg.org/publications/tech-stand/seg_y_rev1.pdf
 
The SEG Y Data Exchange Format (rev 0) was published in 1975, and has
achieved widespread usage. However, since 1975, the nature of seismic
data acquisition, processing, and seismic hardware has changed
significantly. SEG Y rev 1 addresses these changes and updates the
format for modern usage.

 
Modules
       
unittest

 
Classes
       
unittest.TestCase(__builtin__.object)
TestXstar

 
class TestXstar(unittest.TestCase)
    Test as much as we can of the SEGY Rev 1 driver
 
 
Method resolution order:
TestXstar
unittest.TestCase
__builtin__.object

Methods defined here:
testTraceHeaders(self)
Make sure all trace headers do not overlap

Methods inherited from unittest.TestCase:
__call__(self, *args, **kwds)
__init__(self, methodName='runTest')
Create an instance of the class that will use the named test
method when executed. Raises a ValueError if the instance does
not have a method with the specified name.
__repr__(self)
__str__(self)
assertAlmostEqual = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertAlmostEquals = failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertEqual = failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
assertEquals = failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
assertFalse = failIf(self, expr, msg=None)
Fail the test if the expression is true.
assertNotAlmostEqual = failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertNotAlmostEquals = failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
assertNotEqual = failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
assertNotEquals = failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
assertRaises = failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
assertTrue = failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
assert_ = failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
countTestCases(self)
debug(self)
Run the test without collecting errors in a TestResult
defaultTestResult(self)
fail(self, msg=None)
Fail immediately, with the given message.
failIf(self, expr, msg=None)
Fail the test if the expression is true.
failIfAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are equal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
failIfEqual(self, first, second, msg=None)
Fail if the two objects are equal as determined by the '=='
operator.
failUnless(self, expr, msg=None)
Fail the test unless the expression is true.
failUnlessAlmostEqual(self, first, second, places=7, msg=None)
Fail if the two objects are unequal as determined by their
difference rounded to the given number of decimal places
(default 7) and comparing to zero.
 
Note that decimal places (from zero) are usually not the same
as significant digits (measured from the most signficant digit).
failUnlessEqual(self, first, second, msg=None)
Fail if the two objects are unequal as determined by the '=='
operator.
failUnlessRaises(self, excClass, callableObj, *args, **kwargs)
Fail unless an exception of class excClass is thrown
by callableObj when invoked with arguments args and keyword
arguments kwargs. If a different type of exception is
thrown, it will not be caught, and the test case will be
deemed to have suffered an error, exactly as for an
unexpected exception.
id(self)
run(self, result=None)
setUp(self)
Hook method for setting up the test fixture before exercising it.
shortDescription(self)
Returns a one-line description of the test, or None if no
description has been provided.
 
The default implementation of this method returns the first line of
the specified test method's docstring.
tearDown(self)
Hook method for deconstructing the test fixture after testing it.

Data and other attributes inherited from unittest.TestCase:
__dict__ = <dictproxy object>
dictionary for instance variables (if defined)
__weakref__ = <attribute '__weakref__' of 'TestCase' objects>
list of weak references to the object (if defined)
failureException = <class exceptions.AssertionError>
Assertion failed.

 
Data
        DRIVER_NAME = 'rev1'
binaryHeaderEntries = {'AmpRecovMeth': [3253, 3254, 'Amplitude recovery method'], 'AuxTracesPerEnsemble': [3215, 3216, 'Number of auxiliary traces per ensemble'], 'BinGainRecovered': [3251, 3252, 'Binary gain recovered. 1=yes, 2=no'], 'CorrelatedTraces': [3249, 3250, 'Correlated data traces. 1=no, 2=yes'], 'EnsembleFold': [3227, 3228, 'The expected number of data traces per trace ensemble - the CMP fold'], 'FixedLenTraceFlag': [3503, 3504, '1 indeicates that all trances in this file are all the same length'], 'ImpulsePolarity': [3257, 3258, 'Impulse signal polarity. increasing pres or move give negative value'], 'JobId': [3201, 3204, 'Job identification number'], 'LineNo': [3205, 3208, 'Line number'], 'MeasurementSystem': [3255, 3256, '1 = Meters, 2 = Feet'], ...}
coordUnits = {1: 'Length (meters or feet)', 2: 'Seconds of arc', 3: 'Decimal degrees', 4: 'Degrees, minutes, seconds (DMS)Note: To encode +...6 + MM*104 + SS*102 with bytes 71-72 set to -100.'}
dataFormatStruct = {1: None, 2: '>i', 3: '>h', 4: None, 5: 'f', 6: None, 7: None, 8: '>b'}
dataFormats = {1: '4-byte IBM floating point', 2: '4-byte, twos complement integer', 3: '2-byte, twos complement integer', 4: '4-byte, fixed-point with gain(obsolete)', 5: '4-byte IEEE floating-point', 6: 'Not currently used', 7: 'Not currently used', 8: '1-byte, twos complement integer'}
dataUse = {1: 'Production', 2: 'Test'}
fileHeaderShortList = ['JobId', 'LineNo', 'ReelNo', 'TracesPerEnsemble', 'SampleInterval', 'SamplesPerTrace', 'SampleFormat', 'SweepStart', 'SweepEnd', 'SweepLenSweepType', 'FixedLenTraceFlag']
fileHeaderTables = {'SampleFormat': {1: '4-byte IBM floating point', 2: '4-byte, twos complement integer', 3: '2-byte, twos complement integer', 4: '4-byte, fixed-point with gain(obsolete)', 5: '4-byte IEEE floating-point', 6: 'Not currently used', 7: 'Not currently used', 8: '1-byte, twos complement integer'}, 'SweepType': {1: 'linear', 2: 'parabolic', 3: 'exponential', 4: 'other'}, 'TraceSorting': {-1: 'Other', 0: 'Unknown', 1: 'As recorded', 2: 'CDP ensemble', 3: 'Single fold continuous profile', 4: 'Horizontally stacked', 5: 'Common source point', 6: 'Common receiver point', 7: 'Common offset point', 8: 'Common mid-point', ...}}
gainType = {1: 'fixed', 2: 'binary', 3: 'floating point'}
overTravel = {1: 'down (or behind) ', 2: 'up (or ahead)'}
srcMeasUnits = {-1: 'Other (should be described in Source Measurement Unit stanza, page 39)', 0: 'Unknown', 1: 'Joule (J)', 2: 'Kilowatt (kW)', 3: 'Pascal (Pa)', 4: 'Bar (Bar)', 5: 'Bar-meter (Bar-m)', 6: 'Newton (N)', 7: 'Kilograms (kg)'}
srcTypeOrient = {-1: 'Other (should be described in Source Type/Orientation stanza, page 38)', 0: 'Unknown', 1: 'Vibratory - Vertical orientation', 2: 'Vibratory - Cross-line orientation', 3: 'Vibratory - In-line orientation', 4: 'Impulsive - Vertical orientation', 5: 'Impulsive - Cross-line orientation', 6: 'Impulsive - In-line orientation', 7: 'Distributed Impulsive - Vertical orientation', 8: 'Distributed Impulsive - Cross-line orientation', ...}
structIntCodes = {1: '>b', 2: '>h', 4: '>i', 8: '>q'}
sweepTypeCodes = {1: 'linear', 2: 'parabolic', 3: 'exponential', 4: 'other'}
taperType = {1: 'linear ', 2: 'cos2', 3: 'other'}
textFileHeaderEntries = {'AREA': [2, 11], 'CLIENT': [1, 5], 'COMPANY': [1, 35], 'CREW NO': [1, 65], 'LINE': [2, 5], 'MAP ID': [2, 49], 'REAL NO': [3, 5]}
timeBasis = {1: 'Local', 2: 'GMT (Greenwich Mean Time)', 3: 'Other, should be explained in a user defined stanza in the Extended Textual File Header', 4: 'UTC (Coordinated Universal Time)'}
traceHdrSize = 240
traceHeader = {'AliasFiltFreq': [141, 142, 'Alias filter frequency (Hz), if used.'], 'AliasFiltSlope': [143, 144, 'Alias filter slope (dB/octave).'], 'CoordUnits': [89, 90, 'Coordinate units: '], 'Correlated': [125, 126, 'Correlated: 1 = no, 2 = yes'], 'DataUse': [35, 36, 'Data use: '], 'Day': [159, 160, 'Day of year (Julian day for GMT and UTC time basis).'], 'Delay': [109, 110, 'Delay recording time - Time in milliseconds betw... effect should appear in the Textual File Header.'], 'DevTrId': [213, 214, 'Device/Trace Identifier - The unit number or id ...y of the trace number (Trace Header bytes 25-28).'], 'DistanceCenter': [37, 40, 'Distance from center of the source point to the ... if opposite to direction in which line is shot).'], 'ESrcPtNo': [17, 20, 'Energy source point number - Used when more than...eader bytes 197-202 be used for shotpoint number.'], ...}
traceHeaderShortList = ['LineSeqNo', 'FileSeqNo', 'FieldRecNo', 'TraceNo', 'EnsembleNo', 'TraceNoEnsemble', 'X', 'Y', 'GrpX', 'GrpY', 'WxVel', 'SubWxVel', 'LagTA', 'LagTB', 'Delay', 'TraceSamples', 'SampleInterval', 'SweepFreqStart', 'SweepFreqEnd', 'SweepLen', ...]
traceHeaderTables = {'CoordUnits': {1: 'Length (meters or feet)', 2: 'Seconds of arc', 3: 'Decimal degrees', 4: 'Degrees, minutes, seconds (DMS)Note: To encode +...6 + MM*104 + SS*102 with bytes 71-72 set to -100.'}, 'DataUse': {1: 'Production', 2: 'Test'}, 'GainType': {1: 'fixed', 2: 'binary', 3: 'floating point'}, 'OverTravel': {1: 'down (or behind) ', 2: 'up (or ahead)'}, 'SrcMeasUnits': {-1: 'Other (should be described in Source Measurement Unit stanza, page 39)', 0: 'Unknown', 1: 'Joule (J)', 2: 'Kilowatt (kW)', 3: 'Pascal (Pa)', 4: 'Bar (Bar)', 5: 'Bar-meter (Bar-m)', 6: 'Newton (N)', 7: 'Kilograms (kg)'}, 'SrcTypeOrient': {-1: 'Other (should be described in Source Type/Orientation stanza, page 38)', 0: 'Unknown', 1: 'Vibratory - Vertical orientation', 2: 'Vibratory - Cross-line orientation', 3: 'Vibratory - In-line orientation', 4: 'Impulsive - Vertical orientation', 5: 'Impulsive - Cross-line orientation', 6: 'Impulsive - In-line orientation', 7: 'Distributed Impulsive - Vertical orientation', 8: 'Distributed Impulsive - Cross-line orientation', ...}, 'SweepType': {1: 'linear', 2: 'parabolic', 3: 'exponential', 4: 'other'}, 'TaperType': {1: 'linear ', 2: 'cos2', 3: 'other'}, 'TimeBasis': {1: 'Local', 2: 'GMT (Greenwich Mean Time)', 3: 'Other, should be explained in a user defined stanza in the Extended Textual File Header', 4: 'UTC (Coordinated Universal Time)'}, 'TraceId': {-1: 'Other', 0: 'Unknown', 1: 'Seismic data', 2: 'Dead', 3: 'Dummy', 4: 'Time break', 5: 'Uphole', 6: 'Sweep', 7: 'Timing', 8: 'Waterbreak', ...}, ...}
traceIdCode = {-1: 'Other', 0: 'Unknown', 1: 'Seismic data', 2: 'Dead', 3: 'Dummy', 4: 'Time break', 5: 'Uphole', 6: 'Sweep', 7: 'Timing', 8: 'Waterbreak', ...}
traceSortingCodes = {-1: 'Other', 0: 'Unknown', 1: 'As recorded', 2: 'CDP ensemble', 3: 'Single fold continuous profile', 4: 'Horizontally stacked', 5: 'Common source point', 6: 'Common receiver point', 7: 'Common offset point', 8: 'Common mid-point', ...}
traceUnits = {-1: 'Other (should be described in Data Sample Measurement Units Stanza)', 0: 'Unknown', 1: 'Pascal (Pa)', 2: 'Volts (v)', 3: 'Millivolts (mV)', 4: 'Amperes (A)', 5: 'Meters (m)', 6: 'Meters per second (m/s)', 7: 'Meters per second squared (m/s2)', 8: 'Newton (N)', ...}
transdUnits = {-1: 'Other (should be described in Data Sample Measurement Unit stanza, page 36)', 0: 'Unknown', 1: 'Pascal (Pa)', 2: 'Volts (v)', 3: 'Millivolts (mV)', 4: 'Amperes (A)', 5: 'Meters (m)', 6: 'Meters per second (m/s)', 7: 'Meters per second squared (m/s2)', 8: 'Newton (N)', ...}