MAKE_DEPEND=yes
include ${SEPINC}/SEP.top
include FigMakefile

UF90DEFINES=-DLINUX -DUSE_FFTW -DFFTW=1 -DSEP_OMP -DOMP # -DDBUG 
UF90INCLUDES=-I.
UF90FLAGS=-O3 -openmp -openmp_report2 -fast
FFTWLIBS=-L/opt/FFTW/lib -lfftw3f
MAINLIBS=-lsupersetf90 -lsuperset -lsepparf90 -lseppar -lsep2df90 -lsep3df90 -lsep3d -lsepf90 -lsep -lsepgeef90

VEC= -L/opt/intel/Compiler/11.1/059/mkl/lib/em64t -lmkl -lvml
UF90LIBS=-lsep2df90 -lsepparf90 -lseppar -lsupersetf90 -lsuperset ${FFTWLIBS} ${ACMLIB} ${MAINLIBS} -openmp -lpthread


BIN=./bin
PAR=./par
RESDIR=./Fig
R = ${RESDIR}
FIG=./Fig
DATA=./data
OBJ=./obj

RESULTER=ismarm101
RESULTCR=ismarm102 ismarm103 ismarm104 ismarm105 ismarm106 ismarm201 ismarm202 ismarm203 ismarm204 ismarm205 ismarm206 ismarm301 ismarm302 ismarm303 ismarm304 ismarm305 ismarm306 ismarm307 # ismarm107 ismarm207
RESULTNR=

ER_v = ismarm101.v
#CR_v = ismarm102.v ismarm103.v ismarm104.v ismarm105.v ismarm106.v ismarm102.v ismarm201.v ismarm202.v ismarm203.v  ismarm204.v ismarm205.v ismarm206.v ismarm301.v ismarm302.v ismarm303.v  ismarm304.v ismarm305.v ismarm306.v ismarm307.v # ismarm107.v ismarm207.v
#ER_pdf = ismarm101.pdf
#CR_pdf = ismarm102.pdf ismarm103.pdf ismarm104.pdf ismarm105.pdf ismarm106.pdf ismarm201.pdf \
#ismarm202.pdf ismarm203.pdf ismarm204.pdf ismarm205.pdf ismarm206.pdf ismarm301.pdf \
#ismarm302.pdf ismarm303.pdf ismarm304.pdf ismarm305.pdf ismarm306.pdf ismarm307.pdf # ismarm107.pdf ismarm207.pdf 
NR_pdf = 

CR_v = ismarm01.v \
ismarm02.v \
ismarm03.v \
ismarm06a.v \
ismarm04.v \
ismarm07.v \
ismarm08.v \
ismarm201. \
ismarm101.v \
ismarm202.v \
ismarm203.v \
ismarm205.v \
ismarm204.v \
ismarm206.v

ER_pdf = ismarm101.pdf
CR_pdf = ismarm01.pdf \
ismarm02.pdf \
ismarm03.pdf \
ismarm06a.pdf \
ismarm04.pdf \
ismarm07.pdf \
ismarm08.pdf \
ismarm201.pdf \
ismarm101.pdf \
ismarm202.pdf \
ismarm203.pdf \
ismarm205.pdf \
ismarm204.pdf \
ismarm206.pdf 

cr_burn: clean
er_burn: clean
er_build: ${ER_v}
cr_build: ${CR_v}
er_pdf: ${ER_pdf}
cr_pdf: ${CR_pdf}

Prst_ExpRefl=/net/server/claudio/Research/Prst_ExpRefl
Tese=/net/server/claudio/Research/Prst_ExpRefl/Tese
PERM=/net/server/claudio/Research/Thesis/perm
Research=/net/server/claudio/Research
##############################################################
#
# marmousi
#
3000marm_vel_smooth2W:
	Math file1=${Prst_ExpRefl}/2Wpar/8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 | Pad beg1=833 2000 end1=793 2000 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0| Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_2W.H
	Math file1=${Prst_ExpRefl}/2Wpar/8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 | \
	Smooth rect1=48 rect2=16 > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 > 3000marm_vel_smooth2.H
	Math file1=3000marm_vel_2W.H exp="1/@ABS(file1)" | Window3d squeeze=n min1=0 max1=9000 |\
	${Prst_ExpRefl}/Tese/bin/OW_editvel_mut.x vvel=1 vsub=3000marm_vel_smooth2.H hor1=marmv0.orig > j1.H
	< j1.H /Tese/bin/OW_editvel_mut.x vper=1 vperc=.9 hor1=marmv0.orig | Pad beg1=833 2000 end1=793 2000 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0 | Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_smooth.2W.H

########################################################################
#
# Perm w/2way data now w/FFD
#
8001marm_shot_fd%:
	Fdmod intag=${Prst_ExpRefl}/2Wpar/8000marmvel_4m.H  \
	no_stdout=1 oxs=$* dxs=24 nxs=25 tmax=4 ex=1650 bx=1650 jt=10 hsfile=${Prst_ExpRefl}/2Wpar/temp$*.H > /dev/null

8001marm_shots_fd.H:
	Cat ${Prst_ExpRefl}/2Wpar/temp0000.H \
	${Prst_ExpRefl}/2Wpar/temp0600.H \
	${Prst_ExpRefl}/2Wpar/temp1200.H \
	${Prst_ExpRefl}/2Wpar/temp1800.H \
	${Prst_ExpRefl}/2Wpar/temp2400.H \
	${Prst_ExpRefl}/2Wpar/temp3000.H \
	${Prst_ExpRefl}/2Wpar/temp3600.H \
	${Prst_ExpRefl}/2Wpar/temp4200.H \
	${Prst_ExpRefl}/2Wpar/temp4800.H \
	${Prst_ExpRefl}/2Wpar/temp5400.H \
	${Prst_ExpRefl}/2Wpar/temp6000.H \
	${Prst_ExpRefl}/2Wpar/temp6600.H \
	${Prst_ExpRefl}/2Wpar/temp7200.H \
	${Prst_ExpRefl}/2Wpar/temp7800.H \
	${Prst_ExpRefl}/2Wpar/temp8400.H axis=3 | \
	Bandpass flo=4 | Window3d j2=6 | Interp d1out=0.004 |Mute vmute=1500 tmute=0.05  > ${Prst_ExpRefl}/2Wpar/$@

3000marm_data_prep.H:
	< ${Prst_ExpRefl}/2Wpar/8001marm_shots_fd.H Window3d n1=951 | Transf shotmig=y is2d=y wei=y f_min=0 f_min1=4 f_max1=40 f_max=48 maxsize=1000 > $@

3000marmig2bckgffd:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111_2W.H
	Window3d < 3000marm2W.inv_vout11.perm.sd.H n4=1 f4=31 squeeze=n |\
	${Prst_ExpRefl}/Tese/bin/OWmig2d_areal.x sou=11111_2W.H rec=3000marm_data_prep.H  \
	vel=3000marm_vel_smooth.2W.H bkgimg=3000marm.bkim2Wa.ffd.H \
	zmin=0 zmax=3000 nh=31 oh=-360 jh=1 migration=1 areal=0 \
	padtraces=50 traces_in_taper=50 node=14 \
	extrapolator=ffd

3000marmig2wrong:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111_2W.H
	Math file1=3000marm_vel_smooth.2W.H exp="file1*1.1" > 3000marm_vel_smooth.2W.wrong.H
	echo o6=0 >> 3000marm_data_prep.H
	echo o6=0 >> 11111_2W.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=11111_2W.H rec=3000marm_data_prep.H  \
	vel=3000marm_vel_smooth.2W.wrong.H bkgimg=3000marm.bkim2W.wrong.ffd.H \
	zmin=0 zmax=3000 nh=17 oh=-192 jh=1 migration=1 areal=0 \
	padtraces=50 traces_in_taper=50 node=14 \
	extrapolator=ffd


3000marm2Wffd.window.H:
	< 3000marm.bkim2Wa.ffd.H Window3d min1=0 max1=9000 min2=-192 n2=17 > 1.H
	< 1.H ${Prst_ExpRefl}/Tese/bin/OW_windowing.x nhorz=12 hor1=marm_ffd_h1 hor2=marm_ffd_h2 hor3=marm_ffd_h3 hor4=marm_ffd_h4 \
	hor5=marm_ffd_h5 hor6=marm_ffd_h6 hor7=marm_ffd_h7 hor8=marm_ffd_h8 hor9=marm_ffd_h9 hor10=marm_ffd_h10 \
	hor11=marm_ffd_h11 hor12=marm_ffd_h12 wavz=13 taperon=1 > $@

3000marm2W_rotsdffd:
	Window3d <3000marm2Wffd.window.H n1=70 f1=170 f3=200 n4=1 f4=0  |Transp plane=13|\
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=8 nxchunk=1 | Pad beg3=170 end3=135 beg1=200 > h1.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=70 f1=170 f3=200 n4=1 f4=0  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=8 nxchunk=1 | Pad beg3=170 end3=135 beg1=200 > h1.rec.sd.H
##
	Window3d <3000marm2Wffd.window.H n1=85 f1=290 f3=200 n4=1 f4=1  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=290 end3=0 beg1=200 > h2.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=85 f1=290 f3=200 n4=1 f4=1  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=290 end3=0 beg1=200 > h2.rec.sd.H
##
	Window3d <3000marm2Wffd.window.H n1=130 f1=170 f3=200 n4=1 f4=2  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=170 end3=75 beg1=200 > h3.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=130 f1=170 f3=200 n4=1 f4=2  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=170 end3=75 beg1=200 > h3.rec.sd.H
##
	Window3d <3000marm2Wffd.window.H n1=60 f1=120 f3=200 n4=1 f4=3  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=120 end3=195 beg1=200 > h4.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=60 f1=120 f3=200 n4=1 f4=3  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=120 end3=195 beg1=200 > h4.rec.sd.H
##
	Window3d <3000marm2Wffd.window.H n1=60 f1=90 f3=200 n4=1 f4=4  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=90 end3=225 beg1=200 > h5.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=60 f1=90 f3=200 n4=1 f4=4  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=90 end3=225 beg1=200 > h5.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=140 f1=150 f3=200 n4=1 f4=5  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=150 end3=85 beg1=200 > h6.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=140 f1=150 f3=200 n4=1 f4=5  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=150 end3=85 beg1=200 > h6.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=80 f1=200 f3=200 n4=1 f4=6  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=200 end3=95 beg1=200 > h7.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=80 f1=200 f3=200 n4=1 f4=6  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=200 end3=95 beg1=200 > h7.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=110 f1=220 f3=200 n4=1 f4=7  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=220 end3=45 beg1=200 > h8.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=110 f1=220 f3=200 n4=1 f4=7  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=220 end3=45 beg1=200 > h8.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=150 f1=180 f3=200 n4=1 f4=8  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=180 end3=45 beg1=200 > h9.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=150 f1=180 f3=200 n4=1 f4=8  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=180 end3=45 beg1=200 > h9.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=210 f1=0 f3=200 n4=1 f4=9  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=0 end3=165 beg1=200 > h10.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=210 f1=0 f3=200 n4=1 f4=9  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=0 end3=165 beg1=200 > h10.rec.sd.H
#
	Window3d <3000marm2Wffd.window.H n1=145 f1=230 f3=200 n4=1 f4=10  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=230 end3=0 beg1=200 > h11.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=145 f1=230 f3=200 n4=1 f4=10  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=230 end3=0 beg1=200 > h11.rec.sd.H

	Window3d <3000marm2Wffd.window.H n1=80 f1=150 f3=200 n4=1 f4=11  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=150 end3=145 beg1=200 > h12.sou.sd.H
	Window3d <3000marm2Wffd.window.H n1=80 f1=150 f3=200 n4=1 f4=11  |Transp plane=13 | \
	./bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=150 end3=145 beg1=200 > h12.rec.sd.H

	Cat h1.sou.sd.H h2.sou.sd.H h3.sou.sd.H h4.sou.sd.H h5.sou.sd.H h6.sou.sd.H h7.sou.sd.H \
	h8.sou.sd.H h9.sou.sd.H h10.sou.sd.H h11.sou.sd.H h12.sou.sd.H axis=4 >3000marm2Wffd.rot.sou.sd.H
	Cat h1.rec.sd.H h2.rec.sd.H h3.rec.sd.H h4.rec.sd.H h5.rec.sd.H h6.rec.sd.H h7.rec.sd.H \
	h8.rec.sd.H h9.rec.sd.H h10.rec.sd.H h11.rec.sd.H h12.rec.sd.H axis=4 >3000marm2Wffd.rot.rec.sd.H
	Rm h*.rec.sd.H h*.sou.sd.H 1.H

3000marm2Wffd.rot.sou.scale:
	Window3d < 3000marm2Wffd.rot.sou.sd.H |Transp plane=13|${Tese}/bin/OW_2dscale.x wx=1 perc=0.2 > $@.H

3000marm2Wffd.rot.rec.scale:
	Window3d < 3000marm2Wffd.rot.rec.sd.H |Transp plane=13|${Tese}/bin/OW_2dscale.x wx=1 perc=0.2 > $@.H

3000marm2Wffd_perm%:
	Window3d < 3000marm2Wffd.rot.sou.scale.H squeeze=n > s1.H
	Window3d < 3000marm2Wffd.rot.rec.scale.H squeeze=n > r1.H
	Wavelet n1=1501 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=3. domain=time > j2.H;echo o1=-3. >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111.H
	${Tese}/bin/OW_arealsht.x rec_cig=r1.H sou_cig=s1.H sou=11111.H vel=3000marm_vel_smooth.2W.H \
	rec_out=3000marm2Wffd.crec$*.perm.H sou_out=3000marm2Wffd.csou$*.perm.H extrapolator=ffd \
	padtraces=101 encode=1 encz=1 eps=1 random=1 injection=1 nreal=1 ngap=$* zmin=1504 zmax=3000 node=14 

3000marm2W02ffdperm%: # 
	Math file1=3000marm2Wffd.crec$*.perm.H exp="file1/100"|Pad beg1=267 end1=267>3000marm2Wffd.crec.perm.pad.H
	Math file1=3000marm2Wffd.csou$*.perm.H exp="file1/100"|Pad beg1=267 end1=267>3000marm2Wffd.csou.perm.pad.H
	${Prst_ExpRefl}/Tese/bin/steepest_ls1.x  OW_lbfgsc_areal.x sou=3000marm2Wffd.csou.perm.pad.H rec=3000marm2Wffd.crec.perm.pad.H \
	vel=3000marm_vel_smooth.2W.H grad=3000marm2W02ffd.inv_grad$*.perm.H \
	Dimage=3000marm2W02ffd.inv_dso$*.perm.H bkgimg=3000marm2W02ffd.inv_bkim$*.perm.H \
	Velout=3000marm2W02ffd.inv_vout$*.perm.H \
	zmin=0 zmax=3000 nh=17 oh=-192 jh=1 niter=15 dso=1 inversion=1 areal=1 mmax=5 xv_min=500 xv_max=8500 \
	dxk=240 nxk=109 oxk=-8400 dzk=16 nzk=188 horv0=marmv0.out0.csv \
	extrapolator=ffd padtraces=50 traces_in_taper=25 node=14 bounds=1 cbound=0 p_lo=60 p_up=40 \

3000marm2Wperm_nl%: # 
	Math file1=3000marm2Wffd.crec$*.perm.H exp="file1/10000" >crec.H
	Math file1=3000marm2Wffd.csou$*.perm.H exp="file1/10000" >csou.H
	${Prst_ExpRefl}/Tese/bin/nlin_srch.x \
	sou=csou.H \
	rec=crec.H \
	vel=3000marm_vel_smooth.2W.H \
	Velout=3000marm2W02ffd.inv_vout$*.perm.H \
	grad_=3000marm2W02ffd.inv_grad$*.perm.H \
	bimg=3000marm2W02ffd.inv_bimg$*.perm.H \
	dimg=3000marm2W02ffd.inv_dimg$*.perm.H \
	par=3000marm2W02ffd.inv.P \
	list=listagem_$*

3000marm2Wpermsc_nl%: # 
	Math file1=3000marm2Wffd.crec$*.perm.H exp="file1/10000" >crec.H
	Math file1=3000marm2Wffd.csou$*.perm.H exp="file1/10000" >csou.H
	${Prst_ExpRefl}/Tese/bin/nlin_srch.x \
	sou=csou.H \
	rec=crec.H \
	vel=3000marm_vel_smooth.2W.H \
	Velout=3000marm2W02ffd.invsc_vout$*.perm.H \
	grad_=3000marm2W02ffd.invsc_grad$*.perm.H \
	bimg=3000marm2W02ffd.invsc_bimg$*.perm.H \
	dimg=3000marm2W02ffd.invsc_dimg$*.perm.H \
	scale=scalegrad.H \
	par=3000marm2W02ffd.invsc.P \
	list=listagem_$*sc

3000marmig_opt11:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111_2W.H;echo o6=0 >> 11111_2W.H
	Window3d <3000marm2W02ffd.inv_vout11.perm.H n4=1 f4=12 squeeze=n|Pad extend=1 beg1=1000 end1=1000>vopt11.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=11111_2W.H rec=3000marm_data_prep.H  \
	vel=vopt11.H bkgimg=3000marm.bkim.vopt11.H \
	zmin=0 zmax=3000 nh=17 31 oh=-192 360 jh=1 migration=1 areal=0 \
	padtraces=50 traces_in_taper=50 node=14 extrapolator=ffd

3000marmig_opt35:
	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H;echo o1=-1.9 >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111_2W.H;echo o6=0 >> 11111_2W.H
	Window3d <3000marm2W02ffd.inv_vout35.perm.H n4=1 f4=9 squeeze=n|Pad extend=1 beg1=1000 end1=1000>vopt35.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=11111_2W.H rec=3000marm_data_prep.H  \
	vel=vopt35.H bkgimg=3000marm.bkim.vopt35.H \
	zmin=0 zmax=3000 nh=17 31 oh=-192 360 jh=1 migration=1 areal=0 \
	padtraces=50 traces_in_taper=50 node=14 extrapolator=ffd

rot.base.salt:
	Window3d <3000marm2Wffd.window.H n1=210 f1=0 f3=200 n4=1 f4=9  |Transp plane=13 | \
	${Prst_ExpRefl}/Tese/bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 nodes=14 nxchunk=1 | Pad beg3=0 end3=165 beg1=200 > 3000marm2W.salt.rot.sou.H
	Window3d <3000marm2Wffd.window.H n1=210 f1=0 f3=200 n4=1 f4=9  |Transp plane=13 | \
	${Prst_ExpRefl}/Tese/bin/OW_3dslant.x nax=41 nah=31 oax=-40 oah=-30 dax=2 dah=2 \
	nxw=31 rot=1 upshft=0 rec=1 nodes=14 nxchunk=1 | Pad beg3=0 end3=165 beg1=200 > 3000marm2W.salt.rot.rec.H

base.salt_perm%:
	Transp plane=13 < 3000marm2W.salt.rot.rec.H plane=13 > r1.H
	Transp plane=13 < 3000marm2W.salt.rot.sou.H plane=13 > s1.H
	Wavelet n1=1501 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=3. domain=time > j2.H;echo o1=-3. >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111.H
	${Tese}/bin/OW_arealsht.x rec_cig=r1.H sou_cig=s1.H sou=11111.H vel=3000marm_vel_smooth.2W.H \
	rec_out=3000marm.salt.crec$*.perm.H sou_out=3000marm.salt.csou$*.perm.H extrapolator=ffd \
	padtraces=101 encode=1 encz=1 eps=1 random=1 injection=1 nreal=1 ngap=$* zmin=1504 zmax=3000 node=14 

3000marm.salt_nl%: # 
	Math file1=3000marm.salt.crec$*.perm.H exp="file1/10000" >crec.H
	Math file1=3000marm.salt.csou$*.perm.H exp="file1/10000" >csou.H
	${Prst_ExpRefl}/Tese/bin/nlin_srch.x \
	sou=csou.H \
	rec=crec.H \
	vel=vopt11.H \
	Velout=3000marm.salt.inv_vout$*.perm.H \
	grad_=3000marm.salt.inv_grad$*.perm.H \
	bimg=3000marm.salt.inv_bimg$*.perm.H \
	dimg=3000marm.salt.inv_dimg$*.perm.H \
	par=3000marm.salt.inv.P \
	list=listagem_salt$*

marm.smooth:
	< 8000marmvel_24m.H Window3d min2=1000 max2=8000 | Gpow gpow=-1 |Transp plane=12 reshape=1,3 > v.H
	${Prst_ExpRefl}/Tese/bin/OW_spline.x vel=v.H vspl=$@.H dxk=480 nxk=16 oxk=0 dzk=160 nzk=20 ozk=0 nyk=1 dyk=1 oyk=0 node=14

marm.dslow:
	Math file1=8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 | Pad beg1=833 2000 end1=793 2000 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0| Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_2W.H
	Math file1=8000marmvel_24m.H exp="1/file1" > j1.H; < j1.H Window3d min2=0 max2=9000 | \
	Smooth rect1=48 rect2=16 > j2.H
	Math file1=j2.H exp="1/file1" | Transp plane=12 reshape=1,3 > 3000marm_vel_smooth2.H
	Math file1=3000marm_vel_2W.H exp="1/@ABS(file1)" | Window3d squeeze=n min1=0 max1=9000 |\
	${Prst_ExpRefl}/Tese/bin/OW_editvel_mut.x vvel=1 vsub=3000marm_vel_smooth2.H hor1=marmv0.orig > j1.H
	< j1.H ${Prst_ExpRefl}/Tese/bin/OW_editvel_mut.x vper=1 vperc=.9 hor1=marmv0.orig | Pad beg1=833 end1=793 extend=1 |\
	Window3d|Transp|Mute tmute=24 vmute=0 tramp=0 | Clip clip=1500 chop=less to=1500 | Transp plane=12 reshape=1,3> j.H
	Math file1=j.H exp="1/@ABS(file1)" > 3000marm_vel_smooth.2W.H
	Transp plane=12 reshape=1,3 < 8000marmvel_24m.H|Gpow gpow=-1 > j.H
	Math file1=j.H file2=3000marm_vel_smooth.2W.H exp=file1-file2 > $@.H

marm.dslo.shtp:
#	echo o6=0 >> 3000marm_data_prep.H
#	Wavelet n1=951 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=1.9 domain=time > j2.H
#	echo o1=-1.9 >> j2.H
#	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111_2W.H
#	echo o6=0 >> 11111_2W.H
##
#	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=11111_2W.H rec=3000marm_data_prep.H \
#	vel=3000marm_vel_smooth.2W.H bkgimg=4000marm.bimg.H zmin=0 zmax=3000 nh=17 oh=-192 migration=1 areal=0 \
#	padtraces=100 traces_in_taper=25 node=14 extrapolator=ffd
##
#	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=11111_2W.H rec=3000marm_data_prep.H \
#	vel=3000marm_vel_smooth.2W.H deltaS=marm.dslow.H zmin=0 zmax=3000 nh=17 oh=-192 migration=0 areal=0 \
#	padtraces=100 traces_in_taper=25 node=14 extrapolator=ffd adj=0 areal=0 \
#	ddws=square.bkgws.H ddwr=square.bkgwr.H ddwsz=square.scatws.H ddwrz=square.scatwr.H > 4000marm.dimg.H
#
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=11111_2W.H rec=3000marm_data_prep.H \
	vel=3000marm_vel_smooth.2W.H deltaI=4000marm.dimg.H \
	zmin=0 zmax=3000 nh=17 oh=-192 migration=0 areal=0 padtraces=100 traces_in_taper=25 node=14 \
	extrapolator=ffd adj=1 areal=0 > 4000marm.dslo.adj.H
#
	< 4000marm.bimg.H ${Prst_ExpRefl}/Tese/src/areal/wemvaop/OW_dso.x mdso=0 > 4000marm.dso.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=11111_2W.H rec=3000marm_data_prep.H \
	vel=3000marm_vel_smooth.2W.H deltaI=4000marm.dso.H \
	zmin=0 zmax=3000 nh=17 oh=-192 migration=0 areal=0 padtraces=100 traces_in_taper=25 node=14 \
	extrapolator=ffd adj=1 > 4000marm.dslo.dso.H

marm.dslo.ispew%:
	Window3d < 3000marm2Wffd.rot.sou.scale.H squeeze=n > s1.H
	Window3d < 3000marm2Wffd.rot.rec.scale.H squeeze=n > r1.H
	Wavelet n1=1501 d1=0.004 wavelet=ricker2 phase=0 fund=20 order=0.2 tdelay=3. domain=time > j2.H;echo o1=-3. >> j2.H
	<j2.H Transf f_min=0 f_min1=4 f_max1=40 f_max=48 wei=y is2d=y shotmig=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 > 11111.H
	${Tese}/bin/OW_arealsht.x rec_cig=r1.H sou_cig=s1.H sou=11111.H vel=3000marm_vel_smooth.2W.H \
	rec_out=3000marm.crec$*.permz0.H sou_out=3000marm.csou$*.permz0.H extrapolator=ffd \
	padtraces=101 encode=1 encz=1 eps=1 random=1 injection=1 nreal=1 ngap=$* zmin=0 zmax=3000 node=14 
#
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWmig2d_areal.x sou=3000marm.csou$*.permz0.H rec=3000marm.crec$*.permz0.H \
	vel=3000marm_vel_smooth.2W.H bkgimg=4000marm.bimg$*.perm.H zmin=0 zmax=3000 nh=17 oh=-192 migration=1 areal=1 \
	padtraces=0 traces_in_taper=25 node=14 extrapolator=ffd
##
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=3000marm.csou$*.permz0.H rec=3000marm.crec$*.permz0.H \
	vel=3000marm_vel_smooth.2W.H deltaS=marm.dslow.H zmin=0 zmax=3000 nh=17 oh=-192 jh=1 adj=0 areal=1 extrapolator=ffd \
	padtraces=0 traces_in_taper=25 node=14 \
	ddws=marm.bkgws$*.perm.H ddwr=marm.bkgwr$*.perm.H ddwsz=marm.scatws$*.perm.H ddwrz=marm.scatwr$*.perm.H > 4000marm.dimg$*.perm.H
#
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=3000marm.csou$*.permz0.H rec=3000marm.crec$*.permz0.H \
	vel=3000marm_vel_smooth.2W.H deltaI=4000marm.dimg$*.perm.H zmin=0 zmax=3000 nh=17 oh=-192 jh=1 adj=1 areal=1 extrapolator=ffd \
	padtraces=0 traces_in_taper=25 node=14 > 4000marm.dslo$*.perm.adj.H
#
	< 4000marm.bimg$*.perm.H ${Prst_ExpRefl}/Tese/src/areal/wemvaop/OW_dso.x mdso=0 > 4000marm.dso$*.perm.H
	${Prst_ExpRefl}/Tese/src/areal/wemvaop/OWwemva_opers.x sou=3000marm.csou$*.permz0.H rec=3000marm.crec$*.permz0.H \
	vel=3000marm_vel_smooth.2W.H deltaI=4000marm.dso$*.perm.H zmin=0 zmax=3000 nh=17 oh=-192 jh=1 adj=1 areal=1 extrapolator=ffd \
	padtraces=0 traces_in_taper=25 node=14 > 4000marm.dslo$*.perm.dso.H


#
#
#
#########################################


##########################################


regclean_%:
	@-touch $*; Rm $*; touch $*; \rm $*

clean : texclean 
	@-touch j.o j.mod j.x *.fix.f90; \rm *.o *.mod *.x *.fix.f90

include ${SEPINC}/SEP.bottom
