mirror of
https://github.com/wassname/segpy.git
synced 2026-09-09 11:34:00 +08:00
Relocated header definitions into separate files.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
"""
|
||||
SEG Y Header Definition
|
||||
"""
|
||||
|
||||
from revisions import SEGY_REVISION_0, SEGY_REVISION_1
|
||||
|
||||
SH_def = {"Job": {"pos": 3200, "type": "int32", "def": 0}}
|
||||
SH_def["Line"]= {"pos": 3204, "type": "int32", "def": 0}
|
||||
SH_def["Reel"]= {"pos": 3208, "type": "int32", "def": 0}
|
||||
SH_def["DataTracePerEnsemble"]= {"pos": 3212, "type": "int16", "def": 0}
|
||||
SH_def["AuxiliaryTracePerEnsemble"] = {"pos": 3214, "type": "int16", "def": 0}
|
||||
SH_def["dt"]= {"pos": 3216, "type": "uint16", "def": 1000}
|
||||
SH_def["dtOrig"]= {"pos": 3218, "type": "uint16", "def": 1000}
|
||||
SH_def["ns"] = {"pos": 3220, "type": "uint16", "def": 0}
|
||||
SH_def["nsOrig"] = {"pos": 3222, "type": "uint16", "def": 0}
|
||||
SH_def["DataSampleFormat"] = {"pos": 3224, "type": "int16", "def": 5}
|
||||
SH_def["DataSampleFormat"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "IBM Float",
|
||||
2: "32 bit Integer",
|
||||
3: "16 bit Integer",
|
||||
8: "8 bit Integer"}}
|
||||
|
||||
SH_def["DataSampleFormat"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "IBM Float",
|
||||
2: "32 bit Integer",
|
||||
3: "16 bit Integer",
|
||||
5: "IEEE",
|
||||
8: "8 bit Integer"}
|
||||
|
||||
SH_def["DataSampleFormat"]["bps"] = {SEGY_REVISION_0: {
|
||||
1: 4,
|
||||
2: 4,
|
||||
3: 2,
|
||||
8: 1}}
|
||||
SH_def["DataSampleFormat"]["bps"][SEGY_REVISION_1] = {
|
||||
1: 4,
|
||||
2: 4,
|
||||
3: 2,
|
||||
5: 4,
|
||||
8: 1}
|
||||
SH_def["DataSampleFormat"]["datatype"] = {SEGY_REVISION_0: {
|
||||
1: 'ibm',
|
||||
2: 'l',
|
||||
3: 'h',
|
||||
8: 'B'}}
|
||||
SH_def["DataSampleFormat"]["datatype"][SEGY_REVISION_1] = {
|
||||
1: 'ibm',
|
||||
2: 'l',
|
||||
3: 'h',
|
||||
# 5: 'float',
|
||||
5: 'f',
|
||||
8: 'B'}
|
||||
|
||||
SH_def["EnsembleFold"] = {"pos": 3226, "type": "int16", "def": 0}
|
||||
SH_def["TraceSorting"] = {"pos": 3228, "type": "int16", "def": 0}
|
||||
SH_def["VerticalSumCode"] = {"pos": 3230, "type": "int16", "def": 0}
|
||||
SH_def["SweepFrequencyEnd"] = {"pos": 3234, "type": "int16", "def": 0}
|
||||
SH_def["SweepLength"] = {"pos": 3236, "type": "int16", "def": 0}
|
||||
SH_def["SweepType"] = {"pos": 3238, "type": "int16", "def": 0}
|
||||
SH_def["SweepChannel"] = {"pos": 3240, "type": "int16", "def": 0}
|
||||
SH_def["SweepTaperLengthStart"] = {"pos": 3242, "type": "int16", "def": 0}
|
||||
SH_def["SweepTaperLengthEnd"] = {"pos": 3244, "type": "int16", "def": 0}
|
||||
SH_def["TaperType"] = {"pos": 3246, "type": "int16", "def": 0}
|
||||
SH_def["CorrelatedDataTraces"] = {"pos": 3248, "type": "int16", "def": 0}
|
||||
SH_def["BinaryGain"] = {"pos": 3250, "type": "int16", "def": 0}
|
||||
SH_def["AmplitudeRecoveryMethod"] = {"pos": 3252, "type": "int16", "def": 0}
|
||||
SH_def["MeasurementSystem"] = {"pos": 3254, "type": "int16", "def": 0}
|
||||
SH_def["ImpulseSignalPolarity"] = {"pos": 3256, "type": "int16", "def": 0}
|
||||
SH_def["VibratoryPolarityCode"] = {"pos": 3258, "type": "int16", "def": 0}
|
||||
SH_def["Unassigned1"] = {"pos": 3260, "type": "int16", "n": 120, "def": 0}
|
||||
SH_def["SegyFormatRevisionNumber"] = {"pos": 3500, "type": "uint16", "def": 100}
|
||||
SH_def["FixedLengthTraceFlag"] = {"pos": 3502, "type": "uint16", "def": 0}
|
||||
SH_def["NumberOfExtTextualHeaders"] = {"pos": 3504, "type": "uint16", "def": 0}
|
||||
SH_def["Unassigned2"] = {"pos": 3506, "type": "int16", "n": 47, "def": 0}
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
SEGY_REVISION_0 = 0x0000
|
||||
SEGY_REVISION_1 = 0x0100
|
||||
@@ -37,14 +37,14 @@ from numpy import reshape
|
||||
from numpy import zeros
|
||||
from numpy import arange
|
||||
|
||||
from revisions import SEGY_REVISION_0, SEGY_REVISION_1
|
||||
from header_definition import SH_def
|
||||
from trace_header_definition import STH_def
|
||||
|
||||
logger = logging.getLogger('segpy.segypy')
|
||||
|
||||
# SOME GLOBAL PARAMETERS
|
||||
version = '0.3.1' # modified by A Squelch
|
||||
|
||||
SEGY_REVISION_0 = 0x0000
|
||||
SEGY_REVISION_1 = 0x0100
|
||||
|
||||
REEL_HEADER_NUM_BYTES = 3600
|
||||
TRACE_HEADER_NUM_BYTES = 240
|
||||
|
||||
@@ -53,311 +53,31 @@ l_uchar = struct.calcsize('B')
|
||||
l_float = struct.calcsize('f')
|
||||
|
||||
|
||||
CTYPES = {'l': 'l', 'long': 'l', 'int32': 'l',
|
||||
'L': 'L', 'ulong': 'L', 'uint32': 'L',
|
||||
'h': 'h', 'short': 'h', 'int16': 'h',
|
||||
DATA_SAMPLE_FORMAT = { 1: 'ibm',
|
||||
2: 'l',
|
||||
3: 'h',
|
||||
5: 'f',
|
||||
8: 'B' }
|
||||
|
||||
CTYPES = {'l': 'l', 'long' : 'l', 'int32': 'l',
|
||||
'L': 'L', 'ulong' : 'L', 'uint32': 'L',
|
||||
'h': 'h', 'short' : 'h', 'int16': 'h',
|
||||
'H': 'H', 'ushort': 'H', 'uint16': 'H',
|
||||
'c': 'c', 'char': 'c',
|
||||
'B': 'B', 'uchar': 'B',
|
||||
'f': 'f', 'float': 'f',
|
||||
'ibm': None}
|
||||
'c': 'c', 'char' : 'c',
|
||||
'B': 'B', 'uchar' : 'B',
|
||||
'f': 'f', 'float' : 'f',
|
||||
'ibm': 'ibm'}
|
||||
|
||||
# TODO This is redundant with data in the SH_def below
|
||||
CTYPE_DESCRIPTION = { 'ibm' : 'IBM float',
|
||||
'l' : '32 bit integer',
|
||||
'h' : '16 bit integer',
|
||||
'f' : 'IEEE float',
|
||||
'B' : '8 bit char' }
|
||||
|
||||
def size_in_bytes(ctype):
|
||||
return struct.calcsize(ctype) if ctype != 'ibm' else struct.calcsize('f')
|
||||
|
||||
##############
|
||||
# INIT
|
||||
|
||||
##############
|
||||
# Initialize SEGY HEADER
|
||||
SH_def = {"Job": {"pos": 3200, "type": "int32", "def": 0}}
|
||||
SH_def["Line"]= {"pos": 3204, "type": "int32", "def": 0}
|
||||
SH_def["Reel"]= {"pos": 3208, "type": "int32", "def": 0}
|
||||
SH_def["DataTracePerEnsemble"]= {"pos": 3212, "type": "int16", "def": 0}
|
||||
SH_def["AuxiliaryTracePerEnsemble"] = {"pos": 3214, "type": "int16", "def": 0}
|
||||
SH_def["dt"]= {"pos": 3216, "type": "uint16", "def": 1000}
|
||||
SH_def["dtOrig"]= {"pos": 3218, "type": "uint16", "def": 1000}
|
||||
SH_def["ns"] = {"pos": 3220, "type": "uint16", "def": 0}
|
||||
SH_def["nsOrig"] = {"pos": 3222, "type": "uint16", "def": 0}
|
||||
SH_def["DataSampleFormat"] = {"pos": 3224, "type": "int16", "def": 5}
|
||||
SH_def["DataSampleFormat"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "IBM Float",
|
||||
2: "32 bit Integer",
|
||||
3: "16 bit Integer",
|
||||
8: "8 bit Integer"}}
|
||||
|
||||
SH_def["DataSampleFormat"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "IBM Float",
|
||||
2: "32 bit Integer",
|
||||
3: "16 bit Integer",
|
||||
5: "IEEE",
|
||||
8: "8 bit Integer"}
|
||||
|
||||
SH_def["DataSampleFormat"]["bps"] = {SEGY_REVISION_0: {
|
||||
1: 4,
|
||||
2: 4,
|
||||
3: 2,
|
||||
8: 1}}
|
||||
SH_def["DataSampleFormat"]["bps"][SEGY_REVISION_1] = {
|
||||
1: 4,
|
||||
2: 4,
|
||||
3: 2,
|
||||
5: 4,
|
||||
8: 1}
|
||||
SH_def["DataSampleFormat"]["datatype"] = {SEGY_REVISION_0: {
|
||||
1: 'ibm',
|
||||
2: 'l',
|
||||
3: 'h',
|
||||
8: 'B'}}
|
||||
SH_def["DataSampleFormat"]["datatype"][SEGY_REVISION_1] = {
|
||||
1: 'ibm',
|
||||
2: 'l',
|
||||
3: 'h',
|
||||
# 5: 'float',
|
||||
5: 'f',
|
||||
8: 'B'}
|
||||
|
||||
SH_def["EnsembleFold"] = {"pos": 3226, "type": "int16", "def": 0}
|
||||
SH_def["TraceSorting"] = {"pos": 3228, "type": "int16", "def": 0}
|
||||
SH_def["VerticalSumCode"] = {"pos": 3230, "type": "int16", "def": 0}
|
||||
SH_def["SweepFrequencyEnd"] = {"pos": 3234, "type": "int16", "def": 0}
|
||||
SH_def["SweepLength"] = {"pos": 3236, "type": "int16", "def": 0}
|
||||
SH_def["SweepType"] = {"pos": 3238, "type": "int16", "def": 0}
|
||||
SH_def["SweepChannel"] = {"pos": 3240, "type": "int16", "def": 0}
|
||||
SH_def["SweepTaperLengthStart"] = {"pos": 3242, "type": "int16", "def": 0}
|
||||
SH_def["SweepTaperLengthEnd"] = {"pos": 3244, "type": "int16", "def": 0}
|
||||
SH_def["TaperType"] = {"pos": 3246, "type": "int16", "def": 0}
|
||||
SH_def["CorrelatedDataTraces"] = {"pos": 3248, "type": "int16", "def": 0}
|
||||
SH_def["BinaryGain"] = {"pos": 3250, "type": "int16", "def": 0}
|
||||
SH_def["AmplitudeRecoveryMethod"] = {"pos": 3252, "type": "int16", "def": 0}
|
||||
SH_def["MeasurementSystem"] = {"pos": 3254, "type": "int16", "def": 0}
|
||||
SH_def["ImpulseSignalPolarity"] = {"pos": 3256, "type": "int16", "def": 0}
|
||||
SH_def["VibratoryPolarityCode"] = {"pos": 3258, "type": "int16", "def": 0}
|
||||
SH_def["Unassigned1"] = {"pos": 3260, "type": "int16", "n": 120, "def": 0}
|
||||
SH_def["SegyFormatRevisionNumber"] = {"pos": 3500, "type": "uint16", "def": 100}
|
||||
SH_def["FixedLengthTraceFlag"] = {"pos": 3502, "type": "uint16", "def": 0}
|
||||
SH_def["NumberOfExtTextualHeaders"] = {"pos": 3504, "type": "uint16", "def": 0}
|
||||
SH_def["Unassigned2"] = {"pos": 3506, "type": "int16", "n": 47, "def": 0}
|
||||
|
||||
##############
|
||||
# Initialize SEGY TRACE HEADER SPECIFICATION
|
||||
STH_def = {"TraceSequenceLine": {"pos": 0, "type": "int32"}}
|
||||
STH_def["TraceSequenceFile"]= {"pos": 4, "type": "int32"}
|
||||
STH_def["FieldRecord"]= {"pos": 8, "type": "int32"}
|
||||
STH_def["TraceNumber"]= {"pos": 12, "type": "int32"}
|
||||
STH_def["EnergySourcePoint"]= {"pos": 16, "type": "int32"}
|
||||
STH_def["cdp"]= {"pos": 20, "type": "int32"}
|
||||
STH_def["cdpTrace"]= {"pos": 24, "type": "int32"}
|
||||
STH_def["TraceIdentificationCode"] = {"pos": 28 , "type": "uint16"}
|
||||
STH_def["TraceIdentificationCode"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Seismic data",
|
||||
2: "Dead",
|
||||
3: "Dummy",
|
||||
4: "Time Break",
|
||||
5: "Uphole",
|
||||
6: "Sweep",
|
||||
7: "Timing",
|
||||
8: "Water Break"}}
|
||||
STH_def["TraceIdentificationCode"]["descr"][SEGY_REVISION_1] = {
|
||||
-1: "Other",
|
||||
0: "Unknown",
|
||||
1: "Seismic data",
|
||||
2: "Dead",
|
||||
3: "Dummy",
|
||||
4: "Time break",
|
||||
5: "Uphole",
|
||||
6: "Sweep",
|
||||
7: "Timing",
|
||||
8: "Waterbreak",
|
||||
9: "Near-field gun signature",
|
||||
10: "Far-field gun signature",
|
||||
11: "Seismic pressure sensor",
|
||||
12: "Multicomponent seismic sensor - Vertical component",
|
||||
13: "Multicomponent seismic sensor - Cross-line component",
|
||||
14: "Multicomponent seismic sensor - In-line component",
|
||||
15: "Rotated multicomponent seismic sensor - Vertical component",
|
||||
16: "Rotated multicomponent seismic sensor - Transverse component",
|
||||
17: "Rotated multicomponent seismic sensor - Radial component",
|
||||
18: "Vibrator reaction mass",
|
||||
19: "Vibrator baseplate",
|
||||
20: "Vibrator estimated ground force",
|
||||
21: "Vibrator reference",
|
||||
22: "Time-velocity pairs"}
|
||||
STH_def["NSummedTraces"] = {"pos": 30 , "type": "int16"}
|
||||
STH_def["NStackedTraces"] = {"pos": 32 , "type": "int16"}
|
||||
STH_def["DataUse"] = {"pos": 34 , "type": "int16"}
|
||||
STH_def["DataUse"]["descr"] = {0: {
|
||||
1: "Production",
|
||||
2: "Test"}}
|
||||
STH_def["DataUse"]["descr"][1] = STH_def["DataUse"]["descr"][0]
|
||||
STH_def["offset"] = {"pos": 36 , "type": "int32"}
|
||||
STH_def["ReceiverGroupElevation"] = {"pos": 40 , "type": "int32"}
|
||||
STH_def["SourceSurfaceElevation"] = {"pos": 44 , "type": "int32"}
|
||||
STH_def["SourceDepth"] = {"pos": 48 , "type": "int32"}
|
||||
STH_def["ReceiverDatumElevation"] = {"pos": 52 , "type": "int32"}
|
||||
STH_def["SourceDatumElevation"] = {"pos": 56 , "type": "int32"}
|
||||
STH_def["SourceWaterDepth"] = {"pos": 60 , "type": "int32"}
|
||||
STH_def["GroupWaterDepth"] = {"pos": 64 , "type": "int32"}
|
||||
STH_def["ElevationScalar"] = {"pos": 68 , "type": "int16"}
|
||||
STH_def["SourceGroupScalar"] = {"pos": 70 , "type": "int16"}
|
||||
STH_def["SourceX"] = {"pos": 72 , "type": "int32"}
|
||||
STH_def["SourceY"] = {"pos": 76 , "type": "int32"}
|
||||
STH_def["GroupX"] = {"pos": 80 , "type": "int32"}
|
||||
STH_def["GroupY"] = {"pos": 84 , "type": "int32"}
|
||||
STH_def["CoordinateUnits"] = {"pos": 88 , "type": "int16"}
|
||||
STH_def["CoordinateUnits"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Length (meters or feet)",
|
||||
2: "Seconds of arc"}}
|
||||
STH_def["CoordinateUnits"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "Length (meters or feet)",
|
||||
2: "Seconds of arc",
|
||||
3: "Decimal degrees",
|
||||
4: "Degrees, minutes, seconds (DMS)"}
|
||||
STH_def["WeatheringVelocity"] = {"pos": 90 , "type": "int16"}
|
||||
STH_def["SubWeatheringVelocity"] = {"pos": 92 , "type": "int16"}
|
||||
STH_def["SourceUpholeTime"] = {"pos": 94 , "type": "int16"}
|
||||
STH_def["GroupUpholeTime"] = {"pos": 96 , "type": "int16"}
|
||||
STH_def["SourceStaticCorrection"] = {"pos": 98 , "type": "int16"}
|
||||
STH_def["GroupStaticCorrection"] = {"pos": 100 , "type": "int16"}
|
||||
STH_def["TotalStaticApplied"] = {"pos": 102 , "type": "int16"}
|
||||
STH_def["LagTimeA"] = {"pos": 104 , "type": "int16"}
|
||||
STH_def["LagTimeB"] = {"pos": 106 , "type": "int16"}
|
||||
STH_def["DelayRecordingTime"] = {"pos": 108 , "type": "int16"}
|
||||
STH_def["MuteTimeStart"] = {"pos": 110 , "type": "int16"}
|
||||
STH_def["MuteTimeEND"] = {"pos": 112 , "type": "int16"}
|
||||
STH_def["ns"] = {"pos": 114 , "type": "uint16"}
|
||||
STH_def["dt"] = {"pos": 116 , "type": "uint16"}
|
||||
STH_def["GainType"] = {"pos": 119 , "type": "int16"}
|
||||
STH_def["GainType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Fixes",
|
||||
2: "Binary",
|
||||
3: "Floating point"}}
|
||||
STH_def["GainType"]["descr"][SEGY_REVISION_1] = STH_def["GainType"]["descr"][SEGY_REVISION_0]
|
||||
STH_def["InstrumentGainConstant"] = {"pos": 120 , "type": "int16"}
|
||||
STH_def["InstrumentInitialGain"] = {"pos": 122 , "type": "int16"}
|
||||
STH_def["Correlated"] = {"pos": 124 , "type": "int16"}
|
||||
STH_def["Correlated"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "No",
|
||||
2: "Yes"}}
|
||||
STH_def["Correlated"]["descr"][SEGY_REVISION_1] = STH_def["Correlated"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["SweepFrequencyStart"] = {"pos": 126 , "type": "int16"}
|
||||
STH_def["SweepFrequencyEnd"] = {"pos": 128 , "type": "int16"}
|
||||
STH_def["SweepLength"] = {"pos": 130 , "type": "int16"}
|
||||
STH_def["SweepType"] = {"pos": 132 , "type": "int16"}
|
||||
STH_def["SweepType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "linear",
|
||||
2: "parabolic",
|
||||
3: "exponential",
|
||||
4: "other"}}
|
||||
STH_def["SweepType"]["descr"][SEGY_REVISION_1] = STH_def["SweepType"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["SweepTraceTaperLengthStart"] = {"pos": 134 , "type": "int16"}
|
||||
STH_def["SweepTraceTaperLengthEnd"] = {"pos": 136 , "type": "int16"}
|
||||
STH_def["TaperType"] = {"pos": 138 , "type": "int16"}
|
||||
STH_def["TaperType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "linear",
|
||||
2: "cos2c",
|
||||
3: "other"}}
|
||||
STH_def["TaperType"]["descr"][SEGY_REVISION_1] = STH_def["TaperType"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["AliasFilterFrequency"] = {"pos": 140 , "type": "int16"}
|
||||
STH_def["AliasFilterSlope"] = {"pos": 142 , "type": "int16"}
|
||||
STH_def["NotchFilterFrequency"] = {"pos": 144 , "type": "int16"}
|
||||
STH_def["NotchFilterSlope"] = {"pos": 146 , "type": "int16"}
|
||||
STH_def["LowCutFrequency"] = {"pos": 148 , "type": "int16"}
|
||||
STH_def["HighCutFrequency"] = {"pos": 150 , "type": "int16"}
|
||||
STH_def["LowCutSlope"] = {"pos": 152 , "type": "int16"}
|
||||
STH_def["HighCutSlope"] = {"pos": 154 , "type": "int16"}
|
||||
STH_def["YearDataRecorded"] = {"pos": 156 , "type": "int16"}
|
||||
STH_def["DayOfYear"] = {"pos": 158 , "type": "int16"}
|
||||
STH_def["HourOfDay"] = {"pos": 160 , "type": "int16"}
|
||||
STH_def["MinuteOfHour"] = {"pos": 162 , "type": "int16"}
|
||||
STH_def["SecondOfMinute"] = {"pos": 164 , "type": "int16"}
|
||||
STH_def["TimeBaseCode"] = {"pos": 166 , "type": "int16"}
|
||||
STH_def["TimeBaseCode"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Local",
|
||||
2: "GMT",
|
||||
3: "Other"}}
|
||||
STH_def["TimeBaseCode"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "Local",
|
||||
2: "GMT",
|
||||
3: "Other",
|
||||
4: "UTC"}
|
||||
STH_def["TraceWeightingFactor"] = {"pos": 168 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberRoll1"] = {"pos": 170 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberFirstTraceOrigField"] = {"pos": 172 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberLastTraceOrigField"] = {"pos": 174 , "type": "int16"}
|
||||
STH_def["GapSize"] = {"pos": 176 , "type": "int16"}
|
||||
STH_def["OverTravel"] = {"pos": 178 , "type": "int16"}
|
||||
STH_def["OverTravel"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "down (or behind)",
|
||||
2: "up (or ahead)",
|
||||
3: "other"}}
|
||||
STH_def["OverTravel"]["descr"][SEGY_REVISION_1] = STH_def["OverTravel"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
|
||||
STH_def["cdpX"] = {"pos": 180 , "type": "int32"}
|
||||
STH_def["cdpY"] = {"pos": 184 , "type": "int32"}
|
||||
STH_def["Inline3D"] = {"pos": 188 , "type": "int32"}
|
||||
STH_def["Crossline3D"] = {"pos": 192 , "type": "int32"}
|
||||
STH_def["ShotPoint"] = {"pos": 192 , "type": "int32"}
|
||||
STH_def["ShotPointScalar"] = {"pos": 200 , "type": "int16"}
|
||||
STH_def["TraceValueMeasurementUnit"] = {"pos": 202 , "type": "int16"}
|
||||
STH_def["TraceValueMeasurementUnit"]["descr"] = {SEGY_REVISION_1: {
|
||||
-1: "Other",
|
||||
0: "Unknown (should be described in Data Sample Measurement Units Stanza) ",
|
||||
1: "Pascal (Pa)",
|
||||
2: "Volts (V)",
|
||||
3: "Millivolts (v)",
|
||||
4: "Amperes (A)",
|
||||
5: "Meters (m)",
|
||||
6: "Meters Per Second (m/s)",
|
||||
7: "Meters Per Second squared (m/&s2)Other",
|
||||
8: "Newton (N)",
|
||||
9: "Watt (W)"}}
|
||||
STH_def["TransductionConstantMantissa"] = {"pos": 204 , "type": "int32"}
|
||||
STH_def["TransductionConstantPower"] = {"pos": 208 , "type": "int16"}
|
||||
STH_def["TransductionUnit"] = {"pos": 210 , "type": "int16"}
|
||||
STH_def["TransductionUnit"]["descr"] = STH_def["TraceValueMeasurementUnit"]["descr"]
|
||||
STH_def["TraceIdentifier"] = {"pos": 212 , "type": "int16"}
|
||||
STH_def["ScalarTraceHeader"] = {"pos": 214 , "type": "int16"}
|
||||
STH_def["SourceType"] = {"pos": 216 , "type": "int16"}
|
||||
STH_def["SourceType"]["descr"] = {SEGY_REVISION_1: {
|
||||
-1: "Other (should be described in Source Type/Orientation stanza)",
|
||||
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",
|
||||
9: "Distributed Impulsive - In-line orientation"}}
|
||||
|
||||
STH_def["SourceEnergyDirectionMantissa"] = {"pos": 218 , "type": "int32"}
|
||||
STH_def["SourceEnergyDirectionExponent"] = {"pos": 222 , "type": "int16"}
|
||||
STH_def["SourceMeasurementMantissa"] = {"pos": 224 , "type": "int32"}
|
||||
STH_def["SourceMeasurementExponent"] = {"pos": 228 , "type": "int16"}
|
||||
STH_def["SourceMeasurementUnit"] = {"pos": 230 , "type": "int16"}
|
||||
STH_def["SourceMeasurementUnit"]["descr"] = {1: {
|
||||
-1: "Other (should be described in Source Measurement Unit stanza)",
|
||||
0: "Unknown",
|
||||
1: "Joule (J)",
|
||||
2: "Kilowatt (kW)",
|
||||
3: "Pascal (Pa)",
|
||||
4: "Bar (Bar)",
|
||||
5: "Newton (N)",
|
||||
6: "Kilograms (kg)"}}
|
||||
STH_def["UnassignedInt1"] = {"pos": 232 , "type": "int32"}
|
||||
STH_def["UnassignedInt2"] = {"pos": 236 , "type": "int32"}
|
||||
|
||||
|
||||
##############
|
||||
# FUNCTIONS
|
||||
|
||||
|
||||
|
||||
def getDefaultSegyHeader(ntraces=100, ns=100):
|
||||
"""Remove unused import.
|
||||
@@ -544,23 +264,11 @@ def readSegyData(data, SH, nd, bps, index, endian='>'): # added by A Squelch
|
||||
logger.debug("readSegyData : SEG-Y revision = " + str(revision))
|
||||
logger.debug("readSegyData : DataSampleFormat = " + str(dsf) + "(" + DataDescr + ")")
|
||||
|
||||
if SH["DataSampleFormat"] == 1:
|
||||
logger.debug("readSegyData : Assuming DSF = 1, IBM FLOATS")
|
||||
Data1 = getValue(data, index, 'ibm', endian, nd)
|
||||
elif SH["DataSampleFormat"] == 2:
|
||||
logger.debug("readSegyData : Assuming DSF = " + str(SH["DataSampleFormat"]) + ", 32bit INT")
|
||||
Data1 = getValue(data, index, 'l', endian, nd)
|
||||
elif SH["DataSampleFormat"] == 3:
|
||||
logger.debug("readSegyData : Assuming DSF = " + str(SH["DataSampleFormat"]) + ", 16bit INT")
|
||||
Data1 = getValue(data, index, 'h', endian, nd)
|
||||
elif SH["DataSampleFormat"] == 5:
|
||||
logger.debug("readSegyData : Assuming DSF = " + str(SH["DataSampleFormat"]) + ", IEEE")
|
||||
Data1 = getValue(data, index, 'float', endian, nd)
|
||||
elif SH["DataSampleFormat"] == 8:
|
||||
logger.debug("readSegyData : Assuming DSF = " + str(SH["DataSampleFormat"]) + ", 8bit CHAR")
|
||||
Data1 = getValue(data, index, 'B', endian, nd)
|
||||
else:
|
||||
logger.debug("readSegyData : DSF = " + str(SH["DataSampleFormat"]) + ", NOT SUPPORTED")
|
||||
dsf = SH["DataSampleFrmat"]
|
||||
ctype = DATA_SAMPLE_FORMAT[dsf]
|
||||
description = CTYPE_DESCRIPTION[ctype]
|
||||
logger.debug("readSegyData : Assuming DSF = {0}, {1}".format(dsf, description))
|
||||
Data1 = getValue(data, index, ctype, endian, nd)
|
||||
|
||||
Data = Data1[0]
|
||||
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
from revisions import SEGY_REVISION_0, SEGY_REVISION_1
|
||||
|
||||
STH_def = {"TraceSequenceLine": {"pos": 0, "type": "int32"}}
|
||||
STH_def["TraceSequenceFile"]= {"pos": 4, "type": "int32"}
|
||||
STH_def["FieldRecord"]= {"pos": 8, "type": "int32"}
|
||||
STH_def["TraceNumber"]= {"pos": 12, "type": "int32"}
|
||||
STH_def["EnergySourcePoint"]= {"pos": 16, "type": "int32"}
|
||||
STH_def["cdp"]= {"pos": 20, "type": "int32"}
|
||||
STH_def["cdpTrace"]= {"pos": 24, "type": "int32"}
|
||||
STH_def["TraceIdentificationCode"] = {"pos": 28 , "type": "uint16"}
|
||||
STH_def["TraceIdentificationCode"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Seismic data",
|
||||
2: "Dead",
|
||||
3: "Dummy",
|
||||
4: "Time Break",
|
||||
5: "Uphole",
|
||||
6: "Sweep",
|
||||
7: "Timing",
|
||||
8: "Water Break"}}
|
||||
STH_def["TraceIdentificationCode"]["descr"][SEGY_REVISION_1] = {
|
||||
-1: "Other",
|
||||
0: "Unknown",
|
||||
1: "Seismic data",
|
||||
2: "Dead",
|
||||
3: "Dummy",
|
||||
4: "Time break",
|
||||
5: "Uphole",
|
||||
6: "Sweep",
|
||||
7: "Timing",
|
||||
8: "Waterbreak",
|
||||
9: "Near-field gun signature",
|
||||
10: "Far-field gun signature",
|
||||
11: "Seismic pressure sensor",
|
||||
12: "Multicomponent seismic sensor - Vertical component",
|
||||
13: "Multicomponent seismic sensor - Cross-line component",
|
||||
14: "Multicomponent seismic sensor - In-line component",
|
||||
15: "Rotated multicomponent seismic sensor - Vertical component",
|
||||
16: "Rotated multicomponent seismic sensor - Transverse component",
|
||||
17: "Rotated multicomponent seismic sensor - Radial component",
|
||||
18: "Vibrator reaction mass",
|
||||
19: "Vibrator baseplate",
|
||||
20: "Vibrator estimated ground force",
|
||||
21: "Vibrator reference",
|
||||
22: "Time-velocity pairs"}
|
||||
STH_def["NSummedTraces"] = {"pos": 30 , "type": "int16"}
|
||||
STH_def["NStackedTraces"] = {"pos": 32 , "type": "int16"}
|
||||
STH_def["DataUse"] = {"pos": 34 , "type": "int16"}
|
||||
STH_def["DataUse"]["descr"] = {0: {
|
||||
1: "Production",
|
||||
2: "Test"}}
|
||||
STH_def["DataUse"]["descr"][1] = STH_def["DataUse"]["descr"][0]
|
||||
STH_def["offset"] = {"pos": 36 , "type": "int32"}
|
||||
STH_def["ReceiverGroupElevation"] = {"pos": 40 , "type": "int32"}
|
||||
STH_def["SourceSurfaceElevation"] = {"pos": 44 , "type": "int32"}
|
||||
STH_def["SourceDepth"] = {"pos": 48 , "type": "int32"}
|
||||
STH_def["ReceiverDatumElevation"] = {"pos": 52 , "type": "int32"}
|
||||
STH_def["SourceDatumElevation"] = {"pos": 56 , "type": "int32"}
|
||||
STH_def["SourceWaterDepth"] = {"pos": 60 , "type": "int32"}
|
||||
STH_def["GroupWaterDepth"] = {"pos": 64 , "type": "int32"}
|
||||
STH_def["ElevationScalar"] = {"pos": 68 , "type": "int16"}
|
||||
STH_def["SourceGroupScalar"] = {"pos": 70 , "type": "int16"}
|
||||
STH_def["SourceX"] = {"pos": 72 , "type": "int32"}
|
||||
STH_def["SourceY"] = {"pos": 76 , "type": "int32"}
|
||||
STH_def["GroupX"] = {"pos": 80 , "type": "int32"}
|
||||
STH_def["GroupY"] = {"pos": 84 , "type": "int32"}
|
||||
STH_def["CoordinateUnits"] = {"pos": 88 , "type": "int16"}
|
||||
STH_def["CoordinateUnits"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Length (meters or feet)",
|
||||
2: "Seconds of arc"}}
|
||||
STH_def["CoordinateUnits"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "Length (meters or feet)",
|
||||
2: "Seconds of arc",
|
||||
3: "Decimal degrees",
|
||||
4: "Degrees, minutes, seconds (DMS)"}
|
||||
STH_def["WeatheringVelocity"] = {"pos": 90 , "type": "int16"}
|
||||
STH_def["SubWeatheringVelocity"] = {"pos": 92 , "type": "int16"}
|
||||
STH_def["SourceUpholeTime"] = {"pos": 94 , "type": "int16"}
|
||||
STH_def["GroupUpholeTime"] = {"pos": 96 , "type": "int16"}
|
||||
STH_def["SourceStaticCorrection"] = {"pos": 98 , "type": "int16"}
|
||||
STH_def["GroupStaticCorrection"] = {"pos": 100 , "type": "int16"}
|
||||
STH_def["TotalStaticApplied"] = {"pos": 102 , "type": "int16"}
|
||||
STH_def["LagTimeA"] = {"pos": 104 , "type": "int16"}
|
||||
STH_def["LagTimeB"] = {"pos": 106 , "type": "int16"}
|
||||
STH_def["DelayRecordingTime"] = {"pos": 108 , "type": "int16"}
|
||||
STH_def["MuteTimeStart"] = {"pos": 110 , "type": "int16"}
|
||||
STH_def["MuteTimeEND"] = {"pos": 112 , "type": "int16"}
|
||||
STH_def["ns"] = {"pos": 114 , "type": "uint16"}
|
||||
STH_def["dt"] = {"pos": 116 , "type": "uint16"}
|
||||
STH_def["GainType"] = {"pos": 119 , "type": "int16"}
|
||||
STH_def["GainType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Fixes",
|
||||
2: "Binary",
|
||||
3: "Floating point"}}
|
||||
STH_def["GainType"]["descr"][SEGY_REVISION_1] = STH_def["GainType"]["descr"][SEGY_REVISION_0]
|
||||
STH_def["InstrumentGainConstant"] = {"pos": 120 , "type": "int16"}
|
||||
STH_def["InstrumentInitialGain"] = {"pos": 122 , "type": "int16"}
|
||||
STH_def["Correlated"] = {"pos": 124 , "type": "int16"}
|
||||
STH_def["Correlated"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "No",
|
||||
2: "Yes"}}
|
||||
STH_def["Correlated"]["descr"][SEGY_REVISION_1] = STH_def["Correlated"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["SweepFrequencyStart"] = {"pos": 126 , "type": "int16"}
|
||||
STH_def["SweepFrequencyEnd"] = {"pos": 128 , "type": "int16"}
|
||||
STH_def["SweepLength"] = {"pos": 130 , "type": "int16"}
|
||||
STH_def["SweepType"] = {"pos": 132 , "type": "int16"}
|
||||
STH_def["SweepType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "linear",
|
||||
2: "parabolic",
|
||||
3: "exponential",
|
||||
4: "other"}}
|
||||
STH_def["SweepType"]["descr"][SEGY_REVISION_1] = STH_def["SweepType"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["SweepTraceTaperLengthStart"] = {"pos": 134 , "type": "int16"}
|
||||
STH_def["SweepTraceTaperLengthEnd"] = {"pos": 136 , "type": "int16"}
|
||||
STH_def["TaperType"] = {"pos": 138 , "type": "int16"}
|
||||
STH_def["TaperType"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "linear",
|
||||
2: "cos2c",
|
||||
3: "other"}}
|
||||
STH_def["TaperType"]["descr"][SEGY_REVISION_1] = STH_def["TaperType"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
STH_def["AliasFilterFrequency"] = {"pos": 140 , "type": "int16"}
|
||||
STH_def["AliasFilterSlope"] = {"pos": 142 , "type": "int16"}
|
||||
STH_def["NotchFilterFrequency"] = {"pos": 144 , "type": "int16"}
|
||||
STH_def["NotchFilterSlope"] = {"pos": 146 , "type": "int16"}
|
||||
STH_def["LowCutFrequency"] = {"pos": 148 , "type": "int16"}
|
||||
STH_def["HighCutFrequency"] = {"pos": 150 , "type": "int16"}
|
||||
STH_def["LowCutSlope"] = {"pos": 152 , "type": "int16"}
|
||||
STH_def["HighCutSlope"] = {"pos": 154 , "type": "int16"}
|
||||
STH_def["YearDataRecorded"] = {"pos": 156 , "type": "int16"}
|
||||
STH_def["DayOfYear"] = {"pos": 158 , "type": "int16"}
|
||||
STH_def["HourOfDay"] = {"pos": 160 , "type": "int16"}
|
||||
STH_def["MinuteOfHour"] = {"pos": 162 , "type": "int16"}
|
||||
STH_def["SecondOfMinute"] = {"pos": 164 , "type": "int16"}
|
||||
STH_def["TimeBaseCode"] = {"pos": 166 , "type": "int16"}
|
||||
STH_def["TimeBaseCode"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "Local",
|
||||
2: "GMT",
|
||||
3: "Other"}}
|
||||
STH_def["TimeBaseCode"]["descr"][SEGY_REVISION_1] = {
|
||||
1: "Local",
|
||||
2: "GMT",
|
||||
3: "Other",
|
||||
4: "UTC"}
|
||||
STH_def["TraceWeightingFactor"] = {"pos": 168 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberRoll1"] = {"pos": 170 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberFirstTraceOrigField"] = {"pos": 172 , "type": "int16"}
|
||||
STH_def["GeophoneGroupNumberLastTraceOrigField"] = {"pos": 174 , "type": "int16"}
|
||||
STH_def["GapSize"] = {"pos": 176 , "type": "int16"}
|
||||
STH_def["OverTravel"] = {"pos": 178 , "type": "int16"}
|
||||
STH_def["OverTravel"]["descr"] = {SEGY_REVISION_0: {
|
||||
1: "down (or behind)",
|
||||
2: "up (or ahead)",
|
||||
3: "other"}}
|
||||
STH_def["OverTravel"]["descr"][SEGY_REVISION_1] = STH_def["OverTravel"]["descr"][SEGY_REVISION_0]
|
||||
|
||||
|
||||
STH_def["cdpX"] = {"pos": 180 , "type": "int32"}
|
||||
STH_def["cdpY"] = {"pos": 184 , "type": "int32"}
|
||||
STH_def["Inline3D"] = {"pos": 188 , "type": "int32"}
|
||||
STH_def["Crossline3D"] = {"pos": 192 , "type": "int32"}
|
||||
STH_def["ShotPoint"] = {"pos": 192 , "type": "int32"}
|
||||
STH_def["ShotPointScalar"] = {"pos": 200 , "type": "int16"}
|
||||
STH_def["TraceValueMeasurementUnit"] = {"pos": 202 , "type": "int16"}
|
||||
STH_def["TraceValueMeasurementUnit"]["descr"] = {SEGY_REVISION_1: {
|
||||
-1: "Other",
|
||||
0: "Unknown (should be described in Data Sample Measurement Units Stanza) ",
|
||||
1: "Pascal (Pa)",
|
||||
2: "Volts (V)",
|
||||
3: "Millivolts (v)",
|
||||
4: "Amperes (A)",
|
||||
5: "Meters (m)",
|
||||
6: "Meters Per Second (m/s)",
|
||||
7: "Meters Per Second squared (m/&s2)Other",
|
||||
8: "Newton (N)",
|
||||
9: "Watt (W)"}}
|
||||
STH_def["TransductionConstantMantissa"] = {"pos": 204 , "type": "int32"}
|
||||
STH_def["TransductionConstantPower"] = {"pos": 208 , "type": "int16"}
|
||||
STH_def["TransductionUnit"] = {"pos": 210 , "type": "int16"}
|
||||
STH_def["TransductionUnit"]["descr"] = STH_def["TraceValueMeasurementUnit"]["descr"]
|
||||
STH_def["TraceIdentifier"] = {"pos": 212 , "type": "int16"}
|
||||
STH_def["ScalarTraceHeader"] = {"pos": 214 , "type": "int16"}
|
||||
STH_def["SourceType"] = {"pos": 216 , "type": "int16"}
|
||||
STH_def["SourceType"]["descr"] = {SEGY_REVISION_1: {
|
||||
-1: "Other (should be described in Source Type/Orientation stanza)",
|
||||
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",
|
||||
9: "Distributed Impulsive - In-line orientation"}}
|
||||
|
||||
STH_def["SourceEnergyDirectionMantissa"] = {"pos": 218 , "type": "int32"}
|
||||
STH_def["SourceEnergyDirectionExponent"] = {"pos": 222 , "type": "int16"}
|
||||
STH_def["SourceMeasurementMantissa"] = {"pos": 224 , "type": "int32"}
|
||||
STH_def["SourceMeasurementExponent"] = {"pos": 228 , "type": "int16"}
|
||||
STH_def["SourceMeasurementUnit"] = {"pos": 230 , "type": "int16"}
|
||||
STH_def["SourceMeasurementUnit"]["descr"] = {1: {
|
||||
-1: "Other (should be described in Source Measurement Unit stanza)",
|
||||
0: "Unknown",
|
||||
1: "Joule (J)",
|
||||
2: "Kilowatt (kW)",
|
||||
3: "Pascal (Pa)",
|
||||
4: "Bar (Bar)",
|
||||
5: "Newton (N)",
|
||||
6: "Kilograms (kg)"}}
|
||||
STH_def["UnassignedInt1"] = {"pos": 232 , "type": "int32"}
|
||||
STH_def["UnassignedInt2"] = {"pos": 236 , "type": "int32"}
|
||||
Reference in New Issue
Block a user