#define LINDIR ./../..
#define FIGDIR LINDIR/Figs/Intro1
#define CHPDIR LINDIR/Intro1
#define SRCDIR CHPDIR/Src
#define DATDIR CHPDIR/Dat
#define BINDIR .
#define USRLIBS VPLOTLIB
#define FIGLIST vpsnell raynegpos wavelay
#define TLSZFAT  titlefat=5 titlesz=12 labelfat=3 labelsz=8 
#define THICK plotcol=0,0,0,0,0,0,0 plotfat=8
#define THIN plotcol=5,5,5,5,5,5,5 plotfat=4
#define FAST title=" " label1=" " label2=" " wantframe=y wantaxis=n

#include <SEP.defs>

FIGDIR/vpsnell.v: vpsnell.P vpsnell.x
	vpsnell.x par=vpsnell.P out=junk.v > Junk
	vppen junk.v vpstyle=n scale=0.585 > FIGDIR/vpsnell.v 
	rm junk.v Junk

FIGDIR/wavelay.v : DATDIR/ttmlay.H DATDIR/snaplay.H
	Window j1=2 j2=2 n3=1 f3=6 < DATDIR/snaplay.H | Scale dscale=0 axis=123 > snaplay.temp
	Taplot < snaplay.temp | Ta2vplot title=" " label1="Depth (km)" label2="Surface (km)" wheretitle=t TLSZFAT color=i d1num=1. d2num=1. o1num=0 o2num=0 grid=n polarity=1 xinch=10.24 yinch=5.12 out=back.v > Junk
	Window j1=2 j2=2 < DATDIR/ttmlay.H > ttmlay.temp
	Contour nc=1 c0=1.399 dc=0.2 < ttmlay.temp THICK d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=n wantaxis=n pad=n xinch=10.24 yinch=5.12 out=junka.v > Junk
	Contour nc=1 c0=1.399 dc=0.2 < ttmlay.temp THIN d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=n wantaxis=n pad=n xinch=10.24 yinch=5.12 out=junkb.v > Junk
	Box x0=6.8 y0=5.8 label="Energetic arrival" xt=0.500000 yt=-1.500000 out=point1.v > Junk
	Box x0=8.8 y0=5.8 label="First arrival" xt=1.000000 yt=0.500000 out=point2.v > Junk
	vppen back.v junka.v junkb.v point1.v point2.v erase=o vpstyle=n scale=0.528 > FIGDIR/wavelay.v
	rm back.v junka.v junkb.v point1.v point2.v Junk
	Rm snaplay.temp ttmlay.temp

FIGDIR/raynegpos.v : DATDIR/gauneg.H DATDIR/rayneg.H DATDIR/gaupos.H DATDIR/raypos.H
	Window j1=2 j2=2 < DATDIR/gauneg.H > gauneg.temp
        Taplot < gauneg.temp bias=3. clip=1.3 | Ta2vplot title=" " label1="Depth (km)" label2="Surface (km)" wheretitle=t TLSZFAT color=i d1num=1. d2num=1. o1num=0 o2num=0 grid=n polarity=1 xinch=7.5 yinch=7.5 out=back.v > Junk
	Bar n2=100 type=h minval=1.49 maxval=3.01 | Taplot bias=3. clip=1.3 | Ta2vplot title=" " label2="Velocity (km/s)" wherexlabel=b TLSZFAT color=i wantaxis1=n d2num=0.5 o2num=1.5 grid=n polarity=1 xinch=7.5 yinch=0.4 out=junk.v > Junk
	vppen junk.v yshift=-4.2 > bar.v
        Graph < DATDIR/rayneg.H THICK d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=n wantaxis=n pad=n yreverse=y xinch=7.5 yinch=7.5 out=junka.v > Junk
        Graph < DATDIR/rayneg.H THIN d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=y wantaxis=n pad=n yreverse=y xinch=7.5 yinch=7.5 out=junkb.v > Junk
	Box x0=6.85 y0=4.8 label="Crossing" xt=0.000000 yt=-1.500000 out=point.v > Junk
	vp_Overlay back.v bar.v junka.v junkb.v point.v > junk1.v
	Window j1=2 j2=2 < DATDIR/gaupos.H > gaupos.temp
        Taplot < gaupos.temp bias=3. clip=1.3 | Ta2vplot title=" " label1="Depth (km)" label2="Surface (km)" wheretitle=t TLSZFAT color=i d1num=1. d2num=1. o1num=0 o2num=0 grid=n polarity=1 xinch=7.5 yinch=7.5 out=back.v > Junk
	Bar n2=100 type=h minval=2.99 maxval=4.51 | Taplot bias=3. clip=1.3 | Ta2vplot title=" " label2="Velocity (km/s)" wherexlabel=b TLSZFAT color=i wantaxis1=n d2num=0.5 o2num=3. grid=n polarity=1 xinch=7.5 yinch=0.4 out=junk.v > Junk
	vppen junk.v yshift=-4.2 > bar.v
        Graph < DATDIR/raypos.H THICK d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=n wantaxis=n pad=n yreverse=y xinch=7.5 yinch=7.5 out=junka.v > Junk
        Graph < DATDIR/raypos.H THIN d1num=0 d2num=0 title=" " label1=" " label2=" " wantframe=y wantaxis=n pad=n yreverse=y xinch=7.5 yinch=7.5 out=junkb.v > Junk
	Box x0=6.85 y0=4.2 label="Shadow zone" xt=0.000000 yt=-1.500000 out=point.v > Junk
	vp_Overlay back.v bar.v junka.v junkb.v point.v > junk2.v
	vppen junk1.v xshift=-2 > junka.v
	vppen junk2.v xshift=7 > junkb.v
	vppen junka.v junkb.v erase=o yshift=0.2 scale=0.338 vpstyle=n > FIGDIR/raynegpos.v
	rm back.v bar.v junka.v junkb.v junk.v junk1.v junk2.v point.v Junk
	Rm gauneg.temp gaupos.temp

clean&:
	-RM_CMD a.out
	-RM_CMD junk* *.v *.o *.x

#include "./../../Adm/LIN.fig.rules"

#include <SEP.obj.rules>

#include <SEP.prog.rules>
