The following bash script is used in down-hole surveys to form the various resorted data sets. These include both difference and sum of opposite source polarizations, for each individual component.
#!/bin/sh # $Id: Merge-all,v 1.1.1.1 2017/04/13 21:40:01 pm Exp $ # Merge-all: basic script to merge traces in all combinations # (sum or difference) by each component. # # Notation: component/location/sum or dif/ # Examples: # tddf=Tcomponent, down-hole, difference # trdf=Tcomponent, reference, difference # tdsm=Tcomponent, down-hole, sum # trsm=Tcomponent, reference, sum # # This combines all the shot gathers into receiver gathers for the different # geophone components in a down-hole survey. You should have run bhod first # to determine tool orientation, btor to insert orientations into headers, # and brot to rotate the data into a standard orientation. If you have, then # you can run this script. # # Copyright (c) 2017 Paul Michaels # <pm@cgiss.boisestate.edu> # This program is free software; you can # redistribute it and/or modify it under the terms # of the GNU General Public License as published # by the Free Software Foundation; either version # 2 of the License, or (at your option) any later # version. This program is distributed in the # hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU General Public # License for more details. # You should have received a copy of the GNU # General Public License along with this program; # if not, write to the Free Software Foundation, # Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #set -x #...define parameters YOU MUST DEFINE THESE FOR EACH NEW SURVEY # SINCE IT IS LIKELY THAT THE NUMBER OF RECORDS # WILL VARY WITH EACH SURVEY !!!! odmin=01 odmax=145 evmin=02 evmax=146 PRFX=L # eklmax=(odmax-1)/2 eklmax=`bc <<END ($odmax-1)/2 END` echo $eklmax # oklmax=eklmax+1 oklmax=`bc <<END ($eklmax+1) END` echo $oklmax #shaping filter parameters (bshp) tmin=0. tmax=0.1 npf=360 stab=.0001 #polarity file definitions az90=1 az270=2 #Scale Data by VERTICAL REF (ch4) (Absolute Scale from last, evmax) bscl brot$PRFX$evmax.seg 4 1 3 1>/dev/null AMP=`gawk '/Peak Absolute Value/ {print $4}' bsclbrot.lst` echo $AMP FILE=`find brot*seg | sed s/\.seg/''/g |sed s/brot/''/g` for i in $FILE; do bscl brot$i.seg 4 1 3 1>/dev/null mv bsclbrot.seg bscl$i.seg bscl bscl$i.seg 4 1 0 $AMP 1>/dev/null mv bsclbscl.seg bscl$i.seg done #...reference phone gathers (VERTICAL=ch4) bmrg bscl$PRFX $odmin $odmax 2 4 4 1>/dev/null mv bmrg.seg rfv1.seg bmrg bscl$PRFX $evmin $evmax 2 4 4 1>/dev/null mv bmrg.seg rfv2.seg #...reference phone gathers (RADIAL=ch5) bmrg bscl$PRFX $odmin $odmax 2 5 5 1>/dev/null mv bmrg.seg rfr1.seg bmrg bscl$PRFX $evmin $evmax 2 5 5 1>/dev/null mv bmrg.seg rfr2.seg #...reference phone gathers (TRANSVERSE=ch6) bmrg bscl$PRFX $odmin $odmax 2 6 6 1>/dev/null mv bmrg.seg rft1.seg bmrg bscl$PRFX $evmin $evmax 2 6 6 1>/dev/null mv bmrg.seg rft2.seg #...down hole swc phone gathers (TRANSVERSE=ch3) bmrg bscl$PRFX $odmin $odmax 2 3 3 1>/dev/null mv bmrg.seg swt1.seg bmrg bscl$PRFX $evmin $evmax 2 3 3 1>/dev/null mv bmrg.seg swt2.seg #...down hole swc phone gathers (RADIAL=ch2) bmrg bscl$PRFX $odmin $odmax 2 2 2 1>/dev/null mv bmrg.seg swr1.seg bmrg bscl$PRFX $evmin $evmax 2 2 2 1>/dev/null mv bmrg.seg swr2.seg #...down hole swc phone gathers (VERTICAL=ch1) bmrg bscl$PRFX $odmin $odmax 2 1 1 1>/dev/null mv bmrg.seg swv1.seg bmrg bscl$PRFX $evmin $evmax 2 1 1 1>/dev/null mv bmrg.seg swv2.seg #--------------------------------------------- # Notation: component/location/sum or dif/ # tddf=Tcomponent, down-hole, difference # trdf=Tcomponent, reference, difference # tdsm=Tcomponent, down-hole, sum # trsm=Tcomponent, reference, sum # #DIFFERENCE ENHANCEMENT # downhole (side wall clamping phone) bsum swt$az90.seg swt$az270.seg -1.0 mv bsumswt$az90.seg tddf.seg bsum swv$az90.seg swv$az270.seg -1.0 mv bsumswv$az90.seg vddf.seg bsum swr$az90.seg swr$az270.seg -1.0 mv bsumswr$az90.seg rddf.seg # reference phone at surface bsum rft$az90.seg rft$az270.seg -1.0 mv bsumrft$az90.seg trdf.seg bsum rfr$az90.seg rfr$az270.seg -1.0 mv bsumrfr$az90.seg rrdf.seg bsum rfv$az90.seg rfv$az270.seg -1.0 mv bsumrfv$az90.seg vrdf.seg #--------------------------------------------- #SUM ENHANCEMENT # downhole (side wall clamping phone) bsum swt$az90.seg swt$az270.seg +1.0 mv bsumswt$az90.seg tdsm.seg bsum swv$az90.seg swv$az270.seg +1.0 mv bsumswv$az90.seg vdsm.seg bsum swr$az90.seg swr$az270.seg +1.0 mv bsumswr$az90.seg rdsm.seg # reference phone at surface bsum rft$az90.seg rft$az270.seg +1.0 mv bsumrft$az90.seg trsm.seg bsum rfr$az90.seg rfr$az270.seg +1.0 mv bsumrfr$az90.seg rrsm.seg bsum rfv$az90.seg rfv$az270.seg +1.0 mv bsumrfv$az90.seg vrsm.seg #--------------------------------------------- #make links to alias names like Merge ln -s tddf.seg twav.seg ln -s trdf.seg tref.seg ln -s vdsm.seg pwav.seg ln -s vrsm.seg vref.seg #SH-WAVE SHAPING #...take last trace as a target bkil trdf.seg 1 1 1 $eklmax 1>/dev/null bstk bkiltrdf.seg 1>/dev/null bscl bstkbkil.seg 1 1 0 $oklmax.0 1>/dev/null mv bsclbstk.seg targ.seg #...determine shaping filters and apply to T-Reference rft*.seg bshp trdf.seg targ.seg 1 1 $tmin $tmax $npf $stab #...apply shaping filters to downhole T-data swt*.seg bshp trdf.seg targ.seg 1 0 $tmin $tmax $npf $stab tddf.seg mv bshptddf.seg twave.seg #--------------------------------------------- #P-WAVE SHAPING #...take last trace as a target bkil vrsm.seg 1 1 1 $eklmax 1>/dev/null bstk bkilvrsm.seg 1>/dev/null bscl bstkbkil.seg 1 1 0 $oklmax.0 1>/dev/null mv bsclbstk.seg varg.seg #...determine shaping filters and apply to V-Reference rfv*.seg bshp vrsm.seg varg.seg 1 1 $tmin $tmax $npf $stab #...apply shaping filters to downhole T-data swv*.seg bshp vrsm.seg varg.seg 1 0 $tmin $tmax $npf $stab vdsm.seg mv bshpvdsm.seg pwave.seg #--------------------------------------------- #...quick view of results bequ twave.seg 0 .25 bplt bequtwav.seg 3 0 0 1 500 0 .5 1 2 200 mv bplt.jpg twave.jpg #...quick view of results bequ pwave.seg 0 .025 bplt bequpwav.seg 3 0 0 1 500 0 .25 1 2 200 mv bplt.jpg pwave.jpg echo " " echo "-----------------------------------------" echo "| |" echo "|To display QC plots: |" echo "| |" echo "| SH-Wave (horizontal rotated data): |" echo "| |" echo "| display twave.jpg |" echo "| |" echo "| P-Wave (vertical component data): |" echo "| |" echo "| display pwave.jpg |" echo "| |" echo "-----------------------------------------"