#demultpled data migration
norne = $(PBS_O_WORKDIR)/norne/
Norne = $(HOME)/Research/Norne/work/
dh6=/data/sep/goayeni/norne-prestack/sail-hole-line-06-2d-2759.H
d6=/data/sep/goayeni/norne-prestack/sail-line-06-2d-2759.H
dh8=/data/sep/goayeni/norne-prestack/sail-hole-line-08-2d-2759.H
d8=/data/sep/goayeni/norne-prestack/sail-line-08-2d-2759.H
# no dmult'ed
norne-nodmult-hx-06-%: 
	echo datapath=$(norne) > .datapath; mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-dmult-06-$*/norne_orig-dmult-06-$*-fill.H $@ 0 $(Norne)/hx-dmult.p 40
	touch $@
norne-nodmult-hx-08-%: 
	echo datapath=$(norne) > .datapath; mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-dmult-08-$*/norne_orig-dmult-08-$*-fill.H $@ 0 $(Norne)/hx-dmult.p 40
	touch $@
add-nodmult-hx-06-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-nodmult-hx-06-$*/fdat-norne-nodmult-hx-06-$*.H norne-nodmult-hx-06-$* 400 ; touch $@	
add-nodmult-hx-08-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-nodmult-hx-08-$*/fdat-norne-nodmult-hx-08-$*.H norne-nodmult-hx-08-$* 400 ; touch $@	
#hole no dmult'ed
norne-hole-sxgx-nodmult-hx-06-%: 
	echo datapath=$(norne) > .datapath; mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-06-$*/norne_orig-hole-sxgx-dmult-06-$*.H  $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40
	touch $@
norne-hole-sxgx-nodmult-hx-08-%: 
	echo datapath=$(norne) > .datapath; mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-08-$*/norne_orig-hole-sxgx-dmult-08-$*.H $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40
	touch $@
add-hole-sxgx-nodmult-hx-06-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-nodmult-hx-06-$*/fdat-norne-nodmult-hx-06-$*.H norne-hole-sxgx-nodmult-hx-06-$* 400 ; touch $@	
add-hole-sxgx-nodmult-hx-08-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-nodmult-hx-08-$*/fdat-norne-nodmult-hx-08-$*.H norne-hole-sxgx-nodmult-hx-08-$* 400 ; touch $@	
#no hole dmulted
norne-dmult-hx-06-%: 
	echo datapath=$(norne) > .datapath
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-dmult-06-$*/norne-dmult-06-$*-fill.H $@ 0 $(Norne)/hx-dmult.p 40
	touch $@
norne-dmult-hx-08-%: 
	echo datapath=$(norne) > .datapath
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py $* 293 19 /data/sep/goayeni/workspace/multiples3/norne-dmult-08-$*/norne-dmult-08-$*-fill.H $@ 0 $(Norne)/hx-dmult.p 40
	touch $@
add-dmult-hx-06-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/fdat-norne-dmult-hx-06-$*.H norne-dmult-hx-06-$* 400 ; touch $@	
add-dmult-hx-08-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/fdat-norne-dmult-hx-08-$*.H norne-dmult-hx-08-$* 400 ; touch $@	
	touch $@	
#hole sx + gx
norne-hole-sxgx-dmult-hx-06-%: 
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py \
		$* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-06-$*/norne-hole-sxgx-dmult-06-$*.H $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40; touch $@
norne-hole-sxgx-dmult-hx-08-%: 
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py \
		$* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-08-$*/norne-hole-sxgx-dmult-08-$*.H $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40; touch $@
add-hole-sxgx-dmult-hx-06-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/fdat-norne-dmult-hx-06-$*.H norne-hole-sxgx-dmult-hx-06-$* 400; touch $@	
add-hole-sxgx-dmult-hx-08-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/fdat-norne-dmult-hx-08-$*.H norne-hole-sxgx-dmult-hx-08-$* 400; touch $@	

#flled hole sx + gx
norne-fill-hole-sxgx-dmult-hx-06-%: 
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py \
		$* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-06-$*/norne-hole-sxgx-dmult-06-$*-fill.H $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40; touch $@
norne-fill-hole-sxgx-dmult-hx-08-%: 
	mkdir -p $(norne)
	./migrate2d-dmult-hx-hole.py \
		$* 293 19 /data/sep/goayeni/workspace/multiples3/norne-hole-sxgx-dmult-08-$*/norne-hole-sxgx-dmult-08-$*-fill.H $@ 0 $(Norne)/hx-hole-sxgx-dmult.p 40; touch $@
add-fill-hole-sxgx-dmult-hx-06-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/fdat-norne-dmult-hx-06-$*.H norne-fill-hole-sxgx-dmult-hx-06-$* 400;	touch $@	
add-fill-hole-sxgx-dmult-hx-08-%:
	./add2d-dmult-hx.py $* 293 19 /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/fdat-norne-dmult-hx-08-$*.H norne-fill-hole-sxgx-dmult-hx-08-$* 400;	touch $@	



vvvv=/data/sep/goayeni/workspace/norne-$*/vel-norne-$*.H 
dddd=/data/sep/goayeni/workspace/norne-$*/fdat-norne-$*.H 
wwww=/data/sep/goayeni/workspace/norne-$*/wave-norne-$*.H 
norne-hole1-mig-%:
	cd ~/Research/Source/Oneway/; make $(bin)/joint_encode.x ; cd
	Pad < $(ww) end1=519 extend=1 > wave-$@.H ; echo n1=520  o1=500  d1=25 n2=1  o2=0 d2=1   label2=shot-y >> wave-$@.H 
	Window3d < $(vvvv) | Transp | Smooth rect1=2 rect2=2 | Transp plane=12 reshape=1,3 > vel-$@.H
	$B/joint_encode.x vel=vel-$@.H data=$(dddd) wavelet=wave-$@.H report=$@.log adj=y \
		modl1=$@1.H  data1=$(dddd) vel1=vel-$@.H  \
		jw=1 lloyd=y nsurv=1 code_it=n small=y ltscale=n use_greens=n spike=y wfld_d_out=n wfld_u_out=n encode=n code_it=n spatio=n offset=y\
		taper_pct=0.22 taper_type=2 use_greens=n verb=6 nodes=15 lfreq=y  \
		jw=1 spike=n radian=  tmin=-0.5 tmax=0.5 spike_data=n lloyd=y wfld_d_out=n radian=n nsurv=1 code_it=n  small=y ltscale=y use_greens=n wfld_d_out=n wfld_u_out=n spatio=y \
		ogx=-4525 dgx=25 ngx=363 inv=n \
	        hole_sy1=0 hole_sy2=0 \
	        hole_gy1=0 hole_gy2=0 \
	        hole_sx1=4000 hole_sx2=4250 \
	        hole=y 
norne-s-mig-%:
	cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	$B/joint_encode.x report=$@.log modl=norne-mig-06-$*.H  \
		modl1=norne-mig-06-$*.H rm1=norne-mig-06-$*.H  smodl1=norne-mig-06-$*-s.H ts1=norne-mig-06-$*-ts.H sd1=$@-tsd1.H cc1=$@-cc1.H rr1=$@-rr1.H \
		modl2=norne-mig-08-$*.H rm2=norne-mig-08-$*.H  smodl2=norne-mig-08-$*-s.H ts2=norne-mig-08-$*-ts.H sd2=$@-tsd2.H cc2=$@-cc2.H rr2=$@-rr2.H \
        	nmix=3 par=shift.p nodes=1 shift_nodes=1
		touch $@
norne-hole1-s-mig-%:
	cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	$B/joint_encode.x report=$@.log modl=norne-mig-06-$*.H  \
		modl1=norne-mig-06-$*.H       rm1=norne-mig-06-$*.H        smodl1=norne-mig-06-$*-s.H       ts1=norne-mig-06-$*-ts.H       sd1=$@-tsd1.H cc1=$@-cc1.H rr1=$@-rr1.H \
		modl2=norne-hole1-mig-08-$*.H rm2=norne-hole1-mig-08-$*.H  smodl2=norne-hole1-mig-08-$*-s.H ts2=norne-hole1-mig-08-$*-ts.H sd2=$@-tsd2.H cc2=$@-cc2.H rr2=$@-rr2.H \
        	nmix=3 par=shift.p nodes=1 shift_nodes=1
		touch $@
norne-hole2-mig-%:
	cd ~/Research/Source/Oneway/; make $(bin)/joint_encode.x ; cd
	Pad < $(ww) end1=519 extend=1 | Window3d n3=1 f3=10 squeeze=n > wave-$@.H ; echo n1=520  o1=500  d1=25 n2=1  o2=0 d2=1   label2=shot-y >> wave-$@.H 
	Window3d max3=3000 < $(vvvv) | Transp | Smooth rect1=2 rect2=2 | Transp plane=12 reshape=1,3 > vel-$@.
	Window3d f3=10 n3=1 squeeze=n < $(dddd) > dat-$@.H
	$B/joint_encode.x vel=vel-$@.H data=dat-$@.H wavelet=wave-$@.H report=$@.log adj=y \
		modl1=$@1.H  data1=dat-$@.H vel1=vel-$@.H  \
		jw=1 lloyd=y nsurv=1 code_it=n small=y ltscale=n use_greens=n spike=y wfld_d_out=n wfld_u_out=n encode=n code_it=n spatio=n offset=y\
		taper_pct=0.22 taper_type=2 use_greens=n verb=9 nodes=15 lfreq=y  \
		jw=1 spike=n radian=  tmin=-0.5 tmax=0.5 spike_data=n lloyd=y wfld_d_out=n radian=n nsurv=1 code_it=n  small=y ltscale=y use_greens=n wfld_d_out=n wfld_u_out=n spatio=y \
		ogx=-4525 dgx=25 ngx=363 inv=n \
		marine=y \
	        hole_sy1=0 hole_sy2=0 \
	        hole_gy1=0 hole_gy2=0 \
	        hole_sx1=4000 hole_sx2=4250 \
	        nxhole=3 dxhole=140  \
	        nyhole=1 dyhole=0  \
	        hole=y \
		sub_offset=y

# ADCIG Warping B4 multiple suppression
norne-dmult-ang-s-%:
	cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/modl/norne-dmult-hx-06-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-dmult-$*-1.H 
	Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/modl/norne-dmult-hx-08-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-dmult-$*-2.H 
	$B/joint_encode.x report=$@.log modl=mod-dmult-$*-1.H  \
		modl1=mod-dmult-$*-1.H rm1=mod-dmult-$*-1.H  smodl1=mod-dmult-$*-1-s.H ts1=mod-dmult-$*-1-ts.H sd1=mod-dmult-$*-tsd1.H cc1=mod-dmult-$*-cc1.H rr1=mod-dmult-$*-rr1.H \
		modl2=mod-dmult-$*-2.H rm2=mod-dmult-$*-2.H  smodl2=mod-dmult-$*-2-s.H ts2=mod-dmult-$*-2-ts.H sd2=mod-dmult-$*-tsd2.H cc2=mod-dmult-$*-cc2.H rr2=mod-dmult-$*-rr2.H \
		nmix=1 par=shift-ang.p nmix=11 nodes=1 shift_nodes=1
		touch $@
	cd /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/modl/ ; Transp plane=13 < /home/goayeni/Research/Norne/work/mod-$*-2-s.H > junk$@.H ; 
	cd /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/modl/ ; Transp plane=34 < junk$@.H > /data/sep/goayeni/workspace/norne-dmult-hx-08-$*/modl/norne-dmult-hx-08-$*-ang-s.H datapath=/data/sep/goayeni/workspace/norne-hole-me-hx-08-2759/modl/
norne-hole-sxgx-dmult-ang-s-%:
	cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/modl/norne-dmult-hx-06-$*-ang.H 	       	       > junk$@.H ; < junk$@.H Transp plane=13  > mod-hole-sxgx-dmult-$*-1.H 
	Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/norne-hole-sxgx-dmult-hx-08-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-hole-sxgx-dmult-$*-2.H 
	$B/joint_encode.x report=$@.log modl=mod-hole-sxgx-dmult-$*-1.H  \
		modl1=mod-hole-sxgx-dmult-$*-1.H rm1=mod-hole-sxgx-dmult-$*-1.H  smodl1=mod-hole-sxgx-dmult-$*-1-s.H ts1=mod-hole-sxgx-dmult-$*-1-ts.H sd1=mod-hole-sxgx-dmult-$*-tsd1.H cc1=mod-hole-sxgx-dmult-$*-cc1.H rr1=mod-hole-sxgx-dmult-$*-rr1.H \
		modl2=mod-hole-sxgx-dmult-$*-2.H rm2=mod-hole-sxgx-dmult-$*-2.H  smodl2=mod-hole-sxgx-dmult-$*-2-s.H ts2=mod-hole-sxgx-dmult-$*-2-ts.H sd2=mod-hole-sxgx-dmult-$*-tsd2.H cc2=mod-hole-sxgx-dmult-$*-cc2.H rr2=mod-hole-sxgx-dmult-$*-rr2.H \
		nmix=1 par=shift-ang.p nmix=11 nodes=1 shift_nodes=1
	cd /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=13 < /home/goayeni/Research/Norne/work/mod-hole-sxgx-dmult-$*-2-s.H > junk$@.H ; 
	cd /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=34 < junk$@.H > /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/norne-hole-sxgx-dmult-hx-08-$*-ang-s.H datapath=/data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-2759/modl/
	touch $@
norne-hole-hole-sxgx-dmult-ang-s-%:
	cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	#Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-06-$*/modl/norne-hole-sxgx-dmult-hx-06-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-hole-hole-sxgx-dmult-$*-1.H 
	#Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/norne-hole-sxgx-dmult-hx-08-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-hole-hole-sxgx-dmult-$*-2.H 
	#$B/joint_encode.x report=$@.log modl=mod-hole-hole-sxgx-dmult-$*-1.H  \
		modl1=mod-hole-hole-sxgx-dmult-$*-1.H rm1=mod-hole-hole-sxgx-dmult-$*-1.H  smodl1=mod-hole-hole-sxgx-dmult-$*-1-s.H ts1=mod-hole-hole-sxgx-dmult-$*-1-ts.H sd1=mod-hole-hole-sxgx-dmult-$*-tsd1.H cc1=mod-hole-hole-sxgx-dmult-$*-cc1.H rr1=mod-hole-hole-sxgx-dmult-$*-rr1.H \
		modl2=mod-hole-hole-sxgx-dmult-$*-2.H rm2=mod-hole-hole-sxgx-dmult-$*-2.H  smodl2=mod-hole-hole-sxgx-dmult-$*-2-s.H ts2=mod-hole-hole-sxgx-dmult-$*-2-ts.H sd2=mod-hole-hole-sxgx-dmult-$*-tsd2.H cc2=mod-hole-hole-sxgx-dmult-$*-cc2.H rr2=mod-hole-hole-sxgx-dmult-$*-rr2.H \
        	nmix=1 par=shift-ang.p nmix=11 nodes=1 shift_nodes=1
	cd /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=13 < /home/goayeni/Research/Norne/work/mod-hole-hole-sxgx-dmult-$*-2-s.H > junk$@.H ; 
	cd /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=34 < junk$@.H > /data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-$*/modl/norne-hole-hole-sxgx-dmult-hx-08-$*-ang-s.H datapath=/data/sep/goayeni/workspace/norne-hole-sxgx-dmult-hx-08-2759/modl/
	touch $@
norne-fill-hole-sxgx-dmult-ang-s-%:
	#cd ~/research.ln/Source/Oneway/; make $(bin)/joint_encode.x ; cd 
	#Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-dmult-hx-06-$*/modl/norne-dmult-hx-06-$*-ang.H 	                         > junk$@.H ; < junk$@.H Transp plane=13  > mod-fill-hole-sxgx-dmult-$*-1.H 
	#Window3d squeeze= n f2=0 n2= 11 < /data/sep/goayeni/workspace/norne-fill-hole-sxgx-dmult-hx-08-$*/modl/norne-fill-hole-sxgx-dmult-hx-08-$*-ang.H > junk$@.H ; < junk$@.H Transp plane=13  > mod-fill-hole-sxgx-dmult-$*-2.H 
	#$B/joint_encode.x report=$@.log modl=mod-fill-hole-sxgx-dmult-$*-1.H  \
		modl1=mod-fill-hole-sxgx-dmult-$*-1.H rm1=mod-fill-hole-sxgx-dmult-$*-1.H  smodl1=mod-fill-hole-sxgx-dmult-$*-1-s.H ts1=mod-fill-hole-sxgx-dmult-$*-1-ts.H sd1=mod-fill-hole-sxgx-dmult-$*-tsd1.H cc1=mod-fill-hole-sxgx-dmult-$*-cc1.H rr1=mod-fill-hole-sxgx-dmult-$*-rr1.H \
		modl2=mod-fill-hole-sxgx-dmult-$*-2.H rm2=mod-fill-hole-sxgx-dmult-$*-2.H  smodl2=mod-fill-hole-sxgx-dmult-$*-2-s.H ts2=mod-fill-hole-sxgx-dmult-$*-2-ts.H sd2=mod-fill-hole-sxgx-dmult-$*-tsd2.H cc2=mod-fill-hole-sxgx-dmult-$*-cc2.H rr2=mod-fill-hole-sxgx-dmult-$*-rr2.H \
        	nmix=1 par=shift-ang.p nmix=11 nodes=1 shift_nodes=1
	cd /data/sep/goayeni/workspace/norne-fill-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=13 < /home/goayeni/Research/Norne/work/mod-fill-hole-sxgx-dmult-$*-2-s.H > junk$@.H ; 
	cd /data/sep/goayeni/workspace/norne-fill-hole-sxgx-dmult-hx-08-$*/modl/; Transp plane=34 < junk$@.H > /data/sep/goayeni/workspace/norne-fill-hole-sxgx-dmult-hx-08-$*/modl/norne-fill-hole-sxgx-dmult-hx-08-$*-ang-s.H datapath=/data/sep/goayeni/workspace/norne-fill-hole-sxgx-dmult-hx-08-2759/modl/
	touch $@

mig-all: 
	make -n norne-dmult-hx-06-2759 
	make -n norne-dmult-hx-08-2759 
	make -n norne-nodmult-hx-06-2759
	make -n norne-nodmult-hx-08-2759 
	make -n norne-hole-sxgx-dmult-hx-06-2759
	make -n norne-hole-sxgx-dmult-hx-08-2759
	make -n norne-hole-sxgx-nodmult-hx-06-2759
	make -n norne-hole-sxgx-nodmult-hx-08-2759
	make -n norne-fill-hole-sxgx-dmult-hx-06-2759
	make -n norne-fill-hole-sxgx-dmult-hx-08-2759
	#add---run these after all migration is complete
	make -n add-dmult-hx-06-2759
	make -n add-dmult-hx-08-2759
	make -n add-nodmult-hx-06-2759
	make -n add-nodmult-hx-08-2759
	make -n add-hole-sxgx-dmult-hx-06-2759
	make -n add-hole-sxgx-dmult-hx-08-2759
	make -n add-hole-sxgx-nodmult-hx-06-2759
	make -n add-hole-sxgx-nodmult-hx-08-2759
	make -n add-fill-hole-sxgx-dmult-hx-06-2759
	make -n add-fill-hole-sxgx-dmult-hx-08-2759
