#!/bin/sh
#
# Combined PostScript plot from instantaneous phases and instantaneous
# amplitudes from dipping layer seismograms.
#

WID=4.
HEI=4.

# - red-green-blue-red -
BHLS="1.000,0.500,1.000"
GHLS="0.500,0.500,1.000"
WHLS="0.000,0.500,1.000"

# - red-green-blue -
#BRGB="1.000,0.000,0.000"
#GRGB="0.000,1.000,0.000"
#WRGB="0.000,0.000,1.000"

# - read-white-blue -
BRGB="1.000,0.000,0.000"
GRGB="1.000,1.000,1.000"
WRGB="0.000,0.000,1.000"

# synthetics
susyncz > seis.su

# instantaneous amplitude 
suattributes < seis.su mode=amp > tmp

BCLIP=`sumax < tmp mode=max outpar=/dev/stdout`

# normalize instantaneous amplitudes to range 0..1
sugain < tmp norm=$BCLIP | \
sugain scale=2. | \
sugain pclip=1. nclip=0. > seis_amp.su
sustrip < seis_amp.su > seis_amp

# instantaneous phase
suattributes < seis.su mode=phase > seis_phase.su

# combined plot: phases weighted by amplitudes
supsimage < seis_phase.su width=$WID height=$HEI \
          brgb=$BRGB grgb=$GRGB wrgb=$WRGB \
	  title="combined: instant. phase. & amp." \
	  titlesize=15 infile=seis_amp bckgr=0.4 bps=24 > seis_comb.ps
#          bhls=$BHLS ghls=$GHLS whls=$WHLS \

gv seis_comb.ps &

# plot of phases
supsimage < seis_phase.su width=$WID height=$HEI \
          brgb=$BRGB grgb=$GRGB wrgb=$WRGB \
	  title="instant. phase." \
	  titlesize=15 bps=24 > seis_phase.ps

gv seis_phase.ps &

# plot of amplitudes
supsimage < seis_amp.su width=$WID height=$HEI \
	  title="instant. amp." \
	  titlesize=15 bps=24 > seis_amp.ps

gv seis_amp.ps &

# rm *.su *.ps tmp seis_amp

