#!/bin/csh -f
#
#   Remember to run script "init" (sioseis-seisnet daemon)
#
#if( $#argv < 2 ) then
#    echo "Usage: stack line-name plot-direction(ltr/rtl)"
#    exit 1
#endif
set LINENO = $1
set DIR = "ltr"
#set DIR = $2

set OUTDIR = "/home/logadmin/output"
set LATEST = "latest_files.tmp"

#/export/home/phenkart/bin/sioseis << eof
sioseis << eof
  
procs segddin prout geom wbt gather nmo stack diskoa avenor filter plot end

segddin
   ftr 1 ltr 468
   fcset 2 lcset 2
   secs 10
   stack $LATEST
   logpath ./$LINENO-stack.log
   end
end

prout
 fno 0 lno 9999999 ftr 468 ltr 468 noinc 10  end
end

geom
  type 9 # Use realtime GPS
  fs 1 ls 999999  # all shot have the same parameters (preset)
  gxp 468 -250   # RESET the closest group only.
  ggx -12.5         # Used to extrapolate gxp!
# dfls 37.5   # ignored with type 9 
  dbrps 6.25
  rpadd 1000 end
end

wbt
    vel 1500 track .1 end
end

gather
   maxtrs 78  maxrps 480 END
end

nmo
# real time nmo, replace interpolation by RP to WB depth in Meters.
# If water depth changes by > 500 m, use previous value. Water-depth
# velocity functions derived from ESP5, interpolation by iso-velocity layering
 vtrkwb 500 stretc 1.50

fno 10 lno 10
vtp 1500 0.013 
 1700 0.884 
 2171 1.312 
 2486 1.687 
 3092 2.208 
 5733 8.588 
 6556 13.088 end
   
fno 500 lno 500
vtp 1500 0.667 
 1630 1.549 
 1977 1.978 
 2238 2.353 
 2775 2.873 
 5673 8.391 
 6788 13.391 end
   
fno 1000 lno 1000
vtp 1500 1.333 
 1564 2.216 
 1761 2.644 
 1932 3.019 
 2089 3.332 
 5413 7.470 
 7181 13.470 end
   
fno 2000 lno 2000
vtp 1500 2.667 
 1521 3.549 
 1593 3.978 
 1664 4.353 
 1734 4.665 
 4410 7.769 
 7122 14.269 end
   
fno 2500 lno 2500
vtp 1500 3.333 
 1502 3.627 
 1521 3.885 
 1546 4.135 
 1555 4.260 
 3312 6.329 
 7244 13.829 end
   
fno 3000 lno 3000
vtp 1500 4.000 
 1501 4.294 
 1504 4.408 
 1505 4.483 
 1564 4.858 
 2900 6.551 
 7064 14.051 end
end

diskoa   # Write out disk file
  opath $OUTDIR/$LINENO-stack.segy
end end

avenor
  hold 300
  addwb yes sets 0 .5 5 6 end
end


filter
  pass 5 90 ftype 0 dbdrop 48 end
end

plot 
  dir $DIR
  scalar -1
  tlines 0.5 1 nibs 7225 ann gmtint anninc 5 ann2 shotno
  def 0.04 trpin 125 wiggle 0 
  vscale 1.25 clip .03
  opath $OUTDIR/$LINENO-stack.atlantek
  end 
end

end
eof