Dear,all
Recently, I synthesized a seismogram by using Fortran codes, I need plot the synthesized seismogram and the data together, so I can verify the accuracy of code. Now I encounter a question: how to read the SAC data by Fortran code, I have searched some codes on Internet, the details as follow:the velr12a.sac is my data file.
Code:
c read sac file
PROGRAM RSAC
PARAMETER (MAX=1000)
DIMENSION YARRAY(MAX)
CHARACTER*10 KNAME
KNAME='velr12a.sac'
CALL RSAC1(KNAME,YARRAY,NLEN,BEG,DEL,MAX,NERR)
IF(NERR.GT.0)GO TO 8888
CALL DOIT(YARRAY,NLEN)
8888 CONTINUE
END
c----------------------------------------------------
subroutine doit(yarray,nlen)
dimension yarray(nlen)
do i=1,nlen
print *,yarray(i)
enddo
return
end
I see the notes on Internet :"when compiling/linking your code, it may be necessary to include '-lX11 -lm' on the compile/link line in order to access the X windows and math libraries respectively. "
So I run my code like this:
Code:
[jing@localhost 3dzeng]$ g77 rsac1.f /usr/local/sac/lib/sac.a -o rsac1 -L/usr/X11R6/lib -lX11 -L/usr/lib/ -lm
/usr/local/sac/lib/sac.a(inissi.o)(.text+0x1b): In function `inissi':
: undefined reference to `dblClearErrorList'
/usr/local/sac/lib/sac.a(inissi.o)(.text+0x20): In function `inissi':
: undefined reference to `dbSetQueryDefaults'
/usr/local/sac/lib/sac.a(inissi.o)(.text+0x25): In function `inissi':
: undefined reference to `smGetDefaultWorksetName'
/usr/local/sac/lib/sac.a(inissi.o)(.text+0x39): In function `inissi':
: undefined reference to `smDeleteWorksetByName'
/usr/local/sac/lib/sac.a(inidfm.o)(.text+0x1039): In function `inidfm':
: undefined reference to `SetIndianSize'
collect2: ld returned 1 exit status
I can not understand what's meaning of the errors, can you give me some suggestions on how to read SAC data file in Fortran code? Thank a lot.
Yueling