#! /bin/bash # usage: raw2depth input-pathname output-pathname [EDEPTH] # Creates SEG-Y envelope files in time and depth from raw Knudsen sgy correlate files. # All files in the input directory with the .sgy suffix are converted. # ##### CHANGE PARAMETER EDEPTH FOR A DIFFERENT TERMINATION DEPTH #### # # input-directoy = the directory of Knudsen correlate files that end in .sgy # output-directoy = The directory of envelope and depth files. # (the output file names will be the input file name with env- and # depth-env- as a prefix). # [EDEPTH] is optional. EDEPTH is in meters. e.g. 6000 # If EDEPTH is NOT given the output will be 16000 meters sampled at 1m # EDEPTH also controls the sample interval. This is because SEG-Y permits # a maximum of 16383 samples. # # The output depth files will have permissions changed to read only. # # version 5 Feb 2009 - Paul Henkart # if [ "$#" != "2" ]; then if [ "$#" != "3" ]; then echo "***** raw2depth ERROR *****" echo "Usage: raw2depth input-directory output-directory [EDEPTH]" exit fi fi if [ "$1" == "$2" ]; then echo "***** raw2depth ERROR *****" echo "Do not use the same directory for output as input (it causes a loop)." exit fi dir_in="$1" dir_out="$2" declare OSI edepth ndone let OSI=1 edepth=16000 ndone=0 LINE=" " if [ "$#" == "3" ]; then LINE=" sdepth 0 edepth $3" edepth=$3 fi if [ $edepth -lt 8192 ]; then OSI=.5 fi if [ $edepth -lt 4096 ]; then OSI=.25 fi if [ $edepth -lt 2048 ]; then OSI=.125 fi cd "$dir_in" for x in *sgy ; do if [ $ndone == 0 ]; then cd "-" fi let ndone="1" extension=${x##*.} if [ $extension = sgy ]; then echo "reading correlate file: $dir_in/$x" echo "writing envelope (time) file: $dir_out/env-$x" echo "writing depth file: $dir_out/depth-env-$x" sioseis << eof noecho procs diskin header t2f f2t gains header2 filter diskob prout wbt avenor mix gains2 header3 t2d diskoa end diskin ipath $dir_in/$x end end header i120 = i58 ! save the original trace length fno 0 lno 9999999 ftr 0 ltr 999 end end header2 i58 = i120 ! restore the original trace length fno 0 lno 9999999 ftr 0 ltr 999 end end prout fno 0 lno 999999 noinc 500 end ! print every 500th trace end gains type 7 end ! complex modulus - make envelope from analytic end t2f end ! number of sample is the next power of two larger than the input end f2t type analytic end ! create the complex trace end filter ftype 0 pass 2 500 dbdrop 48 end end t2d $LINE osi $OSI vtp 1500 0 end end gains2 subwb yes type 5 alpha 5 end end avenor sets 0 .1 addwb yes end end wbt vel 1500 end end mix weight 1 1 end end header3 c30 'SIOSEIS processing: convert correlates to envelope, then to depth' c31 'header t2f f2t gains header2 filter prout wbt avenor mix gains2 t2d diskoa' c32 ' filter ftype 0 pass 2 500 dbdrop 48 end' c33 ' wbt vel 1500 end # convert water depth to time' c34 ' avenor sets 0 .1 addwb yes end' c35 ' mix weight 1 1 end' c36 ' gains2 subwb yes type 5 alpha 5 end # exponential gain from wb' c37 'Notes: ' c38 '1) The data sample interval is $OSI kilometers, thus other seismic' c39 ' packages should treat it like time.' c40 '2) The deep water delay has been removed - all data start at zero.' end end diskoa opath $dir_out/depth-env-$x end end diskob opath $dir_out/env-$x end end end eof chmod 444 $dir_out/env-$x chmod 444 $dir_out/depth-env-$x fi done