[SAC-HELP] writing blackboard and header values to ascii (Dylan Mikesell)

Eva-Maria Rumpfhuber erumpfhuber at ou.edu
Sun Feb 3 08:51:53 PST 2008


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

#/bin/csh

# 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

sac2000<<EOF

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

quit

EOF

# writing the temp file into your event file

cat temp.file >>events.list

\rm -f temp.file

@ i = $i + 1

end








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.
> Thanks,
>
> Dylan
>
>
>
>
>
>
>
> <dmikesell.vcf>_______________________________________________
> sac-help mailing list
> sac-help at iris.washington.edu
> http://www.iris.washington.edu/mailman/listinfo/sac-help



------------------------------

_______________________________________________
sac-help mailing list
sac-help at iris.washington.edu
http://www.iris.washington.edu/mailman/listinfo/sac-help


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




More information about the sac-help mailing list