这是我写的代码
[Fortran] 纯文本查看 复制代码 program SRME
real*4,ALLOCATABLE::SEISMIC_DATA(:)
CHARACTER*20 filename
integer*2 SAMPLE_RATE,TRACE_LENGTH,TRACE_AMOUNT
TRACE_AMOUNT=5765
filename='Z10-CH-1.sgy'
WRITE(*,*)'获得SGY数据采样率、采样长度'
OPEN(15,FILE=FILENAME,ACCESS='DIRECT',
$FORM='BINARY',RECL=2,convert='big_endian')
READ(15,REC=1859) SAMPLE_RATE
READ(15,REC=1858) TRACE_LENGTH
WRITE(*,*)'采样率=',SAMPLE_RATE,'采样长度=',TRACE_LENGTH
CLOSE(15)
ALLOCATE(SEISMIC_DATA(1:TRACE_LENGTH))
OPEN(30,FILE=FILENAME,FORM='binary',
$ACCESS='DIRECT',RECL=4,convert='big_endian')
WRITE(*,*)'读取SGY地震数据'
DO I=1,TRACE_AMOUNT
OPEN(30,FILE=FILENAME,FORM='BINARY',
$ACCESS='DIRECT',RECL=4,convert='big_endian')
DO L1=1,TRACE_LENGTH
READ(30,REC=900+60*I+(I-1)*TRACE_LENGTH+L1)
$SEISMIC_DATA(L1)
write(*,*)L1,seismic_data(l1)
END DO
PAUSE
END DO
END PROGRAM
这是运行结果,是sgy文件第一道前26个采样点的数据
|