The script is given below. It is will commented. The only difference between this version and that for GMT Versions 5 and up is that DOSOLUTION is replaced by DOSOLUTION5.
#!/bin/bash
#####
# set up directory structure for an event that we get from the IRIS
#####
export MYPWD=`pwd`
#####
# test usage
#####
if [ $# -ne 15 ]
then
echo DOWSF YEAR MO DY HR MN SC MSC LAT LON DEP MAG REG NEIC FELTID STATE
echo DOWSF 2006 02 05 08 17 04 000 66.25 -143.02 18.60 5.1 CUS iuae Xiuae_06 Alaska
echo $*
exit 0
fi
#####
# define internal variables: the quotes are required since some fields can have
# blank spacing within"
#####
YEAR="${1}"
MO="${2}"
DY="${3}"
HR="${4}"
MN="${5}"
SEC="${6}"
MSEC="${7}"
LAT="${8}"
LON="${9}"
DEP="${10}"
MAG="${11}"
REG="${12}"
NEIC="${13}"
FELTID="${14}"
STATE="${15}"
#####
# now run three scripts that set up everything
# DOSETUP - sets up the directory structure for the inversion
# DOWSSETUP - sets up the directory structure for gettoing the waveforms and correctoing for response
# create the DOFINISH script which runs
# DOSOLUTION to obtain the moment tensor solution through the grid search
#####
cd ${MYPWD}
./DOSETUP "${YEAR}" "${MO}" "${DY}" "${HR}" "${MN}" "${SEC}" "${MSEC}" "${LAT}" "${LON}" "${DEP}" "${MAG}" "${REG}" "${NEIC}" "${FELTID}" "${STATE}" "${MYPWD}" > out 2>&1
cd ${MYPWD}
./DOWSSETUP "${YEAR}" "${MO}" "${DY}" "${HR}" "${MN}" "${SEC}" "${MSEC}" "${LAT}" "${LON}" "${DEP}" "${MAG}" "${REG}" "${NEIC}" "${FELTID}" "${STATE}" "${MYPWD}" > out 2>&1
#####
# create the processing file that
# does the deconvolution and solves for the solution
# after the binary data is installed
#####
DIR=${YEAR}${MO}${DY}${HR}${MN}${SEC}
echo " cd ${MYPWD}"
echo "1. enter the command:"
echo " DOFINISH"
#####
# create the command DOFINISH and make the script executable
#####
cat > DOFINISH << EOF
#!/bin/sh
export PATH=${MYPWD}/bin:$PATH
#####
# set up the event variables
#####
YEAR="${1}"
MO="${2}"
DY="${3}"
HR="${4}"
MN="${5}"
SEC="${6}"
MSEC="${7}"
LAT="${8}"
LON="${9}"
DEP="${10}"
MAG="${11}"
REG="${12}"
NEIC="${13}"
FELTID="${14}"
STATE="${15}"
if [ "${REG}" = "EU" ]
then
DEG=20
DURATION=600
else
DEG=6.0
DURATION=300
fi
export MYPWD="${MYPWD}"
#####
# deconvolve the instrument response, rotate, decimate, do qc
#####
cd ${MYPWD}/${DIR}/${DIR}
#####
# get the data
#####
mkdir Orig
cd Orig
START=\`redodate \$YEAR \$MO \$DY \$HR \$MN \$SEC \$MSEC -60 | \
awk '{printf "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d",\$1,\$2,\$3,\$4,\$5,\$6}' \`
END=\`redodate \$YEAR \$MO \$DY \$HR \$MN \$SEC \$MSEC \${DURATION} | \
awk '{printf "%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d",\$1,\$2,\$3,\$4,\$5,\$6}' \`
CCORD=\`echo \${LAT} \${LON} \${DEG} | awk '{printf "%f:%f:%f",\$1,\$2,\$3}' \`
FetchData -F -N '*' -S '*' -C 'BH*,HH*,HN*' -radius \${CCORD} -s \${START} -e \${END} -o BH.mseed -m BH.metadata -X BH.metaxml
for i in *BH.mseed
do
B=\`basename \$i "-BH.mseed"\`
java -jar ~/bin/stationxml-seed-converter-2.1.0.jar --input \${B}-BH.metaxml --output \${B}-BH.dataless
( cd ../Sac
rdseed -f ../Orig/\${B}-BH.mseed -g ../Orig/\${B}-BH.dataless -R -d -o 1
)
done
cd ${MYPWD}/${DIR}/${DIR}
#####
# deconvolve the instrument response
#####
IDOEVT
#####
# rotate to Z R T and ensure that hte signal amplitudes are
# greater than 1.0e-10
#####
cd ${MYPWD}/${DIR}/${DIR}
IDOROT
#####
# decimate for the surface wave analysis
#####
IDODEC
#####
# compute ML
#####
(cd ../ML.REG;DOML)&
#####
# select waveforms according to distance for waveform inversion
#####
IDODIST
#####
# perform QC for waveform inversion
#####
IDOQC
#####
# do the inversion
#####
cd ${MYPWD}
./DOSOLUTION "\${YEAR}" "\${MO}" "\${DY}" "\${HR}" "\${MN}" "\${SEC}" "\${MSEC}" "\${LAT}" "\${LON}" "\${DEP}" "\${MAG}" "\${REG}" "\${NEIC}" "\${FELTID}" "\${STATE}" "\${MYPWD}"
EOF
echo $DIR
chmod +x DOFINISH
Last changed May 21, 2022