Inserting the PCA Results to the Trace Headers ( btor)

The next step is to copy the file bhod.lst (after any manual editing) back into the “seg” directory where the files L001.seg to L0146.seg are located. File bhod.lst will direct the processing of program btor. The command line help for btor includes the following:

btor -h


{btorlist}
 |---------------------------------|
 | Copyright (C) 2017  P. Michaels |
 |       All rights reserved       |
 |see GNU General Public License   |
 |---------------------------------|

 |------------------------------------------|
 | Basic Seismic Utilities     FORTRAN      |
 | ONLINE HELP:                             |
 |------------------------------------------|
 | btor: Applies azimuth and vertical angles|
 | to geophone trace headers (from a file)  |
 |------------------------------------------|

 btor lstfil, prfx, isw1 maxtr

 lstfil  =input list file name (ex. bhod.lst)
 prfx    =*.seg file prefix (one character)
 isw1    =up/down switch
       -1=apply to *.lst file and one less
       +1=apply to *.lst file and one more
        0=IF VERTICAL IMPACT source
 maxtr   =maximum number of traces in shot record
        6= 3 components down-hole, 3 ref-phone
        7= 3 down, 3 ref-phone, 1 load cell
btorlist


In our case, there are 6 channels per shot record (maxtr=6) and the file bhod.lst consists of odd file numbers (1,3,5,  odd). Thus, isw1=+1 so that the solution for file L001.seg will also be applied to L002.seg (2,4,6,  even). The prefix for the 4 character file names is “L”, and of course, the lstfil=bhod.lst. We can run btor with the following command:

btor bhod.lst  L  +1  6



If a load cell channel had been recorded from the hammer, the last argument would have been “maxtr=7”. In the case of these data, no load cell channel was recorded.

The result of the above btor run will be files with names btorL001.seg through btorL0146.seg. The next step is to copy these files over the original files named L001.seg throu L0146.seg. In the script directory of the distribution is a script file, rename-btor, which will do the job. The only parameter it requires is the file name prefix, “L”, in this particular case. The script may be run by typing

rename-btor L

or

rename-btor

and then be prompted for the prefix. This script is an excellent example of using the find and stream editor commands, and is as follows:

{renamelist}
#!/bin/sh
#Script to rename files after btor process
#overwrite pxxx.seg files, p=prefix
# Author: P. Michaels     Date:April 2002   $ee GNU License

if test "$1" = ”
   then
     echo 'Enter 1 character prefix'
     echo 'Example:  w'
     echo ' for files btorw001.seg, btorw002.seg, etc...'
     read PRFX
   else
     PRFX=$1
fi

 find -name "$PRFX*.seg" |  \
 sed s/'\.\/'/' '/g |       \
 gawk '{print "mv","btor"$1,$1}'   \
  >go-rename
chmod +x go-rename
./go-rename
echo "btor files renamed"
renamelist


Once the script has the prefix character, a find command is issued to get a list of the files L*.seg, and this is piped through sed editor to remove the leading “.” and “/” characters. The result is piped through gawk (the GNU version of awk) to construct move commands which are written to a file, go-rename, that file is made executable, and then executed.