LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-02-2008, 06:46 PM   #1
lengyue
Member
 
Registered: Aug 2008
Posts: 31

Rep: Reputation: 15
how to Reading And Writing SAC (Seismic Analysis Code) Data Files in Fortran codes


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
 
Old 12-02-2008, 10:06 PM   #2
telemeister
Member
 
Registered: Dec 2007
Location: Brisbane Australia
Distribution: Slackware
Posts: 57

Rep: Reputation: 16
Hello again Yueling -

Well googling those undefined references seems to only produce SAC related hits, so I guess that suggests maybe something wrong with your SAC library?

In case you missed it, there is another thread on the IRIS site about this problem.

http://www.iris.washington.edu/piper...ry/000049.html

Although not sure if it was resolved.

It could be worth an email to the original poster on that site to see if he resolved the library issue.

Ekrem.Zor at mam.gov.tr

Let us know how you go.

Steve
 
Old 12-03-2008, 12:39 PM   #3
lengyue
Member
 
Registered: Aug 2008
Posts: 31

Original Poster
Rep: Reputation: 15
Hi,telemeister,

Thank you and Ekrem's reply.

When I compiled the Fortran code on 64 bit or 32 bit machine, I
should add -m32 to my command as in the following line;
Code:
g77 rsac1.f -o rsac1 /usr/local/sac/lib/sacio.a -m32
this will create a rsac1 as a 32 bit executable file linked to 32 bit
sac.a library. This may also run on 64 bit machine.

Cheers!

Yueling
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SAC(Seismic Analysis Code) question about "sgftops" lengyue Linux - Software 2 11-18-2008 03:22 PM
LXer: China Petroleum & Chemical Corporation Deploys Panasas ActiveStor Parallel Storage Clusters to Improve Seismic Analysis LXer Syndicated Linux News 0 05-17-2007 04:31 PM
source code for reading data through com port rs232 applee Programming 2 03-03-2007 07:55 AM
Problem in reading/writing binary data in Linux esi-eric Linux - Hardware 3 07-20-2004 04:21 PM
reading / writing OpenOffice files. GŠutama Programming 1 11-04-2003 06:46 AM


All times are GMT -5. The time now is 12:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration