sacread.f
subroutines to read and write SAC-format files -- adjusted to write 6-component greens functions. The routines provided by SAC are fine, of course, but I use a hydrid file format for greens-function files. These files contain six displacement traces rather than one, one for each independent component of the seismic moment tensor. There is a flag in the SAC header that I took over for indicating that six traces need to be read instead of one.
if(chead(145).ne.' GRN'.and.chead(145).ne.' grn') then
nword=nscan+158
nrec=(nword-1)/128+1
last=nword-128*(nrec-1)
else
print *,'reading greens functions'
nword=6*nscan+158
nrec=(nword-1)/128+1
last=nword-128*(nrec-1)
endif
The subroutines are sacread, sacout, sacread_swap and sacout_swap. The last two routines swap big-endian and little-endian data. You will be happier if you never need to swap bytes, but they are there for when you are painted into that corner.
Thursday, October 29, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment