#
# H files
#
elf00.H:
	echo n1=70 >> elf.H
	Window3d < elf.H n1=5 > $@

elf.sou.H: elf.H
	Window3d < $<@@ n1=1 f1=37 > sx.H
	Window3d < $<@@ n1=1 f1=38 > sy.H
	Cmplx sx.H sy.H maxsize=1000 > $@
	Rm sx.H sy.H

elf.rec.H: elf.H
	Window3d < $<@@ n1=1 f1=39 > rx.H
	Window3d < $<@@ n1=1 f1=40 > ry.H
	Cmplx rx.H ry.H maxsize=1000 > $@
	Rm rx.H ry.H

elf.cmp.H: elf.H
	Window3d < $<@@ n1=1 f1=44 > rx.H
	Window3d < $<@@ n1=1 f1=45 > ry.H
	Cmplx rx.H ry.H maxsize=1000 > $@
	Rm rx.H ry.H

elf.ofaz.H: elf.H
	Window3d < $<@@ n1=1 f1=42 > rx.H
	Window3d < $<@@ n1=1 f1=43 > ry.H
	Math file1=ry.H exp="@ATAN(file1)*180/3.14159" > ryy.H
	Cmplx rx.H ryy.H maxsize=1000 > $@
	Rm rx.H ry.H ryy.H

elf.ofy.H: elf.H
	Window3d < $<@@ n1=1 f1=38 > rx.H
	Window3d < $<@@ n1=1 f1=40 > ry.H
	Math file1=ry.H file2=rx.H exp="@ABS(file1-file2)" maxsize=2000 > $@
	Rm rx.H ry.H ryy.H

elf.fold_cmp.H: # elf00.H
	Sort3d par=./sortcmp.P max_memory=2000 < elf00.H > junk1.H
	< junk1.H Fold3d compress=2 > $@

elf.fold1_cmp%.H: # elf00.H
	Sort3d par=./sortcmp$*.P max_memory=2000 < elf00.H > junk1.H
	< junk1.H Fold3d compress=2,3 > $@

elf.sort_shots.H: elf.H
#	Sort3d par=./sortsht.P max_memory=20000 < $< > junk1.H
	<junk1.H Window3d min6=2000 n6=20 > j01.H;<j01.H Stack3d normalize=1 maxsize=9000000 verb=1 > j1.H
	<junk1.H Window3d min6=2800 n6=20 > j02.H;<j02.H Stack3d normalize=1 maxsize=9000000 verb=1 > j2.H
	<junk1.H Window3d min6=3600 n6=20 > j03.H;<j03.H Stack3d normalize=1 maxsize=9000000 verb=1 > j3.H
	<junk1.H Window3d min6=4400 n6=21 > j04.H;<j04.H Stack3d normalize=1 maxsize=9000000 verb=1 > j4.H
#	Cat j1.H j2.H j3.H j4.H

elf.shots.y2500.H: elf.H
	Sort3d par=./sortshty2500.P max_memory=9000000 < $< > junk1_2500.H
	< junk1_2500.H Stack3d normalize=1 maxsize=9000000 verb=1 > $@

elf.L7f.vel.H:
	Transp </data/elf_L7d/L7d-vel.H plane=12 reshape=1,3|\
	Interp d1out=25 type=1 maxsize=1000|Interp d2out=25 type=1 maxsize=1000|Interp d3out=12.5 type=1 maxsize=1000 > $@

# Pad beg1=1000 end1=1000 beg2=1000 end2=1000 extend=1|Window3d max3=4000 > $@

elf.L7f.vrms.20m.H:
	Transp plane=13 < elf.L7f.vel.H | Vconvert d1out=0.004 inpar=2 outpar=1 invelopt=1 intype=1 outtype=2 n1out=1250 o1out=0 > 1.H;< 1.H Window3d n1=1001 > elf.L7f.vrms.25m.H
	< 1.H Interp d2out=20 maxsize=1000 n2out=216 type=1 | Transp plane=23 maxsize=1000 | Interp d2out=20 n2out=672 maxsize=1000 type=1 | Transp plane=23 maxsize=1000 > 2.H
	<2.H Window3d n1=1001 > $@
	Rm 1.H 2.H

elf.L7f.vinit.H:
#	Transp < elf.L7f.vel.H plane=13 | Pad end3=1 extend=1 | Window3d min2=1940 n2=133 | ../Tese/bin/OW_3deditvel_pik.x \
#	hor1=hor3dgt2500.pik v=2500 > /dev/null
	Transp < elf.L7f.vel.H plane=13 | Pad end3=1 extend=1 | Window3d min2=1940 n2=133 | ../Tese/bin/OW_3deditvel_mut.x \
	hor1=hor3dgt2500.pik vmut=1 vextr=1 | Smooth rect2=3 rect3=3 rect1=1 > j.H
	Transp < elf.L7f.vel.H plane=13 | Gpow gpow=-1 | Smooth rect1=51 rect2=51 rect3=51 | Scale dscale=1.1 | Gpow gpow=-1|\
	Pad end3=1 extend=1 | Window3d min2=1940 n2=133 | ../Tese/bin/OW_3deditvel_mut.x hor1=survey540 vthr=1 v=2500 > k.H
	< j.H ../Tese/bin/OW_3deditvel_mut.x hor1=survey540 vvel=1 vsub=k.H | Gpow gpow=-1 | Transp plane=13 > $@

elf.L7f.vinit.cam.H:
	< elf.L7f.vinit.H Transp plane=12 reshape=2,3 | Pad extend=1 beg3=20 end3=20 beg2=20 end2=20 | Gpow gpow=-1 > $@

elf.csou.H:
	Wavelet n1=1001 d1=0.004 wavelet=ricker2 phase=0 fund=25 order=0.2 tdelay=2 domain=time > j2.H;echo o1=-2 >> j2.H
	<j2.H Transf f_min=0 f_min1=6 f_max1=40 f_max=46 wei=y is2d=y > j1.H; <j1.H Window3d | Cabs > j2.H
	Math file1=j2.H exp="file1*0">j1.H;Cmplx j2.H j1.H|Transp plane=13 > $@

elf.mig_3d_%.H:
	nohup /net/koko/claudio/Research/Others/ShotMig/bin/LINUX64/ShotMig \
	D=elf.line$*.H D_d=elf.csou.H V=elf.L7f.vel.H  R=$@      \
	nx_shots=140 ox_shots=5000. minx=-4000. maxx=21000.           \
	ny_shots=1   oy_shots=$*      miny=0. maxy=4000.              \
	par=3Dgo_sis.P                                                \
	miny1=30     maxy1=30         minx1=20     maxx1=20           \
	nref=4 nhx=25 taper=y  marine=y watercolumn=0
