$#define RM_H /bin/rm
#define RM_H Rm
#define FIGDIR ../Fig
#define BINDIR ../../Bin/MTYPE
#define XTPANELDIR ../../Xtpanel
#define PEMWINDOW ../../Data/PemWindow
#define FIGLIST xxbefore+after beforereci afterreci
#define NEEDDATA FIGLIST
$
$ only xxbefore+after is gerneated in this Cakefile
$ others are in Cakefile.slice
$
#include <SEP.defs>
#include "../../Cakerules/SEP.martin.rules"
#define CUBELABEL label1="Time [sec]" label2="Midpoint [feet]" label3="Offset [feet]"

/* do the NMO */
allnmo&: [[ sub -i X cdpXcubebig.NMO.8000.H NINECOMP ]]

cdp%1cubebig.NMO.%2.H : PEMFULL/%1cube.H
	NMO vel=%2 <PEMFULL/%1cube.H >cdp%1cubebig.NMO.%2.H

/* run Byte and transpose the data */
jtcdp%1cubebig.B: PEMFULL/%1cube.H
	Window f1=750 n1=500 < PEMFULL/%1cube.H >jw%1
	Byte <jw%1 gainpanel=all pclip=90 >jcdp%1cubebig.B
	Transp plane=23 <jcdp%1cubebig.B  >jtcdp%1cubebig.B
	Rm jw%1 jcdp%1cubebig.B 


/* window just portion from NMO'ed data */
jcdp%1cubebig.NMO.%2.B : cdp%1cubebig.NMO.%2.H
	Window f1=750 n1=500 <cdp%1cubebig.NMO.%2.H >jw%1%2
	Byte <jw%1%2 gainpanel=all pclip=90 >jcdp%1cubebig.NMO.%2.B
	Rm jw%1%2

jtcdp%1cubebig.NMO.%2.B: jcdp%1cubebig.NMO.%2.B
	Transp plane=23 <jcdp%1cubebig.NMO.%2.B >jtcdp%1cubebig.NMO.%2.B


/* get just one slice */
jt%1sl.B: jtcdp%1cubebig.B
	Window f1=30 n1=1  < jtcdp%1cubebig.B > jt%1sl.B

jt%1sl.NMO.B: jtcdp%1cubebig.NMO.8000.B
	Window f1=30 n1=1  < jtcdp%1cubebig.NMO.8000.B > jt%1sl.NMO.B
/*	Rm jtcdp%1cubebig.NMO.8000.B*/

/*
jt%1sl.NMO.%2.%3.B: jtcdp%1cubebig.NMO.8000.B
	Window f1=%2 n1=%3  < jtcdp%1cubebig.NMO.8000.B > jt%1sl.NMO.%2.%3.B
*/
/*	Rm jtcdp%1cubebig.NMO.8000.B*/

beforeslice.v: [[ sub -i X jtXsl.B NINECOMP ]]
	Merge jtxxsl.B jtxysl.B jtxzsl.B axis=2 space=y >j11.B
	Merge jtyxsl.B jtyysl.B jtyzsl.B axis=2 space=y >j21.B
	Merge jtzxsl.B jtzysl.B jtzzsl.B axis=2 space=y >j31.B
	Merge j11.B j21.B j31.B axis=1 space=y >j41.B
	Ta2vplot <j41.B title="Original Time Slices" wantaxis=n out=../Fig/beforeslice.v NULL
/*	Rm jt*sl.B j11.B j21.B j31.B j41.B*/

afterslice.v: [[ sub -i X jtXsl.NMO.B NINECOMP ]]
	Merge jtxxsl.NMO.B jtxysl.NMO.B jtxzsl.NMO.B axis=2 space=y >j1.B
	Merge jtyxsl.NMO.B jtyysl.NMO.B jtyzsl.NMO.B axis=2 space=y >j2.B
	Merge jtzxsl.NMO.B jtzysl.NMO.B jtzzsl.NMO.B axis=2 space=y >j3.B
	Merge j1.B j2.B j3.B axis=1 space=y >j4.B
	<j4.B Ta2vplot title="Time Slices After NMO" wantaxis=0 out=../Fig/afterslice.v NULL
/*	Rm jt*sl.NMO.B j1.B j2.B j3.B  j4.B*/


/* make the reciprocal time slices  */

FIGDIR/afterreci.v&:
	cake -f Cakefile.slice FIGDIR/afterreci.v

FIGDIR/afterreci.v.orig: [[ sub -i X jrtXsl.NMO.B NINECOMP ]]
	Merge jrtxxsl.NMO.B jrtxysl.NMO.B jrtxzsl.NMO.B axis=2 space=y >j1r.B
	Merge jrtyxsl.NMO.B jrtyysl.NMO.B jrtyzsl.NMO.B axis=2 space=y >j2r.B
	Merge jrtzxsl.NMO.B jrtzysl.NMO.B jrtzzsl.NMO.B axis=2 space=y >j3r.B
	Merge j1r.B j2r.B j3r.B axis=1 space=y >j4r.B
	<j4r.B Ta2vplot title="Recip. Time Slices (NMO)" wantaxis=0 out=FIGDIR/afterreci.v NULL xinch=6 yinch=8

afterreci.B: [[ sub -i X jrwXsl.NMO.full.B NINECOMP ]]
	Merge jrwxxsl.NMO.full.B jrwxysl.NMO.full.B jrwxzsl.NMO.full.B axis=2 space=y >j1r.B
	Merge jrwyxsl.NMO.full.B jrwyysl.NMO.full.B jrwyzsl.NMO.full.B axis=2 space=y >j2r.B
	Merge jrwzxsl.NMO.full.B jrwzysl.NMO.full.B jrwzzsl.NMO.full.B axis=2 space=y >j3r.B
	Merge j1r.B j2r.B j3r.B axis=1 space=y >afterreci.B

afterreci.v3: afterreci.BB
	<afterreci.BB Window j1=3 j2=3 | Ta2vplot title="3x3 Comp. Reciprocal Time Slices (NMO)" wantaxis=0 out=../afterreci.v3 NULL

FIGDIR/beforereci.v&:
	cake -f Cakefile.slice FIGDIR/beforereci.v

beforereci.v.orig: [[ sub -i X jrtXsl.B NINECOMP ]]
	Merge jrtxxsl.B jrtxysl.B jrtxzsl.B axis=2 space=y >j1r.B
	Merge jrtyxsl.B jrtyysl.B jrtyzsl.B axis=2 space=y >j2r.B
	Merge jrtzxsl.B jrtzysl.B jrtzzsl.B axis=2 space=y >j3r.B
	Merge j1r.B j2r.B j3r.B axis=1 space=y >j4r.B
	<j4r.B Ta2vplot title="Recip. Time Slices" wantaxis=0 out=../Fig/beforereci.v NULL xinch=6 yinch=8



/* generate the full cube */
/*                                                  subsampled   */
jJ%w.B: if not exist jJ%w.B
	Window <cdp%cubebig.NMO.8000.H j1=2 n1=500   >jJ%w
	Byte gainpanel=all pclip=90 <jJ%w >jJ%w.B
	Rm jJ%w

jrwxysl.NMO.full.B: jJxyw.B jJyxw.B if not exist jrwxysl.NMO.full.B
	Window f2=0   n2=101 <jJxyw.B >jJxyw.a.B
	Window f2=101 n2=101 <jJyxw.B >jJyxw.b.B
	Merge axis=2 space=n  jJxyw.a.B jJyxw.b.B >jJxyw.r.B
	Rm jJxyw.B jJyxw.B jJxyw.a.B jJyxw.b.B
	Transp plane=12 <jJxyw.r.B |Transp plane=23 >jrwxysl.NMO.full.B
	Rm jJxyw.r.B

jrwxzsl.NMO.full.B: jJxzw.B jJzxw.B if not exist jrwxzsl.NMO.full.B
	Window f2=0   n2=101 <jJxzw.B >jJxzw.a.B
	Window f2=101 n2=101 <jJzxw.B >jJzxw.b.B
	Merge axis=2 space=n  jJxzw.a.B jJzxw.b.B >jJxzw.r.B
	Rm jJxzw.B jJzxw.B jJxzw.a.B jJzxw.b.B 
	Transp plane=12 <jJxzw.r.B |Transp plane=23 >jrwxzsl.NMO.full.B
	Rm jJxzw.r.B

jrwyxsl.NMO.full.B: jJyxw.B jJxyw.B if not exist jrwyxsl.NMO.full.B
	Window f2=0   n2=101 <jJyxw.B >jJyxw.a.B
	Window f2=101 n2=101 <jJxyw.B >jJxyw.b.B
	Merge axis=2 space=n  jJyxw.a.B jJxyw.b.B >jJyxw.r.B
	Rm jJyxw.B jJxyw.B jJyxw.a.B jJxyw.b.B 
	Transp plane=12 <jJyxw.r.B |Transp plane=23 >jrwyxsl.NMO.full.B
	Rm jJyxw.r.B

jrwyzsl.NMO.full.B: jJyzw.B jJzyw.B if not exist jrwyzsl.NMO.full.B
	Window f2=0   n2=101 <jJyzw.B >jJyzw.a.B
	Window f2=101 n2=101 <jJzyw.B >jJzyw.b.B
	Merge axis=2 space=n  jJyzw.a.B jJzyw.b.B >jJyzw.r.B
	Rm jJyzw.B jJzyw.B jJyzw.a.B jJzyw.b.B
	Transp plane=12 <jJyzw.r.B |Transp plane=23 >jrwyzsl.NMO.full.B
	Rm  jJyzw.r.B

jrwzxsl.NMO.full.B: jJzxw.B jJxzw.B if not exist jrwzxsl.NMO.full.B
	Window f2=0   n2=101 <jJzxw.B >jJzxw.a.B
	Window f2=101 n2=101 <jJxzw.B >jJxzw.b.B
	Merge axis=2 space=n  jJzxw.a.B jJxzw.b.B >jJzxw.r.B
	Rm jJzxw.B jJxzw.B jJzxw.a.B jJxzw.b.B
	Transp plane=12 <jJzxw.r.B |Transp plane=23 >jrwzxsl.NMO.full.B
	Rm  jJzxw.r.B

jrwzysl.NMO.full.B: jJzyw.B jJyzw.B if not exist jrwzysl.NMO.full.B
	Window f2=0   n2=101 <jJzyw.B >jJzyw.a.B
	Window f2=101 n2=101 <jJyzw.B >jJyzw.b.B
	Merge axis=2 space=n  jJzyw.a.B jJyzw.b.B >jJzyw.r.B
	Rm jJzyw.B jJyzw.B jJzyw.a.B jJyzw.b.B
	Transp plane=12 <jJzyw.r.B |Transp plane=23 >jrwzysl.NMO.full.B
	Rm jJzyw.r.B


jrw%sl.NMO.full.B: jJ%w.B  if not exist jrw%sl.NMO.full.B
	Window f2=0   n2=101 <jJ%w.B >jJ%w.a.B
	Window f2=101 n2=101 <jJ%w.B >jJ%w.b.B
	Merge axis=2 space=n  jJ%w.a.B jJ%w.b.B >jJ%w.r.B
	Rm jJ%w.B jJ%w.B J%w.a.B jJ%w.b.B
	Transp plane=12 <jJ%w.r.B |Transp plane=23 >jrw%sl.NMO.full.B
	Rm jJ%w.r.B

/* -----  */

jrtxxsl.%B: jtxxsl.%B
	Transp plane=12 <jtxxsl.%B >jrtxxsl.%B

jrtyysl.%B: jtyysl.%B
	Transp plane=12 <jtyysl.%B >jrtyysl.%B

jrtzzsl.%B: jtzzsl.%B
	Transp plane=12 < jtzzsl.%B >jrtzzsl.%B

jrtxysl.%B: jtxysl.%B
	Transp plane=12 <jtxysl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtyxsl.%B | Window f1=101 n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtxysl.%B

jrtyxsl.%B: jtyxsl.%B
	Transp plane=12 <jtyxsl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtxysl.%B | Window f1=101   n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtyxsl.%B

jrtxzsl.%B: jtxzsl.%B
	Transp plane=12 <jtxzsl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtzxsl.%B | Window f1=101 n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtxzsl.%B

jrtzxsl.%B: jtzxsl.%B
	Transp plane=12 <jtzxsl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtxzsl.%B | Window f1=101 n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtzxsl.%B

jrtyzsl.%B: jtyzsl.%B
	Transp plane=12 <jtyzsl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtzysl.%B | Window f1=101 n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtyzsl.%B

jrtzysl.%B: jtzysl.%B
	Transp plane=12 <jtzysl.%B | Window f1=0 n1=101   >jwrta.B
	Transp plane=12 <jtyzsl.%B | Window f1=101 n1=101 >jwrtb.B
	Merge axis=1 space=n jwrta.B jwrtb.B >jrtzysl.%B

/* end of  reciprocal time slices */


xxafter.v : jtcdpxxcubebig.NMO.8000.B
	Cubeplot frame1=30 frame2=50 frame3=0 <jtcdpxxcubebig.NMO.8000.B out=jx2 NULL title="Xx Time slices after NMO" point2=0.75 CUBELABEL wanttitle=n
	vppen scale=0.5 align=lb <jx2 >xxafter.v
	Cubeplot frame1=30 frame2=50 frame3=0 <jtcdpxxcubebig.NMO.8000.B out=jx2 NULL title="Xx Time slices after NMO" point2=0.75 CUBELABEL
	vppen scale=0.5 align=lb <jx2 >xxafter.wt.v


jtcdpxxcubebig.B: PEMFULL/xxcube.H
	Window f1=750 n1=500 <PEMFULL/xxcube.H >jwb
	Byte <jwb gainpanel=all pclip=90 >jcdpxxcubebig.B
	Transp plane=23 <jcdpxxcubebig.B >jtcdpxxcubebig.B
	Rm jwb jcdpxxcubebig.B

xxbefore.v : jtcdpxxcubebig.B
	Cubeplot frame1=30 frame2=50 frame3=0 <jtcdpxxcubebig.B out=jx1 NULL title="Xx Time slices before NMO" wanttitle=n point2=0.75 CUBELABEL
	vppen scale=0.5 align=lb <jx1 >xxbefore.v
	Cubeplot frame1=30 frame2=50 frame3=0 <jtcdpxxcubebig.B out=jx1 NULL title="Xx Time slices before NMO" point2=0.75 CUBELABEL
	vppen scale=0.5 align=lb <jx1 >xxbefore.wt.v


FIGDIR/xxbefore+after.v: xxbefore.v xxafter.v
	vp_OverUnderAniso xxbefore.v xxafter.v >xxbefore+after.v
	vp_annotate < xxbefore+after.v text=xxbefore+after.ann batch=y >FIGDIR/xxbefore+after.v
$	vp_OverUnderAniso xxbefore.wt.v xxafter.wt.v >FIGDIR/xxbefore+after.withtitle.v
	vppen xxbefore.v xxafter.v |vppen scale=1  >FIGDIR/xxbefore+after.v3

clean&: jclean
	-RM_CMD *.B j*

#include <SEP.idoc.rules>
