# Kinematic hypocentre determination (minimum ray-theory travel times)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Input files required
 #chk.pl: "data/wb/" "wb2-mod.dat"
 #chk.pl: "data/wb/" "wb2-crt.dat"
 #chk.pl: "data/wb/" "wb2-srp.dat"
 #chk.pl: "crt/"     "codep.dat"
 #chk.pl: "crt/"     "writall.dat"
 #chk.pl: "forms/"   "loc0.cal"
 #chk.pl: "forms/"   "loc1.cal"
 #chk.pl: "forms/"   "loc2.cal"

# Velocity model
  MODEL='wb2-mod.dat'

# Parameters describing the inaccuracy of the velocity model
  POWERN=-0.12  # exponent describing the self-affine random medium
  TTERR1=0.062  # travel-time error at travel time TT=1s

# Data filenames for CRT
  DCRT='wb2-crt.dat'
  RPAR='wb2-crt.dat'
  CODE='codep.dat'      # direct P wave
  WRIT='writall.dat'    # writing all rays into output files

# Initial conditions for ray tracing
  INIPAR=-3             # ray parameters = azimuth. equidist. projection
  ADVANC=0.150          # point source replaced by a small sphere

# Temporary files for travel-time interpolation
  NUM='wb2-num.tmp'  MTT='wb2-mtt.tmp'  MGRD='wb2-mtt.tmp'

# Location grid
  N1=61       N2=61       N3=25
  O1=870.000  O2=990.000  O3=-12.000
  D1=0.500    D2=0.500    D3=0.500
# N1=121      N2=121      N3=49
# O1=870.000  O2=990.000  O3=-12.000
# D1=0.250    D2=0.250    D3=0.250
# N1=151      N2=151      N3=61
# O1=870.000  O2=990.000  O3=-12.000
# D1=0.200    D2=0.200    D3=0.200

# Plotting parameters
  UNIT='pt'  VCIRC=1.  VREF=0.  CREF=0.666667

# Calculation of gridded travel times
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# Generating files with coordinates of individual receivers
  SRP='wb2-srp.dat'
  srp:

# Generating files with gridded minimum travel times
  SRC='wb2-nkc.out'  CRTLOG='wb2-nkc0.out'  GRD='wb2-nkc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-cac.out'  CRTLOG='wb2-cac0.out'  GRD='wb2-cac1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-skc.out'  CRTLOG='wb2-skc0.out'  GRD='wb2-skc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-krc.out'  CRTLOG='wb2-krc0.out'  GRD='wb2-krc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-koc.out'  CRTLOG='wb2-koc0.out'  GRD='wb2-koc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-sbc.out'  CRTLOG='wb2-sbc0.out'  GRD='wb2-sbc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-zhc.out'  CRTLOG='wb2-zhc0.out'  GRD='wb2-zhc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-trc.out'  CRTLOG='wb2-trc0.out'  GRD='wb2-trc1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-vie.out'  CRTLOG='wb2-vie0.out'  GRD='wb2-vie1.out'
  crt:
  mtt:
  mgrd:
  SRC='wb2-lac.out'  CRTLOG='wb2-lac0.out'  GRD='wb2-lac1.out'
  crt:
  mtt:
  mgrd:

# Output files of program 'mgrd.for' contains gridded minimum travel
# time, gridded second travel time, etc.  Only the minimum travel
# times will be used for the location.  We thus have to reset N4
  N4=1

# Locations
# ~~~~~~~~~
  TREF=0

# Temporary files to accumulate the gridded quantities for location
  GRD2='wb2-a.tmp' GRD3='wb2-b.tmp' GRD4='wb2-c.tmp'

# Probability        Mean hypocen.time  Std.dev.hyp.time
  GRD5='wb2-w1.out'  GRD6='wb2-t1.out'  GRD7='wb2-e1.out'
  CAL='loc0.cal'                             grdcal:
  CAL='loc1.cal'
  T=29.856  TERR=0.004  GRD1='wb2-nkc1.out'  grdcal:
  T=30.168  TERR=0.004  GRD1='wb2-cac1.out'  grdcal:
  T=30.484  TERR=0.004  GRD1='wb2-skc1.out'  grdcal:
  T=30.856  TERR=0.004  GRD1='wb2-krc1.out'  grdcal:
  T=31.316  TERR=0.004  GRD1='wb2-koc1.out'  grdcal:
  T=31.472  TERR=0.004  GRD1='wb2-sbc1.out'  grdcal:
  T=32.132  TERR=0.004  GRD1='wb2-zhc1.out'  grdcal:
  T=32.432  TERR=0.008  GRD1='wb2-trc1.out'  grdcal:
  T=32.672  TERR=0.008  GRD1='wb2-vie1.out'  grdcal:
  T=32.720  TERR=0.004  GRD1='wb2-lac1.out'  grdcal:
  CAL='loc2.cal'                             grdcal:

  GRD5='wb2-w2.out'  GRD6='wb2-t2.out'  GRD7='wb2-e2.out'
  CAL='loc0.cal'                             grdcal:
  CAL='loc1.cal'
  T=44.748  TERR=0.004  GRD1='wb2-nkc1.out'  grdcal:
  T=45.100  TERR=0.004  GRD1='wb2-cac1.out'  grdcal:
  T=45.376  TERR=0.004  GRD1='wb2-skc1.out'  grdcal:
  T=45.804  TERR=0.004  GRD1='wb2-krc1.out'  grdcal:
  T=46.228  TERR=0.004  GRD1='wb2-koc1.out'  grdcal:
  T=46.372  TERR=0.004  GRD1='wb2-sbc1.out'  grdcal:
  T=47.036  TERR=0.004  GRD1='wb2-zhc1.out'  grdcal:
  T=47.352  TERR=0.008  GRD1='wb2-trc1.out'  grdcal:
  T=47.584  TERR=0.008  GRD1='wb2-vie1.out'  grdcal:
  T=47.656  TERR=0.004  GRD1='wb2-lac1.out'  grdcal:
  CAL='loc2.cal'                             grdcal:

  GRD5='wb2-w3.out'  GRD6='wb2-t3.out'  GRD7='wb2-e3.out'
  CAL='loc0.cal'                             grdcal:
  CAL='loc1.cal'
  T=59.512  TERR=0.004  GRD1='wb2-nkc1.out'  grdcal:
  T=59.812  TERR=0.004  GRD1='wb2-cac1.out'  grdcal:
  T=60.140  TERR=0.004  GRD1='wb2-skc1.out'  grdcal:
  T=60.484  TERR=0.004  GRD1='wb2-krc1.out'  grdcal:
  T=60.972  TERR=0.004  GRD1='wb2-koc1.out'  grdcal:
  T=61.108  TERR=0.004  GRD1='wb2-sbc1.out'  grdcal:
  T=61.768  TERR=0.004  GRD1='wb2-zhc1.out'  grdcal:
  T=62.072  TERR=0.008  GRD1='wb2-trc1.out'  grdcal:
  T=62.312  TERR=0.008  GRD1='wb2-vie1.out'  grdcal:
  T=62.340  TERR=0.004  GRD1='wb2-lac1.out'  grdcal:
  CAL='loc2.cal'                             grdcal:

  GRD5='wb2-w4.out'  GRD6='wb2-t4.out'  GRD7='wb2-e4.out'
  CAL='loc0.cal'                             grdcal:
  CAL='loc1.cal'
  T=21.060  TERR=0.004  GRD1='wb2-nkc1.out'  grdcal:
  T=21.292  TERR=0.004  GRD1='wb2-cac1.out'  grdcal:
  T=21.636  TERR=0.004  GRD1='wb2-skc1.out'  grdcal:
  T=22.292  TERR=0.004  GRD1='wb2-krc1.out'  grdcal:
  T=22.788  TERR=0.004  GRD1='wb2-koc1.out'  grdcal:
  T=22.672  TERR=0.004  GRD1='wb2-sbc1.out'  grdcal:
  CAL='loc2.cal'                             grdcal:

# Plotting
# ~~~~~~~~
# All horizontal slices
  NH=4  ROTATE=180.  HOFFSET=183
# NH=6  ROTATE=180.  HOFFSET=363
# NH=7  ROTATE=180.  HOFFSET=302
  GRD='wb2-w1.out'  PS='wb2-w1.ps'  grdps:
  GRD='wb2-w2.out'  PS='wb2-w2.ps'  grdps:
  GRD='wb2-w3.out'  PS='wb2-w3.ps'  grdps:
  GRD='wb2-w4.out'  PS='wb2-w4.ps'  grdps:
  NH=1

# Calculating maxima of the probability
  GNORM=999
  N1NEW=1  N2NEW=1  N3NEW=1
  GRD='wb2-w1.out'  GRDNEW='wb2-w10.out'  grdnorm:
  GRD='wb2-w2.out'  GRDNEW='wb2-w20.out'  grdnorm:
  GRD='wb2-w3.out'  GRDNEW='wb2-w30.out'  grdnorm:
  GRD='wb2-w4.out'  GRDNEW='wb2-w40.out'  grdnorm:
  N1NEW=   N2NEW=   N3NEW=

# Plotting maxima of the probability calculated along the X1 gridlines
  N1NEW=1  XSIGN=-1  ROTATE=90  HOFFSET=0
  GRD='wb2-w1.out'  GRDNEW='wb2-w11.out'  grdnorm:
  GRD='wb2-w2.out'  GRDNEW='wb2-w21.out'  grdnorm:
  GRD='wb2-w3.out'  GRDNEW='wb2-w31.out'  grdnorm:
  GRD='wb2-w4.out'  GRDNEW='wb2-w41.out'  grdnorm:
  N1NEW=   N1=1
  GRD='wb2-w11.out'  PS='wb2-w11.ps'  grdps:
  GRD='wb2-w21.out'  PS='wb2-w21.ps'  grdps:
  GRD='wb2-w31.out'  PS='wb2-w31.ps'  grdps:
  GRD='wb2-w41.out'  PS='wb2-w41.ps'  grdps:
  N1=61
# N1=121
# N1=151

# Plotting maxima of the probability calculated along the X2 gridlines
  N2NEW=1  XSIGN=-1  ROTATE=0  HOFFSET=0
  GRD='wb2-w1.out'  GRDNEW='wb2-w12.out'  grdnorm:
  GRD='wb2-w2.out'  GRDNEW='wb2-w22.out'  grdnorm:
  GRD='wb2-w3.out'  GRDNEW='wb2-w32.out'  grdnorm:
  GRD='wb2-w4.out'  GRDNEW='wb2-w42.out'  grdnorm:
  N2NEW=   N2=1
  GRD='wb2-w12.out'  PS='wb2-w12.ps'  grdps:
  GRD='wb2-w22.out'  PS='wb2-w22.ps'  grdps:
  GRD='wb2-w32.out'  PS='wb2-w32.ps'  grdps:
  GRD='wb2-w42.out'  PS='wb2-w42.ps'  grdps:
  N2=61
# N2=121
# N2=151

# Plotting maxima of the probability calculated along the X3 gridlines
  N3NEW=1  XSIGN=-1  ROTATE=180  HOFFSET=0
  GRD='wb2-w1.out'  GRDNEW='wb2-w13.out'  grdnorm:
  GRD='wb2-w2.out'  GRDNEW='wb2-w23.out'  grdnorm:
  GRD='wb2-w3.out'  GRDNEW='wb2-w33.out'  grdnorm:
  GRD='wb2-w4.out'  GRDNEW='wb2-w43.out'  grdnorm:
  N3NEW=   N3=1
  GRD='wb2-w13.out'  PS='wb2-w13.ps'  grdps:
  GRD='wb2-w23.out'  PS='wb2-w23.ps'  grdps:
  GRD='wb2-w33.out'  PS='wb2-w33.ps'  grdps:
  GRD='wb2-w43.out'  PS='wb2-w43.ps'  grdps:
  N3=25
# N3=49
# N3=61

