def load_seismic(filename, inlines, xlines): """ Load seismic amplitudes from .SEGY into numpy array. Parameters ---------- filename : str File pathname for .SEGY file. inlines : list List in form [start, stop, step] for data inlines. xlines : list List in form [start, stop, step] for data inlines. Returns ------- amplitude : array_like Array of seismic amplitudes. twt : array_like Array of twt range for data. """ inl = np.arange(*inlines) crl = np.arange(*xlines) seis, header, trace_headers = segypy.readSegy(filename) amplitude = seis.reshape(header['ns'], inl.size, crl.size) lagtime = trace_headers['LagTimeA'][0] * -1 twt = np.arange(lagtime, header['dt'] / 1e3 * header['ns'] + lagtime, header['dt'] / 1e3) return amplitude, twt
def getData(dataDir): ''' read segy npy txt :param dataDir: file path :return: data set ''' fileList = os.listdir(dataDir) # 获取目标文件夹所有文件名的列表 Profile = [] for se in fileList: if se.endswith(".npy"): path = os.path.join(dataDir, se) data = np.load(path) Profile.append(data) if se.endswith(".sgy"): path = os.path.join(dataDir, se) # Read Segy File segypy.verbose = 1 [data, SH, STH] = segypy.readSegy(path, endian='>') Profile.append(data) if se.endswith(".txt"): path = os.path.join(dataDir, se) data = np.loadtxt(path) Profile.append(data) print("_____________Data loaded_____________") return Profile
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
def load_seismic(filename, inlines=[1300, 1502, 2], xlines=[1500, 2002, 2]): inl = np.arange(*inlines) crl = np.arange(*xlines) seis, header, trace_headers = segypy.readSegy(filename) amplitude = seis.reshape(header['ns'], inl.size, crl.size) lagtime = trace_headers['LagTimeA'][0] * -1 twt = np.arange(lagtime, header['dt'] / 1e3 * header['ns'] + lagtime, header['dt'] / 1e3) return amplitude, twt
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
def load_seismic(fname, min_inline, max_inline, step_inline, min_xline, max_xline, step_xline, scaling=1e3): inl = np.arange(min_inline, max_inline, step_inline) crl = np.arange(min_xline, max_xline, step_xline) seismic, header, trace_headers = segypy.readSegy(fname) seismic = seismic.reshape(header['ns'], inl.size, crl.size) lagtime = trace_headers['LagTimeA'][0] * -1 twt = np.arange(lagtime, header['dt'] / scaling * header['ns'] + lagtime, header['dt'] / scaling) return seismic, twt
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)
#!/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)
import segypy filename = './data/L12S.sgy' #filename='mini.sgy' #filename='data_IEEE.segy'; #filename='data_IBM_REV1.segy'; #filename='data_IBM_REV0.segy'; #filename='data_1byteINT.segy'; #filename='data_2byteINT.segy'; #filename='data_4byteINT.segy'; # Set verbose level segypy.verbose = 1 # Read Segy File Data, SH, STH = segypy.readSegy(filename, '<') import pylab #imshow(Data) pylab.figure(1) pylab.imshow(Data) pylab.show() exit(0) filename_out = 'testout.segy' SH['DataSampleFormat'] = 5 SH['SegyFormatRevisionNumber'] = 100 segypy.writeSegyStructure(filename_out, Data, SH, STH) exit(0) segypy.wiggle(Data, SH, 2, .1, .1)
noiseList = [] residualList = [] i = 0 # load test data for seisData in os.listdir(os.path.join(args.set_dir, set_cur)): if seisData.endswith(".txt"): test_data = np.loadtxt( os.path.join(args.set_dir, set_cur, seisData)) if seisData.endswith(".npy"): test_data = np.load( os.path.join(args.set_dir, set_cur, seisData)) if seisData.endswith("sgy"): [test_data, SH, STH] = segypy.readSegy(os.path.join(args.set_dir, set_cur, seisData), endian='>') test_data = np.array(test_data) print(np.shape(test_data)) data_size = np.shape(test_data) # to save result and noise profile result = np.zeros(np.shape(test_data)) noiseProfile = np.zeros(np.shape(test_data)) # normalization Norm = Sample_maker_forDN.Normalization_Func(test_data) test_data = Norm.Normalization_perTrace() # test_data = Norm.standardization() seisDataList.append(test_data)
# import struct import segypy filename='ld0057_file_00095.sgy'; #filename='mini.sgy' #filename='data_IEEE.segy'; #filename='data_IBM_REV1.segy'; #filename='data_IBM_REV0.segy'; #filename='data_1byteINT.segy'; #filename='data_2byteINT.segy'; #filename='data_4byteINT.segy'; # Read Segy File Data,SH,STH=segypy.readSegy(filename); exit filename_out='testout.segy'; SH['DataSampleFormat']=5; SH['SegyFormatRevisionNumber']=100; segypy.writeSegyStructure(filename_out,Data,SH,STH); segypy.wiggle(Data,SH,2,.1,.1) f_ieee='data_IEEE.segy'; f_ibm='data_IBM_REV1.segy';
from keras.utils import plot_model from keras.optimizers import Adam from PIL import Image import tensorflow from IPython.display import SVG from keras.utils.vis_utils import model_to_dot import random os.chdir(r'R:\mowais\SPROJ') # Set verbose level segypy.verbose = 1 # Raw Data filename3 = 'Beg_IL20-100andXL1-110.sgy' SH = segypy.getSegyHeader(filename3) [Raw, SH, STH] = segypy.readSegy(filename3) #Enhanced Data filename1 = 'beg_export - TensorBasedGeometric - Enhanced Coherence.sgy' SH = segypy.getSegyHeader(filename1) [Data, SH, STH] = segypy.readSegy(filename1) #Min-to-Max Scaling maxy = np.max(Raw) mini = np.min(Raw) RawSD = (Raw - mini) / (maxy - mini) maxy = np.max(Data) mini = np.min(Data) DataSD = (Data - mini) / (maxy - mini)