def read_segy_file(FileName):
    filename = FileName
    # Set verbose level
    segypy.verbose = 1
    SH = segypy.getSegyHeader(filename)
    #%% Read Segy File
    [Data, SH, STH] = segypy.readSegy(filename)
    print('数组大小:', np.shape(Data))
    return Data, SH, STH
コード例 #2
0
ファイル: data.py プロジェクト: LukasMosser/ASAP
def load_segy(filename, min_inline, max_inline, step_inline, min_xline, max_xline, step_xline):
    # Get only SegyHeader
    SH = segypy.getSegyHeader(filename);

    inl=np.arange(min_inline, max_inline, step_inline)
    crl=np.arange(min_xline, max_xline, step_xline)

    seis, header, trace_headers = segypy.readSegy(filename)

    stack = seis.reshape(header['ns'], inl.size, crl.size)
    return stack
コード例 #3
0
ファイル: my_import_export.py プロジェクト: keshava/kampa
def importSGY(sgyFilename, rddFilename):

    # os.remove(rddFilename)
    fp = open(sgyFilename, 'rb')
    writer = SequenceFile.createWriter(rddFilename, IntWritable, BytesWritable)

    SH = segypy.getSegyHeader(sgyFilename, 3600, segypy.endian)
    bps = segypy.getBytePerSample(SH)

    filesize = os.path.getsize(sgyFilename)
    samp_count = SH['ns']
    data_len = samp_count * bps
    trace_size = data_len + 240
    ntraces = (filesize - 3600) / trace_size

    data = fp.read(3600)
    for trace_num in range(ntraces):
        SegyTraceHeader = fp.read(240)
        SegyTraceData = fp.read(data_len)
		error - segypy.getValue is not correct
        SegyTraceData = segypy.getValue(
            SegyTraceData, 0, 'float', segypy.endian, samp_count)
        writer.append(IntWritable(trace_num), BytesWritable(
            str(SegyTraceHeader) + str(SegyTraceData)))
コード例 #4
0
import matplotlib as mpl

mpl.use('TKAgg')
import matplotlib.pyplot as plt
import segypy
import numpy as np
from sklearn.svm import SVR  #调用支持向量机的分类回归函数SVR(支持向量回归)

filename = 'Model+GathEP-Z.sgy'
# Set verbose level
segypy.verbose = 1
SH = segypy.getSegyHeader(filename)
#%% Read Segy File
[Data, SH, STH] = segypy.readSegy(filename)
print(SH)
print(np.shape(Data))
RowNum, ColumNum = np.shape(Data)  #获取模拟地震记录的行列数
print('数据的行数:', RowNum)
print('数据的列数:', ColumNum)

#Generator Random Noise
GaussianNoise = np.random.normal(0, 0.3, (RowNum, ColumNum))  #高斯白噪声(均值0,方差0.3)

# Generate sample data
FirstColumNoise = GaussianNoise[:, 0]  #第一道白噪声
plt.figure(6)
plt.plot(FirstColumNoise)  #显示第一道高斯白噪声
print('第一道噪声shape:', np.shape(FirstColumNoise))

NumberOfDots = int(np.shape(FirstColumNoise)[0])  #获得第一道噪音的长度(点数)
print('第一道噪声的长度(点数):', NumberOfDots)
コード例 #5
0
ファイル: testsegy.py プロジェクト: cultpenguin/segypy
#!/usr/bin/env python
# testsegy.py

import segypy

filename='ld0077_file_0126.sgy'
filename='shotgather.sgy'

# Set verbose level
segypy.verbose=1

#%% Read only SegyHeader and SegyTraceHeader
SH = segypy.getSegyHeader(filename)
STH = segypy.getAllSegyTraceHeaders(SH)

#%% Read Segy File
[Data,SH,STH]=segypy.readSegy(filename)


#%% Plot Segy filwe
scale=1e-9
# wiggle plot
segypy.wiggle(Data,SH,1e-9)
# image plot
segypy.image(Data,SH,scale)

コード例 #6
0
ファイル: readcoord.py プロジェクト: seancug/readsegy
progressDialog = QtGui.QProgressDialog()
progressDialog.setWindowModality(QtCore.Qt.WindowModal)
progressDialog.setWindowTitle("Processing")
progressDialog.setLabelText("Transform...")
progressDialog.setRange(0, len(filelist) - 1)
progressDialog.setCancelButton(None)
progressDialog.show()
inum = 0
progressDialog.setValue(1)

for filename in filelist:
    fileshort = filename.split('.')[0]
    sg.verbose = 1
    # [Data,SH,STH]=sg.readSegy(filename);
    segdata = open('data/' + filename, 'rb').read()
    SH = sg.getSegyHeader('data/' + filename, '>')
    STH = sg.getAllSegyTraceHeaders(SH, segdata, '>')
    SourceX = np.abs(STH['SourceX']) / 3600.0 / 1000.0
    SourceY = STH['SourceY'] / 3600.0 / 1000.0
    Tracenum = STH['FieldRecord']
    if os.path.exists('coord') == False:
        os.makedirs('coord')
    fp = open('coord/' + fileshort + '.txt', 'w')

    for (num, ax, ay) in zip(Tracenum, SourceX, SourceY):
        strtmp = '%s\t%6d\t%14.8f\t%14.8f\n' % (fileshort, num, ax, ay)
        fp.writelines(strtmp)
    fp.close()
    inum += 1
    progressDialog.setValue(inum)