📄 getshot(1).m
字号:
function [traces,t,offset] = getshot(shotnum)% Program to automatically read a shot gather in your data set.% Program returns matrix traces with amplitudes,% time base t, and shot-receiver offset information.% % Refer to SEG digital tape standards booklet.% Written by D. Schmitt, January 31, 1999% % % To run [tracematrix,timebasevector,offsetvector] = getshot(shot_number);%% shot_number is the integer number of the shot you want to put into memory.% tracematrix is the set of all traces in matrix form with each column% equal to a trace.% timebase is the corresponding times in seconds for the traces.% % This program written for standard segy data. sgyfile = ['shot',int2str(shotnum),'.sgy']fclose('all');% fid = fopen(sgyfile,'r','b') % for workstation modefid = fopen(sgyfile,'r','l'); % for standard PC Vista modeheadasc = reshape(fread(fid,3200,'char'),80,40); headbin(1:3) = fread(fid,3,'int32');headbin(4:197) = fread(fid,194,'int16'); numtrace = headbin(4)+headbin(5) % Number of traces in file Note - Vista will not set!if numtrace == 0 numtrace = 48 + 2; % Default OYO channels, data + aux. disp(['Warning **** Binary Header did not contain trace num info - default to 48 data + 2 aux files'])end % ifnumsamps = headbin(8);samprate = headbin(6);trahead = zeros(71,numtrace); % There are 71 values assigned % in the standard SEG-Y formattraces = zeros(numsamps,numtrace);for i = 1:numtrace trahead(1:7,i) = fread(fid,7,'int32'); trahead(8:11,i) = fread(fid,4,'int16'); trahead(12:19,i) = fread(fid,8,'int32'); trahead(20:21,i) = fread(fid,2,'int16'); trahead(22:25,i) = fread(fid,4,'int32'); trahead(26:101,i) = fread(fid,76,'int16'); [traces(:,i),count2] = fread(fid,numsamps,'float'); % Read trace dataend % it = 1e-6*[0:samprate:(numsamps-1)*samprate]; % Make timebase, assume t=0 start.offset = trahead(12,:); % Row 12 contains the shot-receiver offset info.clear headasc headbin trahead % Only for this simple programfclose(fid);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -