66
1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration o Chuck Ammon, PSU

1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

Embed Size (px)

Citation preview

Page 1: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

1

COMPUTER PROGRAMS IN SEISMOLOGY

An UpdateSeptember 26, 2007

Bob Herrmann, SLU

with assistance and inspiration ofChuck Ammon, PSU

Page 2: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

2

Outline

1. History2. Documentation and Tutorials3. Recent Uses4. Scripting5. Installation6. What's New7. Plans8. Research Needs9. User Needs

Page 3: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

3

1. History• 1975 – Spectral analysis, source

inversion, initial synthetics, punched cards

• 1985 – UNIX, minicomputers, implement synthetic seismogram algorithms, dispersion inversion

• 1996 – LINUX/UNIX – emphasis on simplified use

• 2007 -

Page 4: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

4

Platforms• LINUX

• Solaris

• CYGWIN (Windows 2K/XP) (full LINUX environment with X11 for Windows – with all tools, e.g., ImageMagick, latex, groff, compilers, python, perl etc for free!)

• MacOS-X

rdseed/evalresp/CPS all work!!!

Page 5: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

5

Why?• Need standard tools for routine

processing of large data sets

• Fewer programmers, and greater emphasis on canned techniques

• Need to quickly instill a modern skill set for student researchers

• Need to permit all researchers to work with modern digital data

Page 6: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

6

20 years of Computers

• Computers get faster

• Storage increases

• Write code that emphasizes clarity and reuse

Page 7: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

7

2. Documentation and Tutorials

• Documentation provides examples• Programs give on-line help:

– fmplot -h• Tutorials with scripts and data sets to

assist users

Page 8: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

8

• Wavenumber integration

• Surface waves• Generalized Ray• Asymptotic Ray

Theory• TI for omega-k

Page 9: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

9

• Waveform and spectral amplitude inversion

Page 10: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

10

• Procedures and computation of Green's functions

Page 11: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

11

• Dispersion measurements

• Receiver function determination

• Joint inversion

Page 12: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

12

• Complete graphics package in FORTRAN and in C

• X11/PostScript

Page 13: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

13

• Compatible with sac2000

• No SAC code• Written in C • Simple

organization• sac IO libraries

Page 14: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

14

• Processing scripts are up-to-date• Tutorials are close to up-to-date• PDF's need updating

Why? Data streams evolve as do processing techniques

Page 15: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

15

Tutorials• Determination of Receiver Functions• Inversion of Surface-Wave Dispersion and

Receiver Functions for Structure• Surface-Wave Synthetics and Group Velocity

Determination• Surface-Wave Synthetics and Phase Velocity

Determination• Phase velocity determination using a seismic

network and a real data set New SEP 25 2007!• SEED - Unpacking to SAC, Deconvolving and

Rotating• Cross-correlation of Ground Noise - Example for

southeastern Spain• Particle motion plots for focal mechanisms

Page 16: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

16

3. Recent Uses

• Source inversion• Group velocity tomography• Shallow seismic investigations

Page 17: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

17

Moment Tensor

• www.eas.slu.edu/Earthquake_Center/MomentTensor.html• North America

– Teleseisms– Korea– Europe– Middle East

Page 18: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

18

US Earthquakes: (red 2007)Focus in on non-CA earthquakes – > 200 events

Direction of maximum compressive axis and faulting style: red – normal, blue – thrust, green - strike-slip

Page 19: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

19

Page 20: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

20

Scripting Inversion Review

Page 21: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

21

Tomography ComparisonSLU Colorado

Regional earthquake data Greg Benson – noise studiesPercentage deviation about 3.2671 km/sec for 8 sec Love waves (2278 rays)

Page 22: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

22

Red: CUS model; black SLU EQ tomography: red Colorado noise tomography

Page 23: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

23

Red: CUS model; black SLU EQ tomography: red Colorado noise tomography

Page 24: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

24

Red: WUS model; black SLU EQ tomography: red Colorado noise tomography

Page 25: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

25

4. Scripting

• Organization is essential, especially if operations are to be repeated often, e.g., for source inversion

• Use SHELL scripts (bash is the default on LINUX/CYGWIN/MacOS-X)

• Comment everything in great detail

Page 26: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

26

Case Study – Source Inversion

Script for regional source inversion to• get waveforms• deconvolve instrument response• QC data for inversion• invert for source parameters• document as web page with all

graphics

Page 27: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

27

DO#!/bin/sh###### valid regions# REG Region FELTID VELOCITY_MODEL# HI Hawaii hi [Not implemented June 23, 2007]# AK Alaska ak CUS (in continent from Rockies -no deep)# CA California ca WUS# PNW Pacific Northwestrn pnw WUS# IMW Intermountain west imw WUS# CUS Central US cus CUS# NE Northeastern US ne CUS# ECAN Eastern Canada ous CUS (in continent from Rockies)# WCAN Western Canada ous [Not implemented June 23, 2007]###### Command syntax:#DOCWBREG YEAR MO DY HR MN SC MSC LAT LON DEP MAG REG NEIC FELTID#####DOCWBREG 2007 09 01 18 32 02 000 41.64 -112.33 1.0 3.7 IMW UU00007689 X7535_07

Actually a prototype for an automatic initiation of processing

Page 28: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

28

DOCWBREG (271 lines)

• Create Event Directory and sub-directories

• Populate with region processing scripts

• Get waveforms in SAC and responses in SAC pole-zero format

• then invert, and then

• create documentation page

Page 29: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

29

###### Now start all the processing#####cd ${MYPWD}/${DIR}/${DIR}CWBDOEVT###### form Z R T at the same time ensure that signal amplitudes# are absolutely bounded by 1.0e-10#####cd ${MYPWD}/${DIR}/${DIR}CWBDOROT###### Decimate the traces for surface-wave studies#####cd ${MYPWD}/${DIR}/${DIR}CWBDODEC###### for waveforms inversion select the distance range#####CWBDODIST###### QC for traces for waveform inversion#####CWBDOQC

Page 30: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

30

CWBDOEVTfor TRACE in *.SACdoKSTNM=`saclhdr -KSTNM $TRACE`KCMPNM=`saclhdr -KCMPNM $TRACE`DELTA=`saclhdr -DELTA $TRACE`FHH=`echo $DELTA | awk '{print 0.50/$1}' `FHL=`echo $DELTA | awk '{print 0.25/$1}' `DOY=`saclhdr -NZJDAY $TRACE`###### we will not rewrite the KNETWK and KHOLE in the headers with new values# we will just repeat the following steps in the script#####KNETWK=`saclhdr -KNETWK $TRACE`if [ ${KNETWK} == "-12345" ]then NET=""else NET=${KNETWK}fiKHOLE=`saclhdr -KHOLE $TRACE`if [ -z ${KHOLE} ]then LOC=""else if [ ${KHOLE} == "-12345" ] then LOC="" else LOC=${KHOLE} fifi

Note use of SHELL variables and program saclhdr

Use saclhdr to get header values

Clean up header

Page 31: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

31

###### fill in the headers with the event information# Also deconvolve to ground velocity in meters per sec# The CWB database has the gains in nanometers so# we will divide the deconvolved trace by a 1.0e+9## As a result the annotated (headers set) original trace will# be in ../GOOD as StationComponent.S# The deconvolved trace will be in ../GOOD as# StationComponent.sac######gsac << EOFr $TRACEch EVLA $LAT EVLO $LON EVDP $DEPch OCAL $YEAR $MO $DY $HR $MN $SEC $MSECch lovrok truech lcalda truewhrtr#### gsac comment###transfer from polezero subtype RESP.${KNETWK}.${KSTNM}.${LOC}.${KCMPNM} TO VEL \

FREQLIMITS 0.002 0.003 ${FHL} ${FHH}div 1.0e+9w ../${DEST}/${KSTNM}${KCMPNM}.${NET}.${LOC}.sacquitEOF

###### end deconvolve the trace#####done

Note use of calendar time instead of Julian time

The passband periods are stored in USER1

USER2

Page 32: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

32

Deconvolution with IRIS rdseed RESP files

for i in *.SACdoKSTNM=`saclhdr -KSTNM $i`KCMPNM=`saclhdr -KCMPNM $i`DELTA=`saclhdr -DELTA $i`DOY=`saclhdr -NZJDAY $i`FHH=`echo $DELTA | awk '{print 0.50/$i}' `FHL=`echo $DELTA | awk '{print 0.25/$i}' `###### we will not rewrite the KNETWK and KHOLE in the headers with new values# we will just repeat the following steps in the script#####KNETWK=`saclhdr -KNETWK $i`if [ "${KNETWK}" = "-12345" ]then NET=""else NET=${KNETWK}fiKHOLE=`saclhdr -KHOLE $i`if [ "${KHOLE}" = "-12345" ]then LOC=""else LOC=${KHOLE}fiDOY=`saclhdr -NZJDAY $i`cp RESP.${NET}.${KSTNM}.${LOC}.${KCMPNM} resp

Use sample rate to define Nyquist and deconvolution band

Page 33: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

33

Aside: Deconvolution with IRIS rdseed RESP files

evalresp ${KSTNM} ${KCMPNM} ${YEAR} ${DOY} 0.001 ${FHH} 2049 -u 'vel' -f respgsac << EOFr $ich EVLA $LAT EVLO $LON EVDP $DEPch OCAL $YEAR $MO $DY $HR $MN $SEC $MSECch lovrok truech lcalda truewhrtrtransfer from eval subtype AMP.${NET}.${KSTNM}.${LOC}.${KCMPNM} \ PHASE.${NET}.${KSTNM}.${LOC}.${KCMPNM} TO NONE FREQLIMITS 0.002 0.004 ${FHL} ${FHH}w ../${DEST}/${KSTNM}${KCMPNM}.${NET}.${LOC}.sacquitEOF

Note:• RESP used since I know units are counts/m/sec (IRIS SACPz is cts/m• File names are complete, e.g., F08ABHZ.TA..sac or F08ATABHR -

gsac << EOFr ${KSTNM}${C}?.${NET}.${LOC}.sacrotate3 to gcw ${KSTNM}${NET}${LOC}${C}R ${KSTNM}${NET}${LOC}${C}T ${KSTNM}${NET}${LOC}${C}ZquitEOF

Page 34: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

34

CWBDOROT###### high pass filter to get rid of low frequency noise#####export MODEL=${GREENDIR}/Models/AK135sph.modfor TRACE in *.sacdoGCARC=`saclhdr -GCARC $TRACE`EVDP=`saclhdr -EVDP $TRACE`DEPMAX=`saclhdr -DEPMAX $TRACE`DEPMIN=`saclhdr -DEPMIN $TRACE`A=`time96 -M ${MODEL} -P -GCARC ${GCARC} -EVDP ${EVDP}`T0=`time96 -M ${MODEL} -SH -GCARC ${GCARC} -EVDP ${EVDP}`#echo A $A T0 $T0

###### test the DEPMAX for valid amplitudes#####ANS=`echo $DEPMAX $MINAMP $MAXAMP | awk '{ if( $1 < $2) print "NO";else if($1 > $3) print "NO";else print "YES"}' `

if [ $ANS = "YES" ]then

gsac > /dev/null 2>&1 << EOFr $TRACEsynchronize ortrhp c ${FHIGH} np 2ch A ${A} T0 ${T0} T1 ${T0}whw TEMP/$TRACEquitEOF

fidone###### end of for TRACE#####

Use model to define P, S arrivals with time96

Set P S times for header

Reset reference time so can extract original time later

for documentation

Page 35: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

35

for i in *Z.*.sacdoif [ -f $i ]then echo $i

KSTNM=`saclhdr -KSTNM $i` KCMPNM=`saclhdr -KCMPNM $i` KNETWK=`saclhdr -KNETWK $i` case ${KCMPNM} in BHZ) C="BH" ;; HHZ) C="HH" ;; LHZ) C="LH" ;; esac###### safety if we do not have horizontals##### cp $i ../../${DEST}/${KSTNM}${NET}${LOC}${KCMPNM}###### now try to process the horizontals#####

gsac > /dev/null 2>&1 << EOFr ${KSTNM}${C}?.${NET}.${LOC}.sacrotate3 to gcw ${KSTNM}${NET}${LOC}${C}R ${KSTNM}${NET}${LOC}${C}T ${KSTNM}${NET}${LOC}${C}ZquitEOF

Page 36: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

36

rotate3?• Trace rotation in sac/sac2000 is a pain:

– set time marker

– synchronize

– write out

– cut

– re-read

– write out

• gsac – rotates in absolute time and outputs only the common time window

• gsac – automatically renames in terms of KSTNM, KCMPNM – do all 3 at once – no requirement for orthogonality

• gsac – one liner

Page 37: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

37

CWBDODIST

• Select stations within 500 km of the earthquake for regional source inversion. – For teleseisms, CWBDOGCARC selects

stations between 30 – 95 degrees

• Use awk and SHELL – no macros

Page 38: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

38

#!/bin/sh

###### place all traces at distances less than 500 km in the# DAT directory for waveform inversion of regional events# This assumes that the P arrival time is already set in the trace header#####DMIN=10.0DMAX=500.0###### create the DAT directory if it does not exist#####DEST=FINAL.QCif [ ! -d ${DEST} ]then mkdir ${DEST}fi

###### Go to the FINAL directory and use all data for distances <= 500 km#####

cd FINAL

for i in *[ZRT]doDIST=`saclhdr -DIST $i`ANS=`echo $DIST $DMIN $DMAX | awk '{if( $1 < $2)print "NO";else if($1 >$3)print "NO" ; else print "YES" }' `

if [ $ANS = "YES" ]thenecho $i $DIST $ANScp $i ../${DEST}fidone

Page 39: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

39

CWBDOQC

• Filter waveforms in manner used for inversion

• Quickly review all traces and click to indicate acceptability by the gsac command:– ppk q relative perplot 3– gsac sets a value in IHDR20 for wach

trace• After gsac QC, interrogate IHDR20

and move to work area:

Page 40: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

40

#!/bin/sh#set -x###### run test of bandbass filtered trace########### create the DAT.REG directory if it does not exist#####if [ ! -d ../DAT.REG ]then mkdir ../DAT.REGfi###### move to the directory for QC# then examine Z traces for P, T traces for SH and R traves for SV# Note the theoretical arrival times have already been placed into# the trace headers## we process these in the same manner as for the# waveform inversion but ONLY change the header#####cd FINAL.QC

gsac << EOF###### process all#####fileid namemarkt onxlim a -10 a 180r *sort up distrtrhp c 0.02 n 3lp c 0.10 n 3qdp 10

ppk q relative perplot 3whqEOF

Preview trace in same band used for inversion

Page 41: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

41

Mouse click sets + to indicate acceptance.IHDR20 is set positive.

This permits rapid evaluation of traces for inversion.

Note since the inversion code permits timeshifts within the window, the P time need only be approximate. So for speed, we do not manually pick the P- arrival but rather use AK135

Page 42: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

42

###### now move the selected traces to the processing area#####

for i in *[ZRT]do

IHDR20=`saclhdr -IHDR20 $i`ANS=`echo $IHDR20 | \ awk '{if( $1 < 1)print "NO";else if($1 >1)print "NO";else print "YES" }' `

if [ $ANS = "YES" ]then

echo $i $IHDR20 $ANScp $i ../../DAT.REG

fidone

Move selected traces

Page 43: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

43

Scripting

• Not tested on CYGWIN/MacOS-X– CYGWIN is Windows/MS-DOS –

commands and file system are case-insensitive. Thus no t.plt and t.Plt

– MacOS-X has similar historical artifacts

• Be careful when transferring scripts

Page 44: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

44

Frequently used programs• saccvt - convert byte order of SAC files.

NEVER mix byte orders on a platform (simpler code, FORTRAN code uses pure FORTRAN SACIO routines)

• saclhdr – list SAC header contents – used to created tables, SHELL variables

• convert (ImageMagick) – convert EPS to png for web/Word/PowerPoint

• modified rdseed

• wget

Page 45: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

45

Different Philosophy• Use modern tools

• Use the SHELL to do work rather than building into gsac

• Implement capabilities as required for effciency, e.g., ppk quality addendum to gsac

• Document and validate processing logic for implementation with other languages (rapid prototyping)

Page 46: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

46

5. Installation

http://www.eas.slu.edu/Earthquake_Center-> CPS 3.30

wget ftp://ftp.eas.slu.edu/pub/rbh/PROGRAMS.330/NP330

gunzip -c NP330.tgzcd PROGRAMS.330acroread CPSInstall.pdf

Change your PATH to point to PROGRAMS.330/bin

Page 47: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

47

Page 48: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

48

rbh> cd ~/PROGRAMS.310t/PROGRAMS.330

./Setup

Checking for existence of bin and lib directories

Directory bin exists

Directory lib exists

Usage: Setup SOL WIN32 SOL-EGCS LINUX LINUX64 CYGWIN OSX

SOL SUN Solaris Compilers

SOL-GNU SUN Solaris with gcc/g77 compilers

CYGWIN CYGWIN 98/NT/2K/XP gcc/g77 Compilers

CYGWIN40 CYGWIN 98/NT/2K/XP gcc/gfortran Compilers

LINUX Linux with gcc/g77 compilers

LINUX40 Linux with gcc/gfortran compilers

LINUX64 Linux 64 bit with gcc/g77 compilers

LINUX6440 Linux 64 bit with gcc/gfortran compilers

OSX Apple with gcc/g77 compilers

OSX40 Apple with gcc/gfortran compilers

OSF DEC/Compaq ALPHA cc/f77 compilers

rbh> ./Setup LINUX

rbh> ./C

FORTRAN is clean for gfortran – 72 column, no

tabs

Page 49: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

49

rbh@shallow:~/PROGRAMS.330> ls

bin/ CPSInstall.doc DOC/ readline-5.0/ VOLII/ VOLV/ XVIG/

C* CPSInstall.pdf include/ Setup* VOLIII/ VOLVI/

CALPLOT/ CPSTEST/ IRIS/ SUBS/ VOLIV/ VOLVII/

C.proto* Csrconly* lib/ VOLI/ VOLIX/ VOLVIII/

rbh@shallow:~/PROGRAMS.330>

bin directory will have 120 programs

Page 50: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

50

6. What's New?

www.eas.slu.edu/People/RBHerrmann/CPS/cpsbug.html

Introduction

The purpose of this page is to notify users of the Computer Program in Seismology (CPS) package of repairs or extensions made to the code. Whenever this page is updated, the down loadable version of CPS is updated at the download FTP site.

Enhancements to Version 3.30 code

August 30, 2007

* gsac - implemented two new commands in prs (plotrecordsection): ScaleRelative (SR) and ScaleAbsolute power (SA Power) to control the amplitude of the traces in the record section. ScaleRelative is the old behavior which just scales each trace to the same maximum amplitude (AMP value), except that the scaling now applies only to the actual trace window and not the whole trace. ScaleAbsolute 0.0 adjusts all traces to plot true amplitude. If the non-time axis is distance, then ScaleAbsolute 1.0 adjusts for geometrical spreading by multiplying all traces by distpower . For a true refracted arrival (e.g., with no velocity gradients), power=1.5 would show the refractions at the same level. The current gsac version is now[V1.1.21 30 AUG 2007]

* wvfgrd96 is not modified so that the output traces, e.g., TRACE.obs and TRACE.pre have the time shift applied. This means that if pltsac is used with the flag -USER9 the time shift will be displayed even though the traces align. The objective here is to present the observed and predicted in such a way to focus on amplitude and phase differences and not time shifts.

August 19, 2007

* gsac - modified the write command to support 'append suffix' and 'prepend prefix'. To illustrate the differences between sac2000, we will work in a subdirectory with the files located in the level above:

Page 51: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

51

rdseed

• Modification of error output• Modification of SAC pole-zero output• Name:

SAC_PZs_NM_SLM_BHZ__1997,037,14:00:00.0000SAC_PZs_NM_SLM_BHZ__1999,160,20:40:00.0000SAC_PZs_NM_SLM_HHZ__1997,037,14:00:00.0000SAC_PZs_NM_SLM_HHZ__1999,160,20:40:00.0000SAC_PZs_NM_SLM_LHZ__1997,037,14:00:00.0000SAC_PZs_NM_SLM_LHZ__1999,160,20:40:00.0000

Page 52: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

52

Pole-zero AnnotationSAC_PZs_NM_SLM_BHZ__1999,160,20:40:00.0000

* ***** STATION (KSTNM ): SLM* COMPONENT (KCMPNM): BHZ* LOCATION (KHOLE ):* NETWORK (KNETWK): NM* START : 1999,160,20:40:00.0000* END : No Ending Time* INPUT : METERS* OUTPUT : COUNTS* ****ZEROS 3POLES 5-0.0356 -0.0369-0.0356 0.0369-251.3300 0.0000-131.0400 -467.2900-131.0400 467.2900CONSTANT 3.638452e+16

Comment permitted:* space *UnitsFile name to track response history

Page 53: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

53

7. Plans

• TI for surface-wave synthetics and inversion

• Shallow seismic processing

Work in Progress• waveform inversion, e.g., wvfmtd96,

wvfmt96

Page 54: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

54

gsac• Written from scratch (1255 .f .c in sac/

97 .c in gsac - simpler)• Modular design for commands (94, even

outcsv for excel). One source file has two parts – parse typed command line– execute command

Because of this separation the execution parameters can be trivially created by a GUI, e.g.,

Page 55: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

55

GSAC - Computer Programs in Seismology [V1.1.21 30 AUG 2007]

GSAC> r SH/115[246]/*GSAC> refr

or refr Ex or refr Reg or Refr Tel

Page 56: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

56

Page 57: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

57

Page 58: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

58

Page 59: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

59

Page 60: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

60

• Joint inversion of dispersion and first arrival times for shallow exploration?

Page 61: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

61

Obviously, there is a prs (plot record section that is not a subprocess – too inconvenient). Other trivia:

• gsac keeps trace and FFT in memory, e.g., read trace fft plotsp plot plotsp is not possible in SAC

• All system commands permitted, except those with gsac command names

•GNU readline permits command line edit, as in bash SHELL

• GNU history (without line numbers for cut/paste/repeat)

Page 62: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

62

SUMMARY: BandPass filter traces

BandPass [options]

where options is one or more of the following:

[Butter | BEssel ] [ Corner fl fh] [ Npoles npoles ] [ Passes npass]

INPUT: Butter : Butterworth filter (default) BEssel : Bessel filter Corner : Corner frequencies (R) range 0 - Nyquist Npoles : Number of poles (I) range 1 - 10 Passes : Number of passes (I) range 1 - 2

DESCRIPTION: Highpass filter using a BI-LINEAR Z-transformation implementation of a highpass filter. A bi-linear method is chosen since this is easily implemented algebraically. Passes = 1 gives a causal filter while Passes = 2 gives a zero-phase filter with a 6db point at the corner frequency.

Note: shortcuts indicated by Upper case, e.g., BP, BE – documented command short-cuts

Indented

Page 63: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

63

8. Research Needs

• Practical Earth flattening• Stable free oscillation code to 1Hz• Documented code and tutorials for

other contributions• Improve current programs through

other algorithms• Redefinition of SAC header, e.g., A, T0

are currently offsets in REAL*4 – fails for long time series

Page 64: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

64

9. User Needs

• Help– Email: rbh @ eas.slu.edu– Tutorials

• Understandable codes

• Questions?

• This presentationftp://ftp.eas.slu.edu/pub/rbh/PROGRAMS.330/cpssep2007.ppt

Page 65: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

65

Thanks

• Users asking questions

• Jim Lewkowicz and Jessie Bonner of Weston Geophysical for supporting this presentation.

Page 66: 1 COMPUTER PROGRAMS IN SEISMOLOGY An Update September 26, 2007 Bob Herrmann, SLU with assistance and inspiration of Chuck Ammon, PSU

66

• Questions• Complaints• Needs