#define FIGDIR ./Fig
#include <SEP.defs>
#define FIGLIST elastic-exacto syn-ellip gather exact-vs-approx-median exact-vs-approx-28to36 mcroy-elastic mcroy-elastic-logs

default& : tube

FIGDIR/elastic-exacto.v: ./Src/plot_elastic.x
	echo './Data/model.ti.p' >! plotin
	echo '0' >> plotin
	./Src/plot_elastic.x < plotin
	cat ea.plot1 ec.plot1 el.plot1 ef.plot1 > elastic.plot1
	echo 'n1=18 n2=2 n3=4 ein=0 in=elastic.plot1' > elastic.H
	Dd < elastic.H esize=4 > junk1.H
	Graph title=' ' wherexlabel=t  n1=18 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=0   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,10 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=y <  junk1.H
	vppen erase=once align=lb junk.A > FIGDIR/elastic-exacto.v

FIGDIR/syn-ellip.v: ./Src/elastic_to_nmo.x  ./Src/plot_vxvzgamma.x
	echo './Data/model.ti.p' >! junkin
	echo 'model.p.ellip' >> junkin
	echo 'h' >> junkin
	./Src/elastic_to_nmo.x < junkin
	echo 'model.p.ellip' >! plotin
	echo '0' >> plotin
	./Src/plot_vxvzgamma.x < plotin
	cat vx.plot1 vz.plot1 > vxvz.plot1
	echo './Data/model.ti.s' >! junkin
	echo 'model.s.ellip' >> junkin
	echo 'h' >> junkin
	./Src/elastic_to_nmo.x < junkin
	echo 'model.s.ellip' >! plotin
	echo '0' >> plotin
	./Src/plot_vxvzgamma.x < plotin
	cat vx.plot1 vz.plot1 >> vxvz.plot1
	echo 'n1=18 n2=2 n3=4 ein=0 in=vxvz.plot1' > vxvz.H
	Dd < vxvz.H esize=4 > junk1.H
	Graph title=' ' wherexlabel=t  n1=18 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=0   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,10 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=y <  junk1.H
	vppen erase=once align=lb junk.A > FIGDIR/syn-ellip.v
	
FIGDIR/gather.v: ./Data/gather.H
	Transp < ./Data/gather.H > junk.H
	Taplot pclip=98 < junk.H > junk.M
	Ta2vplot xll=1.0 yll=1.0 xur=4.5 yur=6.0 out=junk.C  labelsz=6 label1='depth (ft)' label2='time (ms)' title=' ' o1num=1650 o2num=0 max2=40 < junk.M
	vppen align=lb junk.C scale=1.0 > FIGDIR/gather.v

FIGDIR/exact-vs-approx-median.v:  ./Src/model_to_grid.x  ./Src/nmo_to_elastic.x ./Src/median_1d.x ./Src/profile.x  ./Src/model_to_grid_elastic.x 
	echo './Data/model.ellip.p.0to30deg' >! junkin
	echo '3' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxp.out
	cat ./model_to_grid_vz.out >! ./vzp.out
	echo './Data/model.ellip.s.0to30deg' >! junkin
	echo '3' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxs.out
	cat ./model_to_grid_vz.out >! ./vzs.out
	echo './vxp.out' >! nmo_to_elastic_in
	echo './vzp.out' >> nmo_to_elastic_in
	echo './vxs.out' >> nmo_to_elastic_in
	echo './vzs.out' >> nmo_to_elastic_in
	echo 'h' >> nmo_to_elastic_in
	./Src/nmo_to_elastic.x < nmo_to_elastic_in
	echo './elastic_a.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.a
	echo './elastic_c.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.c
	echo './elastic_l.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.l
	echo './elastic_f.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.f
	echo 'profile.out.a' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.a
	echo 'profile.out.c' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.c
	echo 'profile.out.l' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.l
	echo 'profile.out.f' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.f
	cat profile.out.a profile.out.c profile.out.l profile.out.f >! all_elastic.approx.median.out
	echo 'n1=767 n2=2 n3=4 ein=0 in=all_elastic.approx.median.out' > all_elastic.approx.median.H
	echo './Data/model.ti.p' >! modelin
	echo '3' >> modelin
	echo '1' >> modelin
	./Src/model_to_grid_elastic.x < modelin
	echo './model_to_grid_ea.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.a.exact
	echo './model_to_grid_ec.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.c.exact
	echo './model_to_grid_el.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.l.exact
	echo './model_to_grid_ef.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.f.exact
	cat profile.out.a.exact profile.out.c.exact profile.out.l.exact profile.out.f.exact >! all_elastic.exact.out
	echo 'n1=767 n2=2 n3=4 ein=0 in=all_elastic.exact.out' > all_elastic.exact.H
	Dd < all_elastic.exact.H esize=4 > junk1.H
	Graph title=' ' wherexlabel=t  n1=767 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=0,0,0,0   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,8 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=y <  junk1.H
	Dd < all_elastic.approx.median.H esize=4 > junk2.H
	Graph title=' ' wherexlabel=t  n1=767 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=n label2='velocity (ft/s)' transp=y wantaxis1=n labelsz=6 dash=3,3,3,3   labelrot=y axisfat=1 out=junk.B titlesz=8 plotfat=7,1,4,8 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=n <  junk2.H
	cat junk.A junk.B > junk.C
	vppen erase=once align=lb junk.C > FIGDIR/exact-vs-approx-median.v

FIGDIR/exact-vs-approx-28to36.v: ./Src/model_to_grid.x  ./Src/nmo_to_elastic.x ./Src/median_1d.x ./Src/profile.x
	echo './Data/model.ellip.p.0to30deg' >! junkin
	echo '3' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxp.out
	cat ./model_to_grid_vz.out >! ./vzp.out
	echo './Data/model.ellip.s.28to36deg' >! junkin
	echo '3' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxs.out
	cat ./model_to_grid_vz.out >! ./vzs.out
	echo './vxp.out' >! nmo_to_elastic_in
	echo './vzp.out' >> nmo_to_elastic_in
	echo './vxs.out' >> nmo_to_elastic_in
	echo './vzs.out' >> nmo_to_elastic_in
	echo 'h' >> nmo_to_elastic_in
	./Src/nmo_to_elastic.x < nmo_to_elastic_in
	echo './elastic_a.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.a
	echo './elastic_c.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.c
	echo './elastic_l.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.l
	echo './elastic_f.out' >! profilein
	echo '1 1' >> profilein
	echo '767 1' >> profilein
	echo '0 700' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.f
	echo 'profile.out.a' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.a
	echo 'profile.out.c' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.c
	echo 'profile.out.l' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.l
	echo 'profile.out.f' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.f
	cat profile.out.a profile.out.c profile.out.l profile.out.f >! all_elastic.approx.median.out
	echo 'n1=767 n2=2 n3=4 ein=0 in=all_elastic.approx.median.out' > all_elastic.approx.median.H
	Graph title=' ' wherexlabel=t  n1=767 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=0,0,0,0   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,8 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=y <  junk1.H
	Dd < all_elastic.approx.median.H esize=4 > junk2.H
	Graph title=' ' wherexlabel=t  n1=767 n2=4 n3=1 esize=8 plotfat=1   wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=n label2='velocity (ft/s)' transp=y wantaxis1=n labelsz=6 dash=3,3,3,3   labelrot=y axisfat=1 out=junk.B titlesz=8 plotfat=7,1,4,8 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=700. min2=4000. max1=3000 max2=15000 o1num=1000 o2num=4000 wantframe=n <  junk2.H
	cat junk.A junk.B > junk.C
	vppen erase=once align=lb junk.C > FIGDIR/exact-vs-approx-28to36.v

FIGDIR/mcroy-elastic.v: ./Src/model_to_grid.x  ./Src/nmo_to_elastic.x ./Src/median_1d.x ./Src/profile.x
	echo './Data/model.p' >! junkin
	echo '1' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxp.out
	cat ./model_to_grid_vz.out >! ./vzp.out
	echo './Data/model.s' >! junkin
	echo '1' >> junkin
	./Src/model_to_grid.x < junkin
	cat ./model_to_grid_vx.out >! ./vxs.out
	cat ./model_to_grid_vz.out >! ./vzs.out
	echo './vxp.out' >! nmo_to_elastic_in
	echo './vzp.out' >> nmo_to_elastic_in
	echo './vxs.out' >> nmo_to_elastic_in
	echo './vzs.out' >> nmo_to_elastic_in
	echo 'h' >> nmo_to_elastic_in
	./Src/nmo_to_elastic.x < nmo_to_elastic_in
	echo './elastic_a.out' >! profilein
	echo '1 1' >> profilein
	echo '501 1' >> profilein
	echo '0 1660' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.a
	echo './elastic_c.out' >! profilein
	echo '1 1' >> profilein
	echo '501 1' >> profilein
	echo '0 1660' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.c
	echo './elastic_l.out' >! profilein
	echo '1 1' >> profilein
	echo '501 1' >> profilein
	echo '0 1660' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.l
	echo './elastic_f.out' >! profilein
	echo '1 1' >> profilein
	echo '501 1' >> profilein
	echo '0 1660' >> profilein
	./Src/profile.x < profilein
	cat profile.out >! profile.out.f
	echo 'profile.out.a' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.a
	echo 'profile.out.c' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.c
	echo 'profile.out.l' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.l
	echo 'profile.out.f' >! medianin
	echo '4' >> medianin
	./Src/median_1d.x < medianin >! out
	cat median_1d.out >! profile.out.f
	cat profile.out.a profile.out.c profile.out.l profile.out.f >! mcroy.elastic.out
	echo 'n1=501 n2=2 n3=4 ein=0 in=mcroy.elastic.out' > mcroy.elastic.H
	Dd < mcroy.elastic.H esize=4 > junk1.H
	Graph title=' ' wherexlabel=t  n1=501 n2=4 n3=1 esize=8 wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=5,3,2,3   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,10 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=1650. min2=4000. max1=2160 max2=24000 o2num=4000 d2num=10000 wantframe=y <  junk1.H
	cat junk.A > junk.C
	vppen erase=once align=lb junk.C > FIGDIR/mcroy-elastic.v

FIGDIR/mcroy-elastic-logs.v: 
	Graph title=' ' wherexlabel=t  n1=501 n2=3 n3=1 esize=8 wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=y label2='velocity (ft/s)' transp=y wantaxis1=y labelsz=6 dash=5,3,2,3   labelrot=y axisfat=1 out=junk.A titlesz=8 plotfat=7,1,4,10 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=1650. min2=4000. max1=2160 max2=24000 o2num=4000 d2num=10000  wantframe=y <  junk1.H
	echo 'n1=168 n2=2 n3=1 ein=0 in=./Data/p.log.out' >! p.log.H
	Dd < p.log.H esize=4 > junk.p
	echo 'n1=168 n2=2 n3=1 ein=0 in=./Data/s.log.out' >! s.log.H
	Dd < s.log.H esize=4 > junk.s
	Cat junk.p junk.s > junk.ps
	Graph title=' ' wherexlabel=t  n1=168 n2=2 n3=1 esize=8 wheretitle=t whereylabel=l yreverse=y label1='depth (ft)' wantaxis2=n label2='velocity (ft/s)' transp=y wantaxis1=n labelsz=6 dash=0,0 labelrot=y axisfat=1 plotcol=2,2 out=junk.B titlesz=8 plotfat=4,4 xll=1.0 yll=1.0 yur=6.5 xur=5.0 min1=1650. min2=4000. max1=2160 max2=24000 o2num=4000 d2num=10000 wantframe=y <  junk.ps
	cat junk.A junk.B  > junk.C
	vppen erase=once align=lb junk.C > FIGDIR/mcroy-elastic-logs.v

clean&: jclean
	! rm -f *plot1* *in* *ellip* *out* *.aux *.f
	!cd Src; rm -f *.x *.o *.trace

#include <SEP.idoc.rules>
#include <SEP.obj.rules>
#include <SEP.prog.rules>
