Thread: writing blackboard and header values to ascii (Dylan Mikesell)

Started: 2008-02-03 18:51:53
Last activity: 2008-02-03 18:51:53
Topics: SAC Help
Eva-Maria Rumpfhuber
2008-02-03 18:51:53
Hi Dylan,

Below's a simple shell (csh) script to automatically extract header
information from multiple sac files. You have to only change the name of
your input files, and should be able to run it, I added some comments,
hopefully they will help get you on the right track. Good luck, Eva


# This script extracts header information from

# sac files.

# This is the list of your sac files, with some kind of identifier

set event = ` ls *.sac | nawk -F. '{print $2}' | sort | uniq `

@ i = 1

@ end = $#event + 1

echo Number of events: $#event

# Loop over events

while ( $i < $end )

echo Processing event: $event[$i]

# reads each file

set file_z = "P*"$event[$i]".*.sac"

echo Input files: $file_z

# with setbb you can set all header you need

# getbb writes it to temp.file


r $file_z

setbb evid $event[$i]

setbb yr &1,nzyear

setbb jday &1,nzjday

setbb hr &1,nzhour

setbb min &1,nzmin

setbb sec &1,nzsec

setbb msec &1,nzmsec

setbb lat &1,evla

setbb lon &1,evlo

setbb dp &1,evdp

setbb gcdeg &1,gcarc

setbb gckm &1,dist

getbb TO temp.file names off newline off evid lat lon dp gcdeg gckm



# writing the temp file into your event file

cat temp.file >>events.list

\rm -f temp.file

@ i = $i + 1


On Feb 1, 2008, at 12:45 PM, Dylan Mikesell wrote:

Hi All,

Is there any way to write a blackboard variable and/or a particular
header value (such as user0) to an ascii text file from within SAC?
I can't find anything close to this other than writebbf. I also
want header values so I need something else.


sac-help mailing list


sac-help mailing list

End of sac-help Digest, Vol 32, Issue 1

10:55:37 v.22510d55