c program sac_wavelet
c JJP 11/12/97, spruced up for distribution 9/26/00
c f77 -o sac_wavelet sac_wavelet.f -fast -native -O5
c
c code reads SAC-format data, filename.bh? <-- routine subs e,n,z for "?"
c
c generates wavelets with eigenvector decomposition + interpolation
c calculate padded FFT of data for convolution with wavelet FFTs
c general use - calculates set of wavelets for a specified number of points
c interpolates and fft other lengths on the fly
c max=12 real-wavelets max = 6 complex-valued wavelets
c
c code is based on the algorithms described in
c
c Lilly, J., and J. Park, Multiwavelet spectral and polarization analysis
c of seismic records, Geophysical J. International, v122, 1001-1021, 1995.
c
c Park, J. and M. E. Mann, Interannual temperature events and shifts in
c global temperature: A multiwavelet correlation approach, Earth Interactions,
c v. 4, online paper 4-001, 2000.
c
C SEE ALSO:
c Bear, L. K., and G. L. Pavlis, Estimation of slowness vectors and
c their uncertainties using multi-wavelet seismic array processing,
c Bull. Seismol. Soc. Am., v87, 755--769, 1997.
c
c this code generates 2-D arrays of spectra, polarization and statistical stuff
c it writes GMT scripts to display these arrays in dazzling color
c
c for an input filename sacfile.bh? the GMT scripts are written to
c GMT_sacfile.bh, GM[123]_sacfile.bh
c
c the tarfile for distribution should have binary SACfiles nilcut.sh?
c -- a P wave coda
c you can test the program on this data
c
c the ASCII files to plot are named
c cpt_nilcut.sh lam_nilcut.sh1 spw_nilcut.shz
c dat_nilcut.sh lam_nilcut.sh2 spw_nilcut.she
c ell_nilcut.sht lam_nilcut.sh3 spw_nilcut.shn
c ell_nilcut.shz spw_nilcut.shs
c cp2_nilcut.sh lam_nilcut.sh0 spw_nilcut.shv
c
c dat_* is data to plot
c ell_* contains polarization ellipses in Z/R (z) and T/R (t) planes
c spw_* are wavelet spectra fot *z *r *t
c spw_*s contains splitting ellipses and spw_*v has rectilinearity estimate
c cpt_* and cp2_* are colorfiles for GMT
c lam_* are singular values of the wavelet polariation matrices
c
c you can fill a lot of disk space if you are not tidy with old files!
c
c user must make scripts executable ("chmod +x GM*_sacfile.bh"),
c execute the scripts and display the postscript files
c
c
EXAMPLE OF GMT SCRIPT WRITTEN BY sac_wavelet.f
colorfil=cpt_nilcut.sh
infil=spw_nilcut.shz
/bin/rm aaplot
xyz2grd $infil -Gblobg -I0.15/0.3800 -F -R0.00/30.15/-4.2489/1.8311 -V
grdimage blobg -C$colorfil -B5.00:'time (sec)':/1.0enSW -JX5.5/2.3 -X1.0 -Y1.0 -K -P > aaplot
pstext -JX -R -W -O -P -K <>aaplot
1.500 -2.749 15 0 15 1 Vertical
END
infil=spw_nilcut.shn
xyz2grd $infil -Gblobg -I0.15/0.3800 -F -R0.00/30.15/-4.2489/1.8311 -V
grdimage blobg -C$colorfil -B5.00/1.0:'period (2@+y@+ sec)':ensW -JX5.5/2.3 -X0.0 -Y2.3 -O -K -P >> aaplot
pstext -JX -R -W -O -P -K <>aaplot
1.500 -2.749 15 0 15 1 Transverse
END
psscale -C$colorfil -D5.8/1.15/3/0.25 -L -O -K -P >> aaplot
infil=spw_nilcut.she
xyz2grd $infil -Gblobg -I0.15/0.3800 -F -R0.00/30.15/-4.2489/1.8311 -V
grdimage blobg -C$colorfil -B5.00/1.0ensW -JX5.5/2.3 -X0.0 -Y2.3 -O -K -P >> aaplot
pstext -JX -R -W -O -P -K <>aaplot
1.500 -2.749 15 0 15 1 Radial
END
psxy dat_nilcut.sh -R/0.000/30.150/-64700.434/188000.172 -B5.00:'.nilcut':/50000.000ensW -M -JX5.5/2.0 -X0.0 -Y2.3 -O -K -P >> aaplot
pstext -JX -R -O -P <>aaplot
1.500 6250.000 10 0 15 1 Vertical
1.500 114759.695 10 0 15 1 Transverse
1.500 156296.094 10 0 15 1 Radial
END