Introduction

The purpose of this section is to introduce the idea of a pseudo-time history for the permanent deformation. In reality the displacement at a site is zero until the first P-wave arrives. After this there is a sequence of P-, S- and surface-wave arrivals, after which there is the permanent deformation.  There is no simple way to indicate when the ground displacement settles down to the final static offset.

As a working hypothesis we can assume that the static deformation occurs at the time of the first S arrival. We thus have the problem of making a time series that is a step function that starts at the
S-travel time following the origin time.  Fortunately this can easily be done using gsac.

Given a Sac file with just one point, as is created by hstat96 and hsanal96, and which does not have values set for the A, T0, T2 ... markers, and for which the "origin time" O=0, and the epoch time is the same, then the following commands will display the trick (GSAC> is the gsac prompt):

DELTA=`saclhdr -DELTA sacfile` 	#get the sample interval - this is not needed since it is 1.0 for the output of the two programs
#now run gsac
- Also assume that we want to shift by TSHIFT=TS + TRUP, e.g., the time of the
#initiation of the subfault and then the S travel time from the patch to the station

GSAC> cuterr fillz
GSAC> cut o o 200 #GSAC does not use blackboard variables, but can use previously defined SHELL variables
GSAC> r sacfile
GSAC> lh depmax depmin
GSAC> div ${DELTA}
GSAC> shift ${TSHIFT}
GSAC> int
GSAC> lh depmax depmin GSAC> p

The result will be a time series with a step-like function that starts at the appropriate time and which also has the same peak amplitude as the original single point time series. This can be seen by executing the listheader commands shown in blue.

Test case

We wish to test the assumption that the S-wave first-arrival time is an acceptable proxy for when the displacement has reached the static value. The answer is that in the two cases considered, it is.
The other aspect is that the script using the hspec96 Green functions shows how to make regional synthetics for a finite fault source.

On my computer the environment variable GREENDIR points to a specific directory that contains the velocity models and Green functions for those models, e.g.,

rbh> echo $GREENDIR 
/d/rbh/GREEN

Within that directory there will be model file  /d/rbh/GREEN/Models/WUS.mod  which I can access as ${GREENDIR}/Models/WUS.mod, and a directory of Green functions ${GREENDIR}/WUS.REG. Within that directory are subdirecties with names such as 0230, for a source depth of 23.0 km, a control file ${GREENDIR}/WUS.REG/D.CTL which has two entries per line consisting of the depth in km and the corresponding directory name, e.g.,

  0.5 0005
1.0 0010
2.0 0020
3.0 0030
Finally within each depth directory are the Green functions as a function of distance and W.CTL file looks like

rbh> head 0230/W.CTL
1 0.25 512 -4.875 0 0230 000100230
2 0.25 512 -4.75 0 0230 000200230
3 0.25 512 -4.625 0 0230 000300230
4 0.25 512 -4.5 0 0230 000400230
5 0.25 512 -4.375 0 0230 000500230
6 0.25 512 -4.25 0 0230 000600230
7 0.25 512 -4.125 0 0230 000700230
8 0.25 512 -4 0 0230 000800230

This means that I I want the TSS Green function for a depth of 23.0 km and a distance of 8.0 km, I would actually want
${GREENDIR}/WUS.REG/0230/000800230.TSS
The gsac mt command just needs the argument FILE ${GREENDIR}/WUS.REG/0230/000800230 to make a synthetic.

The script for the hspec96 waveform stacks the velocities and the script for the pseudo static time history just stacks the raw impulses (after dividing by delta=1.0). To compare the displacement series we must integrate both. The following commands are used to make the next figures. Note that there is a multiplication by a factor of 100 to convert meters to centimeters and that there is an integration to make the displacement time series. The individual components are overlain.

The processing script below uses the NEIC finite fault solution which had fault patches at depths from 38 to 115 km. A second comparison uses the same finite fault file, but reduces the depths by subtracting 45 from all depths to simulate a shallow finite fault. This was done to examine the influence of the Rayleigh wave on the time offset assumptions:




#!/bin/sh

gsac << EOF
cuterr fillz
cut o 0 200
bg plt
fileid name
r DYNAMIC_ORIGINAL/FINITE_3/FINAL*Z/* STATIC_ORIG_SHAL/FIN3_ORIGINAL/FINAL?/*Z
# turn off the phase times
ch a -12345 t0 -12345 t1 -12345
# convert to cm
mul 100
int
color list red blue
p overlay on
r DYNAMIC_ORIGINAL/FINITE_3/FINAL*N/* STATIC_ORIG_SHAL/FIN3_ORIGINAL/FINAL?/*N
# turn off the phase times
ch a -12345 t0 -12345 t1 -12345
# convert to cm
mul 100
int
color list red blue
p overlay on
r DYNAMIC_ORIGINAL/FINITE_3/FINAL*E/* STATIC_ORIG_SHAL/FIN3_ORIGINAL/FINAL?/*E
# turn off the phase times
ch a -12345 t0 -12345 t1 -12345
# convert to cm
mul 100
int
color list red blue
p overlay on
q
EOF

for i in 001 002 003
do
plotnps -F7 -W10 -EPS -K < P$i.PLT > t.eps
convert t.eps Orig_P$i.png
mv P$i.PLT Orig_P$i.PLT
done

Comparison of True to Pseudo Displacement Time History

Original NEIC Finite Fault Model

In these figures, the red curve is the result of summing the individual complete seismograms which the blue curve shows the effect of delaying and adding the static deformations. It seems as if there is a correspondence between the time that the pseudo time-series converges and when the actual ground displacement stabilizes.

Vertical
North
East
Original Z
Original N
Original E


Modified Model for Shallow Fault

This set of figures was created by subtracting 35 km from all subfault depths given in the NEIC model.

Vertical
North
East
Shallow Z
Shallow N
Shallow E

Again it seems as if the use of the first-arriving S-wave for a time shift is reasonable. This is the first real test of the suitability of using hspec96 for determining static displacements. The agreement is surprisingly good, but I know that more work must be done in this program to ensure a robust determination of static offset, which of course means more testing.

Comparison of scripts

Rather than add additional comments, I will use bold RED to indicate the significant differences. The real difference is that the script on the left must compute the response while the one on the right finds a pre-existing synthetic.  If we had used the hprpe96, hspec96 hpusle96 sequence on the left we would have computed complete time histories and obtained the same results.

hstat96 - Pseudo Time History
hspec96 - Complete Time History
#!/bin/sh

#####
#    define the bounds on the gridded area and also the
#    grid interval
#####"
LATMIN="28.0"
LATMAX="28.0"
DLAT="0.25"

LONMIN="62.0"
LONMAX="62.0"
DLON="0.25"

#####
#    define control variables for the loop
#####
ENDLATLOOP="NO"
ENDLONLOOT="NO"

#####
#    define initial values
#####
LAT=${LATMIN}
LON=${LONMIN}

#####
#    define the velocity model
#####

MODEL="${GREENDIR}/WUS.mod"

#####
#    define TOPLEVEL directory
#####
MYTOP=`pwd`

#####
#    define the finite fault model
#####

cat > static2_out << EOF
#Total number of fault_segments=     1
#Fault_segment =   1 nx(Along-strike)=  14 Dx=  7.00km ny(downdip)=  12 Dy=  7.00km
#Boundary of Fault_segment     1. EQ in cell 8,8. Lon: 62.0532   Lat: 28.1069
#Lon.  Lat.  Depth
       62.62570       28.22120       36.64660
       61.85480       27.67950       36.64660
       61.60110       27.96040      108.96690
       62.37200       28.50210      108.96690
       62.62570       28.22120       36.64660
#Lat. Lon. depth slip rake strike dip t_rup h_dur mo
      28.218100      62.610200      37.872300      32.892190     210.228390     231.460010      61.110000      33.200000       3.400000   7.994117e+24
      28.178900      62.554300      37.872300      26.133590     213.971100     231.460010      61.110000      31.400000       4.000000   6.351509e+24
      28.139600      62.498500      37.872300       0.378610     255.360600     231.460010      61.110000      28.400000       2.600000   9.201650e+22
      28.100300      62.442600      37.872300       0.271620     283.392210     231.460010      61.110000      26.200000       3.200000   6.601493e+22
      28.061100      62.386700      37.872300       0.487170     267.694490     231.460010      61.110000      23.000000       3.400000   1.184024e+23
      28.021900      62.330900      37.872300       4.512600     214.114200     231.460010      61.110000      21.200000       3.400000   1.096743e+24
      27.982600      62.275000      37.872300       0.054630     245.378800     231.460010      61.110000      19.600000       3.600000   1.327731e+22
      27.943400      62.219200      37.872300       0.359760     239.659100     231.460010      61.110000      19.000000       3.000000   8.743530e+22
      27.904100      62.163300      37.872300       0.819340     260.363890     231.460010      61.110000      20.800000       3.000000   1.991322e+23
      27.864900      62.107400      37.872300       6.014880     268.909300     231.460010      61.110000      21.600000       2.400000   1.461857e+24
      27.825600      62.051600      37.872300       7.808980     263.208800     231.460010      61.110000      24.600000       4.200000   1.897894e+24
      27.786400      61.995700      37.872300      69.880770     211.684100     231.460010      61.110000      27.600000       4.400000   1.698382e+25
      27.747100      61.939900      37.872300     152.146300     213.129500     231.460010      61.110000      28.800000       5.400000   3.697763e+25
      27.707900      61.884000      37.872300     149.289790     215.029500     231.460010      61.110000      32.200000       3.800000   3.628339e+25
      28.241900      62.588700      44.001200      22.606470     254.847600     231.460010      61.110000      30.800000       3.800000   7.083550e+24
      28.202700      62.532800      44.001200       2.119850     247.519300     231.460010      61.110000      27.800000       4.600000   6.642373e+23
      28.163400      62.477000      44.001200       0.297780     221.859890     231.460010      61.110000      25.200000       2.400000   9.330823e+22
      28.124200      62.421100      44.001200       1.529620     251.172390     231.460010      61.110000      21.800000       3.000000   4.792937e+23
      28.084900      62.365200      44.001200       7.235110     236.188100     231.460010      61.110000      20.800000       3.200000   2.267062e+24
      28.045700      62.309400      44.001200       8.471940     255.018010     231.460010      61.110000      17.400000       2.400000   2.654612e+24
      28.006400      62.253500      44.001200      51.855940     259.450010     231.460010      61.110000      16.400000       2.200000   1.624862e+25
      27.967200      62.197700      44.001200      49.460580     277.934810     231.460010      61.110000      16.800000       3.000000   1.549806e+25
      27.927900      62.141800      44.001200       5.419170     213.520290     231.460010      61.110000      17.000000       3.000000   1.698052e+24
      27.888700      62.085900      44.001200       3.837110     255.061100     231.460010      61.110000      19.800000       4.400000   1.202326e+24
      27.849400      62.030100      44.001200       2.201740     242.065200     231.460010      61.110000      20.600000       2.400000   6.898966e+23
      27.810200      61.974200      44.001200      55.149570     221.783490     231.460010      61.110000      24.400000       4.400000   1.728065e+25
      27.770900      61.918400      44.001200     128.604400     213.373200     231.460010      61.110000      26.800000       4.400000   4.029712e+25
      27.731700      61.862500      44.001200     151.452000     210.301800     231.460010      61.110000      28.200000       5.400000   4.745621e+25
      28.265700      62.567200      50.130000       4.530330     264.110110     231.460010      61.110000      28.400000       4.200000   1.499164e+24
      28.226500      62.511300      50.130000       2.649400     247.963000     231.460010      61.110000      25.200000       2.600000   8.767319e+23
      28.187200      62.455500      50.130000      14.969710     251.381100     231.460010      61.110000      22.000000       2.400000   4.953733e+24
      28.148000      62.399600      50.130000      10.491010     268.782010     231.460010      61.110000      18.800000       2.400000   3.471654e+24
      28.108700      62.343700      50.130000      73.365500     240.725400     231.460010      61.110000      16.200000       4.800000   2.427789e+25
      28.069500      62.287900      50.130000     142.354200     258.077610     231.460010      61.110000      15.400000       3.800000   4.710744e+25
      28.030200      62.232000      50.130000     159.408400     258.796600     231.460010      61.110000      13.200000       4.000000   5.275095e+25
      27.991000      62.176200      50.130000     150.119600     270.854400     231.460010      61.110000      12.800000       2.400000   4.967715e+25
      27.951700      62.120300      50.130000      51.833320     268.783600     231.460010      61.110000      13.800000       3.000000   1.715253e+25
      27.912500      62.064400      50.130000      27.987930     268.758000     231.460010      61.110000      16.400000       3.800000   9.261682e+24
      27.873200      62.008600      50.130000      53.615780     286.815400     231.460010      61.110000      17.400000       4.000000   1.774238e+25
      27.834000      61.952700      50.130000      58.043200     285.933110     231.460010      61.110000      20.000000       3.000000   1.920748e+25
      27.794700      61.896900      50.130000      15.560400     247.248600     231.460010      61.110000      22.800000       2.400000   5.149200e+24
      27.755500      61.841000      50.130000      56.564990     221.178210     231.460010      61.110000      26.600000       4.000000   1.871832e+25
      28.289500      62.545700      56.258900       0.535510     248.583690     231.460010      61.110000      26.000000       3.800000   1.772104e+23
      28.250300      62.489800      56.258900       0.492050     228.388310     231.460010      61.110000      22.800000       3.800000   1.628287e+23
      28.211000      62.434000      56.258900      32.724030     242.349790     231.460010      61.110000      19.200000       3.400000   1.082894e+25
      28.171800      62.378100      56.258900      83.106200     251.551900     231.460010      61.110000      17.400000       3.400000   2.750125e+25
      28.132500      62.322200      56.258900     189.516300     250.577500     231.460010      61.110000      13.200000       2.400000   6.271416e+25
      28.093300      62.266400      56.258900     324.978910     256.584200     231.460010      61.110000      11.400000       2.400000   1.075410e+26
      28.054000      62.210500      56.258900     356.779390     255.187700     231.460010      61.110000      10.000000       2.400000   1.180644e+26
      28.014800      62.154700      56.258900     325.681300     260.263890     231.460010      61.110000       9.600000       2.400000   1.077735e+26
      27.975500      62.098800      56.258900     198.344800     261.329500     231.460010      61.110000      10.400000       2.800000   6.563567e+25
      27.936300      62.042900      56.258900     113.726700     273.064790     231.460010      61.110000      13.200000       4.000000   3.763409e+25
      27.897000      61.987100      56.258900     106.637600     288.630710     231.460010      61.110000      15.600000       4.400000   3.528819e+25
      27.857800      61.931200      56.258900     116.412600     287.598600     231.460010      61.110000      18.400000       3.800000   3.852292e+25
      27.818500      61.875400      56.258900      70.925380     288.786900     231.460010      61.110000      20.200000       3.200000   2.347042e+25
      27.779300      61.819500      56.258900      43.106050     287.997590     231.460010      61.110000      22.000000       2.400000   1.426453e+25
      28.313300      62.524200      62.387700       2.934820     252.381390     231.460010      61.110000      22.200000       2.400000   9.711830e+23
      28.274100      62.468300      62.387700       4.968770     283.197910     231.460010      61.110000      20.400000       3.200000   1.644250e+24
      28.234800      62.412500      62.387700      46.202920     274.951810     231.460010      61.110000      16.200000       2.400000   1.528933e+25
      28.195600      62.356600      62.387700     170.870410     251.076400     231.460010      61.110000      13.400000       2.400000   5.654392e+25
      28.156300      62.300700      62.387700     282.176700     245.795900     231.460010      61.110000      11.000000       2.400000   9.337704e+25
      28.117100      62.244900      62.387700     401.651610     249.109600     231.460010      61.110000       8.800000       4.400000   1.329134e+26
      28.077800      62.189000      62.387700     433.329410     250.572200     231.460010      61.110000       7.400000       2.800000   1.433960e+26
      28.038600      62.133200      62.387700     393.998810     254.099000     231.460010      61.110000       6.800000       2.400000   1.303809e+26
      27.999300      62.077300      62.387700     306.459500     257.955690     231.460010      61.110000       7.400000       2.400000   1.014127e+26
      27.960100      62.021400      62.387700     206.576510     262.989110     231.460010      61.110000       9.400001       5.000000   6.835968e+25
      27.920800      61.965600      62.387700     157.121200     274.246800     231.460010      61.110000      12.800000       3.400000   5.199408e+25
      27.881600      61.909700      62.387700     153.499690     275.781010     231.460010      61.110000      15.200000       3.800000   5.079567e+25
      27.842300      61.853900      62.387700     108.558200     285.134800     231.460010      61.110000      16.800000       2.400000   3.592377e+25
      27.803100      61.798000      62.387700      46.251880     286.540590     231.460010      61.110000      19.400000       3.000000   1.530553e+25
      28.337100      62.502700      68.516500       9.300190     265.807100     231.460010      61.110000      20.000000       2.400000   3.077592e+24
      28.297900      62.446800      68.516500      25.211800     253.313000     231.460010      61.110000      17.800000       3.000000   8.343013e+24
      28.258600      62.391000      68.516500      85.873110     250.889890     231.460010      61.110000      15.400000       3.800000   2.841688e+25
      28.219400      62.335100      68.516500     186.283100     247.663890     231.460010      61.110000      11.400000       2.400000   6.164426e+25
      28.180100      62.279300      68.516500     274.027100     243.564000     231.460010      61.110000       8.600000       4.800000   9.068021e+25
      28.140900      62.223400      68.516500     390.263610     242.516300     231.460010      61.110000       6.400000       5.400000   1.291449e+26
      28.101600      62.167500      68.516500     436.490690     242.766490     231.460010      61.110000       4.800000       2.400000   1.444422e+26
      28.062400      62.111700      68.516500     428.757510     246.774400     231.460010      61.110000       4.000000       2.400000   1.418831e+26
      28.023100      62.055800      68.516500     345.800990     253.678410     231.460010      61.110000       4.800000       2.400000   1.144314e+26
      27.983900      61.999900      68.516500     240.714000     257.735600     231.460010      61.110000       8.000000       3.800000   7.965638e+25
      27.944600      61.944100      68.516500     162.880600     260.772490     231.460010      61.110000       9.400001       4.400000   5.389998e+25
      27.905400      61.888200      68.516500     148.647510     269.645810     231.460010      61.110000      13.400000       3.400000   4.919000e+25
      27.866100      61.832400      68.516500      89.934330     265.667390     231.460010      61.110000      14.800000       2.400000   2.976080e+25
      27.826900      61.776500      68.516500      51.094400     283.599910     231.460010      61.110000      17.600000       2.800000   1.690801e+25
      28.360900      62.481200      74.645400      20.577690     265.335390     231.460010      61.110000      19.400000       2.200000   6.809507e+24
      28.321700      62.425300      74.645400      31.631030     246.478000     231.460010      61.110000      16.600000       3.600000   1.046724e+25
      28.282400      62.369500      74.645400      69.330800     234.520400     231.460010      61.110000      13.400000       2.400000   2.294274e+25
      28.243200      62.313600      74.645400     141.466290     235.261000     231.460010      61.110000      10.800000       2.800000   4.681361e+25
      28.203900      62.257800      74.645400     213.153900     240.296800     231.460010      61.110000       7.600000       2.400000   7.053625e+25
      28.164700      62.201900      74.645400     298.338010     237.639690     231.460010      61.110000       4.800000       4.000000   9.872511e+25
      28.125400      62.146000      74.645400     387.448610     239.173600     231.460010      61.110000       2.200000       2.400000   1.282133e+26
      28.086200      62.090200      74.645400     383.663790     241.469100     231.460010      61.110000       1.400000       2.400000   1.269609e+26
      28.046900      62.034300      74.645400     335.844300     254.890110     231.460010      61.110000       3.000000       2.400000   1.111366e+26
      28.007700      61.978400      74.645400     260.581600     264.116700     231.460010      61.110000       5.200000       2.400000   8.623091e+25
      27.968400      61.922600      74.645400     174.139690     255.296400     231.460010      61.110000       9.200000       3.800000   5.762580e+25
      27.929200      61.866700      74.645400     121.296000     262.509800     231.460010      61.110000      12.400000       3.200000   4.013891e+25
      27.889900      61.810900      74.645400      77.254110     272.867710     231.460010      61.110000      13.800000       2.400000   2.556471e+25
      27.850700      61.755000      74.645400      46.800040     281.726290     231.460010      61.110000      16.800000       3.200000   1.548693e+25
      28.384700      62.459700      80.774200      22.670600     245.952300     231.460010      61.110000      19.600000       2.400000   7.502089e+24
      28.345500      62.403800      80.774200      12.952180     222.278500     231.460010      61.110000      17.600000       3.800000   4.286097e+24
      28.306200      62.348000      80.774200      17.885060     214.616390     231.460010      61.110000      13.600000       3.200000   5.918471e+24
      28.267000      62.292100      80.774200      57.872700     221.773100     231.460010      61.110000      10.600000       3.200000   1.915106e+25
      28.227700      62.236300      80.774200     101.690200     228.124690     231.460010      61.110000       8.600000       3.800000   3.365102e+25
      28.188500      62.180400      80.774200     150.759510     237.195100     231.460010      61.110000       5.800000       3.200000   4.988887e+25
      28.149200      62.124500      80.774200     187.960490     231.108310     231.460010      61.110000       1.400000       3.000000   6.219933e+25
      28.110000      62.068700      80.774200     256.444890     241.812300     231.460010      61.110000       0.600000       1.200000   8.486199e+25
      28.070700      62.012800      80.774200     224.077100     259.035400     231.460010      61.110000       2.800000       4.400000   7.415093e+25
      28.031500      61.957000      80.774200     186.628910     264.020110     231.460010      61.110000       5.600000       3.000000   6.175870e+25
      27.992200      61.901100      80.774200     133.210100     256.119690     231.460010      61.110000       7.800000       2.800000   4.408150e+25
      27.953000      61.845200      80.774200      95.179370     273.979890     231.460010      61.110000      11.000000       2.200000   3.149647e+25
      27.913700      61.789400      80.774200      52.583880     271.434510     231.460010      61.110000      13.600000       2.600000   1.740090e+25
      27.874500      61.733500      80.774200      24.422390     270.582310     231.460010      61.110000      17.400000       3.200000   8.081785e+24
      28.408500      62.438200      86.903100      31.818200     289.837490     231.460010      61.110000      19.800000       2.200000   1.052919e+25
      28.369300      62.382300      86.903100      26.434880     271.301090     231.460010      61.110000      17.000000       3.600000   8.747751e+24
      28.330000      62.326500      86.903100       1.513690     236.468000     231.460010      61.110000      14.000000       3.800000   5.009059e+23
      28.290800      62.270600      86.903100       3.133530     237.588900     231.460010      61.110000      12.000000       3.400000   1.036938e+24
      28.251500      62.214800      86.903100      35.832100     251.059200     231.460010      61.110000       9.000000       3.000000   1.185745e+25
      28.212300      62.158900      86.903100      69.548780     271.278500     231.460010      61.110000       5.200000       4.400000   2.301487e+25
      28.173000      62.103000      86.903100      56.593120     269.568390     231.460010      61.110000       2.600000       5.400000   1.872763e+25
      28.133800      62.047200      86.903100     117.871400     261.960110     231.460010      61.110000       2.800000       4.400000   3.900565e+25
      28.094500      61.991300      86.903100     126.783800     259.493010     231.460010      61.110000       2.800000       5.200000   4.195490e+25
      28.055300      61.935500      86.903100     127.146100     269.007290     231.460010      61.110000       5.400000       3.400000   4.207483e+25
      28.016000      61.879600      86.903100      87.267580     275.952300     231.460010      61.110000       9.600000       3.400000   2.887832e+25
      27.976800      61.823700      86.903100      41.807950     276.147710     231.460010      61.110000      12.000000       4.200000   1.383496e+25
      27.937500      61.767900      86.903100      26.064060     287.786990     231.460010      61.110000      14.000000       4.400000   8.625041e+24
      27.898300      61.712000      86.903100       8.181570     274.464290     231.460010      61.110000      17.000000       2.200000   2.707419e+24
      28.432300      62.416700      93.031900       6.405820     284.893590     231.460010      61.110000      21.000000       3.400000   2.119794e+24
      28.393100      62.360800      93.031900      18.458070     288.080200     231.460010      61.110000      17.800000       2.800000   6.108092e+24
      28.353800      62.305000      93.031900       1.279460     278.640810     231.460010      61.110000      14.800000       2.800000   4.233959e+23
      28.314600      62.249100      93.031900       0.599400     274.622890     231.460010      61.110000      12.000000       3.200000   1.983513e+23
      28.275300      62.193300      93.031900      25.459990     258.353300     231.460010      61.110000       9.200000       2.400000   8.425144e+24
      28.236100      62.137400      93.031900      26.765440     243.859700     231.460010      61.110000       7.400000       2.400000   8.857139e+24
      28.196800      62.081500      93.031900      29.471740     285.797000     231.460010      61.110000       5.000000       3.200000   9.752699e+24
      28.157600      62.025700      93.031900      50.024290     265.187990     231.460010      61.110000       5.200000       3.800000   1.655389e+25
      28.118300      61.969800      93.031900      66.397960     257.845790     231.460010      61.110000       5.200000       3.200000   2.197221e+25
      28.079100      61.914000      93.031900      49.187810     271.475010     231.460010      61.110000       7.000000       3.000000   1.627708e+25
      28.039900      61.858100      93.031900      35.893540     281.687710     231.460010      61.110000       9.600000       3.200000   1.187778e+25
      28.000600      61.802200      93.031900      19.697600     273.443390     231.460010      61.110000      12.600000       2.600000   6.518271e+24
      27.961300      61.746400      93.031900       2.591010     264.401090     231.460010      61.110000      15.400000       2.600000   8.574082e+23
      27.922100      61.690500      93.031900      12.862410     238.930300     231.460010      61.110000      18.400000       3.200000   4.256390e+24
      28.456200      62.395200      99.160800      13.551250     281.543000     231.460010      61.110000      22.200000       3.000000   4.484339e+24
      28.416900      62.339300      99.160800       0.327750     286.877990     231.460010      61.110000      20.000000       3.400000   1.084597e+23
      28.377700      62.283500      99.160800      10.019360     262.442500     231.460010      61.110000      16.200000       4.400000   3.315577e+24
      28.338400      62.227600      99.160800       8.451900     229.654010     231.460010      61.110000      14.000000       3.200000   2.796876e+24
      28.299200      62.171800      99.160800      20.387290     214.007710     231.460010      61.110000      11.400000       2.400000   6.746502e+24
      28.259900      62.115900      99.160800      15.485250     263.379700     231.460010      61.110000       9.400001       2.800000   5.124333e+24
      28.220700      62.060000      99.160800       2.923250     254.364810     231.460010      61.110000       8.400001       3.400000   9.673535e+23
      28.181400      62.004200      99.160800      40.274280     254.890700     231.460010      61.110000       8.200000       3.400000   1.332745e+25
      28.142200      61.948300      99.160800      29.277030     226.103900     231.460010      61.110000       8.000000       2.400000   9.688268e+24
      28.102900      61.892500      99.160800      22.528820     242.392590     231.460010      61.110000       9.600000       2.600000   7.455169e+24
      28.063700      61.836600      99.160800      31.893340     285.535190     231.460010      61.110000      12.200000       2.800000   1.055405e+25
      28.024400      61.780700      99.160800       5.373890     220.317310     231.460010      61.110000      13.600000       2.400000   1.778311e+24
      27.985200      61.724900      99.160800       3.636940     270.711490     231.460010      61.110000      16.000000       3.000000   1.203525e+24
      27.945900      61.669000      99.160800       7.361200     272.673310     231.460010      61.110000      19.000000       2.600000   2.435946e+24
      28.480000      62.373700     105.289600       5.055000     272.767790     231.460010      61.110000      23.600000       3.000000   1.672784e+24
      28.440700      62.317800     105.289600       6.849870     245.966200     231.460010      61.110000      22.200000       3.800000   2.266739e+24
      28.401500      62.262000     105.289600       7.498080     244.543700     231.460010      61.110000      18.000000       4.000000   2.481242e+24
      28.362200      62.206100     105.289600       4.282910     251.452190     231.460010      61.110000      16.600000       4.400000   1.417289e+24
      28.323000      62.150300     105.289600       1.277030     239.147090     231.460010      61.110000      14.400000       3.800000   4.225900e+23
      28.283700      62.094400     105.289600       2.265150     281.404390     231.460010      61.110000      12.600000       3.800000   7.495761e+23
      28.244500      62.038500     105.289600       0.498610     284.564510     231.460010      61.110000      10.000000       2.400000   1.649996e+23
      28.205200      61.982700     105.289600       2.148300     286.994110     231.460010      61.110000      10.200000       2.600000   7.109085e+23
      28.166000      61.926800     105.289600      11.399260     237.709400     231.460010      61.110000      10.800000       2.600000   3.772208e+24
      28.126700      61.871000     105.289600      19.978060     278.846190     231.460010      61.110000      12.800000       3.800000   6.611081e+24
      28.087500      61.815100     105.289600       8.099820     259.199580     231.460010      61.110000      13.800000       2.600000   2.680370e+24
      28.048200      61.759200     105.289600      10.134160     279.116000     231.460010      61.110000      16.200000       2.400000   3.353566e+24
      28.009000      61.703400     105.289600       5.598870     233.119400     231.460010      61.110000      18.200000       3.400000   1.852760e+24
      27.969700      61.647500     105.289600       3.026610     222.242900     231.460010      61.110000      20.600000       3.400000   1.001558e+24
EOF


#####
#    processing
#    First get the fault model by skipping the first few lines of the output
#####
ed static2_out  << EOF
1,/t_rup/d
w ff.mod
EOF

#####
#    create the do_process script that does all of the work
#####
do_process ()
{
#####
#     do_process SITE_LATITUDE SITE_LONGITUDE
STLA=$1
STLO=$2
#####
#     NSUB is the sub fault number
#     PNSUB is a pretty version with 4 digits, e.g., 0001 for
#     file name
#####
NSUB=0
#####
#     make a synthetic for each finite fault element
#####
	while read EVLA EVLO EVDP SLIP RAKE STK DIP TRUP TRISE MOM
	do
		NSUB=`echo $NSUB | awk '{print $1 + 1 }' `
		PBSUB=`echo $NSUB | awk '{printf "%4.4d", $1}' `
		MW=`echo $MOM | awk '{ print 2.*( log($1)/log(10.0) -16.1)/3.0 }' `
#                echo $MOM $MW $DUR
		#####
		#   compute the distance in km ans azimuth from subfault to station
		#####
		DIST=`udelaz -DIST -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		AZ=`udelaz -AZ -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		BAZ=`udelaz -BAZ -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		TIMES=`time96 -M ${MODEL} -EVDP ${EVDP} -SV -DIST $DIST`
		#####
		#    determine the static deformation
		#####
cat > dfile << EOF
${DIST} 0.1 256 0 0
EOF
		hprep96 -M ${MODEL} -d dfile -ALL -HS ${EVDP} -HR 0 -TF -BH
		hstat96
		#####
		#    go to WORK make GREEN and then mechanism, delay and duration
		#####
		cd WORK
		rm -f *
		#####
		#    get Green functions
		#####
		f96tosac -T < ../file96
		#####
		#    get basename for gsac
		#####
		F=`ls *.ZSS`














 FILEPROTO=`basename ${F} .ZSS` TSHIFT=`echo ${TIMES} ${TRUP} | awk '{print $1 + $2 }'` gsac > /dev/null << EOF mt to ZNE MW ${MW} AZ ${AZ} BAZ ${BAZ} STK ${STK} RAKE ${RAKE} DIP ${DIP} FILE ${FILEPROTO} shift F ${TSHIFT} # ch EVLA ${EVLA} EVLO ${EVLO} STLA ${STLA} STLO ${STLO} w mv T.Z ../STACK/Z.${PBSUB} mv T.N ../STACK/N.${PBSUB} mv T.E ../STACK/E.${PBSUB} q EOF cd ${MYTOP} done < ff.mod ##### # now perform the stacking # determine the minimum B time, maximum E time to define the cut window # determine the minimum A time to set the first srrival time on the stack # These offsets are with respect to the origin time ##### cd STACK ##### # now use gsac to read all in and stack ##### gsac << EOF cuterr fillz cut o o 200 r Z.???? stack absolute w ../FINALZ/${STLA}_${STLO}.Z r N.???? stack absolute w ../FINALN/${STLA}_${STLO}.N r E.???? stack absolute w ../FINALE/${STLA}_${STLO}.E q EOF } ##### # create a work area for making the synthetic for a sub-fault ##### rm -fr WORK ; mkdir WORK ##### # create a work area to store synthetics for each finite fault # which will be used for the stack ##### rm -fr STACK ; mkdir STACK ##### # create directory for final synthetics ##### rm -fr FINALZ ; mkdir FINALZ rm -fr FINALN ; mkdir FINALN rm -fr FINALE ; mkdir FINALE while [ "${ENDLATLOOP}" != "YES" ] do while [ "${ENDLONLOOP}" != "YES" ] do ##### # process this LAT/LON coordinate ##### cd ${MYTOP} do_process $LAT $LON LON=`echo $LON $DLON | awk '{print $1 + $2 }' ` ENDLONLOOP=`echo ${LONMIN} ${LONMAX} ${LON} | awk '{ if ( $3 >= $1 && $3 <= $2 ) print "NO" ; else print "YES" }' ` done ##### # reset the LON loop ##### ENDLONLOOP="NO" LON=${LONMIN} ##### # increment and test latitude ##### LAT=`echo ${LAT} ${DLAT} | awk '{print $1 + $2 }' ` ENDLATLOOP=`echo ${LATMIN} ${LATMAX} ${LAT} | awk '{ if ( $3 >= $1 && $3 <= $2 ) print "NO" ; else print "YES" }' ` done cd ${MYTOP} pwd
#!/bin/sh

#####
#    define the bounds on the gridded area and also the
#    grid interval
#####
LATMIN="28.0"
LATMAX="28.0"
DLAT="0.25"
	
LONMIN="62.0"
LONMAX="62.0"
DLON="0.25"

#####
#    define control variables for the loop
#####
ENDLATLOOP="NO"
ENDLONLOOT="NO"

#####
#    define initial values
#####
LAT=${LATMIN}
LON=${LONMIN}

#####
#    define the velocity model
#####

MODEL=${GREENDIR}/WUS.REG

#####
#    define TOPLEVEL directory
#####
MYTOP=`pwd`

#####
#    define the finite fault model
#####

cat > static2_out << EOF
#Total number of fault_segments=     1
#Fault_segment =   1 nx(Along-strike)=  14 Dx=  7.00km ny(downdip)=  12 Dy=  7.00km
#Boundary of Fault_segment     1. EQ in cell 8,8. Lon: 62.0532   Lat: 28.1069
#Lon.  Lat.  Depth
       62.62570       28.22120       36.64660
       61.85480       27.67950       36.64660
       61.60110       27.96040      108.96690
       62.37200       28.50210      108.96690
       62.62570       28.22120       36.64660
#Lat. Lon. depth slip rake strike dip t_rup h_dur mo
      28.218100      62.610200      37.872300      32.892190     210.228390     231.460010      61.110000      33.200000       3.400000   7.994117e+24
      28.178900      62.554300      37.872300      26.133590     213.971100     231.460010      61.110000      31.400000       4.000000   6.351509e+24
      28.139600      62.498500      37.872300       0.378610     255.360600     231.460010      61.110000      28.400000       2.600000   9.201650e+22
      28.100300      62.442600      37.872300       0.271620     283.392210     231.460010      61.110000      26.200000       3.200000   6.601493e+22
      28.061100      62.386700      37.872300       0.487170     267.694490     231.460010      61.110000      23.000000       3.400000   1.184024e+23
      28.021900      62.330900      37.872300       4.512600     214.114200     231.460010      61.110000      21.200000       3.400000   1.096743e+24
      27.982600      62.275000      37.872300       0.054630     245.378800     231.460010      61.110000      19.600000       3.600000   1.327731e+22
      27.943400      62.219200      37.872300       0.359760     239.659100     231.460010      61.110000      19.000000       3.000000   8.743530e+22
      27.904100      62.163300      37.872300       0.819340     260.363890     231.460010      61.110000      20.800000       3.000000   1.991322e+23
      27.864900      62.107400      37.872300       6.014880     268.909300     231.460010      61.110000      21.600000       2.400000   1.461857e+24
      27.825600      62.051600      37.872300       7.808980     263.208800     231.460010      61.110000      24.600000       4.200000   1.897894e+24
      27.786400      61.995700      37.872300      69.880770     211.684100     231.460010      61.110000      27.600000       4.400000   1.698382e+25
      27.747100      61.939900      37.872300     152.146300     213.129500     231.460010      61.110000      28.800000       5.400000   3.697763e+25
      27.707900      61.884000      37.872300     149.289790     215.029500     231.460010      61.110000      32.200000       3.800000   3.628339e+25
      28.241900      62.588700      44.001200      22.606470     254.847600     231.460010      61.110000      30.800000       3.800000   7.083550e+24
      28.202700      62.532800      44.001200       2.119850     247.519300     231.460010      61.110000      27.800000       4.600000   6.642373e+23
      28.163400      62.477000      44.001200       0.297780     221.859890     231.460010      61.110000      25.200000       2.400000   9.330823e+22
      28.124200      62.421100      44.001200       1.529620     251.172390     231.460010      61.110000      21.800000       3.000000   4.792937e+23
      28.084900      62.365200      44.001200       7.235110     236.188100     231.460010      61.110000      20.800000       3.200000   2.267062e+24
      28.045700      62.309400      44.001200       8.471940     255.018010     231.460010      61.110000      17.400000       2.400000   2.654612e+24
      28.006400      62.253500      44.001200      51.855940     259.450010     231.460010      61.110000      16.400000       2.200000   1.624862e+25
      27.967200      62.197700      44.001200      49.460580     277.934810     231.460010      61.110000      16.800000       3.000000   1.549806e+25
      27.927900      62.141800      44.001200       5.419170     213.520290     231.460010      61.110000      17.000000       3.000000   1.698052e+24
      27.888700      62.085900      44.001200       3.837110     255.061100     231.460010      61.110000      19.800000       4.400000   1.202326e+24
      27.849400      62.030100      44.001200       2.201740     242.065200     231.460010      61.110000      20.600000       2.400000   6.898966e+23
      27.810200      61.974200      44.001200      55.149570     221.783490     231.460010      61.110000      24.400000       4.400000   1.728065e+25
      27.770900      61.918400      44.001200     128.604400     213.373200     231.460010      61.110000      26.800000       4.400000   4.029712e+25
      27.731700      61.862500      44.001200     151.452000     210.301800     231.460010      61.110000      28.200000       5.400000   4.745621e+25
      28.265700      62.567200      50.130000       4.530330     264.110110     231.460010      61.110000      28.400000       4.200000   1.499164e+24
      28.226500      62.511300      50.130000       2.649400     247.963000     231.460010      61.110000      25.200000       2.600000   8.767319e+23
      28.187200      62.455500      50.130000      14.969710     251.381100     231.460010      61.110000      22.000000       2.400000   4.953733e+24
      28.148000      62.399600      50.130000      10.491010     268.782010     231.460010      61.110000      18.800000       2.400000   3.471654e+24
      28.108700      62.343700      50.130000      73.365500     240.725400     231.460010      61.110000      16.200000       4.800000   2.427789e+25
      28.069500      62.287900      50.130000     142.354200     258.077610     231.460010      61.110000      15.400000       3.800000   4.710744e+25
      28.030200      62.232000      50.130000     159.408400     258.796600     231.460010      61.110000      13.200000       4.000000   5.275095e+25
      27.991000      62.176200      50.130000     150.119600     270.854400     231.460010      61.110000      12.800000       2.400000   4.967715e+25
      27.951700      62.120300      50.130000      51.833320     268.783600     231.460010      61.110000      13.800000       3.000000   1.715253e+25
      27.912500      62.064400      50.130000      27.987930     268.758000     231.460010      61.110000      16.400000       3.800000   9.261682e+24
      27.873200      62.008600      50.130000      53.615780     286.815400     231.460010      61.110000      17.400000       4.000000   1.774238e+25
      27.834000      61.952700      50.130000      58.043200     285.933110     231.460010      61.110000      20.000000       3.000000   1.920748e+25
      27.794700      61.896900      50.130000      15.560400     247.248600     231.460010      61.110000      22.800000       2.400000   5.149200e+24
      27.755500      61.841000      50.130000      56.564990     221.178210     231.460010      61.110000      26.600000       4.000000   1.871832e+25
      28.289500      62.545700      56.258900       0.535510     248.583690     231.460010      61.110000      26.000000       3.800000   1.772104e+23
      28.250300      62.489800      56.258900       0.492050     228.388310     231.460010      61.110000      22.800000       3.800000   1.628287e+23
      28.211000      62.434000      56.258900      32.724030     242.349790     231.460010      61.110000      19.200000       3.400000   1.082894e+25
      28.171800      62.378100      56.258900      83.106200     251.551900     231.460010      61.110000      17.400000       3.400000   2.750125e+25
      28.132500      62.322200      56.258900     189.516300     250.577500     231.460010      61.110000      13.200000       2.400000   6.271416e+25
      28.093300      62.266400      56.258900     324.978910     256.584200     231.460010      61.110000      11.400000       2.400000   1.075410e+26
      28.054000      62.210500      56.258900     356.779390     255.187700     231.460010      61.110000      10.000000       2.400000   1.180644e+26
      28.014800      62.154700      56.258900     325.681300     260.263890     231.460010      61.110000       9.600000       2.400000   1.077735e+26
      27.975500      62.098800      56.258900     198.344800     261.329500     231.460010      61.110000      10.400000       2.800000   6.563567e+25
      27.936300      62.042900      56.258900     113.726700     273.064790     231.460010      61.110000      13.200000       4.000000   3.763409e+25
      27.897000      61.987100      56.258900     106.637600     288.630710     231.460010      61.110000      15.600000       4.400000   3.528819e+25
      27.857800      61.931200      56.258900     116.412600     287.598600     231.460010      61.110000      18.400000       3.800000   3.852292e+25
      27.818500      61.875400      56.258900      70.925380     288.786900     231.460010      61.110000      20.200000       3.200000   2.347042e+25
      27.779300      61.819500      56.258900      43.106050     287.997590     231.460010      61.110000      22.000000       2.400000   1.426453e+25
      28.313300      62.524200      62.387700       2.934820     252.381390     231.460010      61.110000      22.200000       2.400000   9.711830e+23
      28.274100      62.468300      62.387700       4.968770     283.197910     231.460010      61.110000      20.400000       3.200000   1.644250e+24
      28.234800      62.412500      62.387700      46.202920     274.951810     231.460010      61.110000      16.200000       2.400000   1.528933e+25
      28.195600      62.356600      62.387700     170.870410     251.076400     231.460010      61.110000      13.400000       2.400000   5.654392e+25
      28.156300      62.300700      62.387700     282.176700     245.795900     231.460010      61.110000      11.000000       2.400000   9.337704e+25
      28.117100      62.244900      62.387700     401.651610     249.109600     231.460010      61.110000       8.800000       4.400000   1.329134e+26
      28.077800      62.189000      62.387700     433.329410     250.572200     231.460010      61.110000       7.400000       2.800000   1.433960e+26
      28.038600      62.133200      62.387700     393.998810     254.099000     231.460010      61.110000       6.800000       2.400000   1.303809e+26
      27.999300      62.077300      62.387700     306.459500     257.955690     231.460010      61.110000       7.400000       2.400000   1.014127e+26
      27.960100      62.021400      62.387700     206.576510     262.989110     231.460010      61.110000       9.400001       5.000000   6.835968e+25
      27.920800      61.965600      62.387700     157.121200     274.246800     231.460010      61.110000      12.800000       3.400000   5.199408e+25
      27.881600      61.909700      62.387700     153.499690     275.781010     231.460010      61.110000      15.200000       3.800000   5.079567e+25
      27.842300      61.853900      62.387700     108.558200     285.134800     231.460010      61.110000      16.800000       2.400000   3.592377e+25
      27.803100      61.798000      62.387700      46.251880     286.540590     231.460010      61.110000      19.400000       3.000000   1.530553e+25
      28.337100      62.502700      68.516500       9.300190     265.807100     231.460010      61.110000      20.000000       2.400000   3.077592e+24
      28.297900      62.446800      68.516500      25.211800     253.313000     231.460010      61.110000      17.800000       3.000000   8.343013e+24
      28.258600      62.391000      68.516500      85.873110     250.889890     231.460010      61.110000      15.400000       3.800000   2.841688e+25
      28.219400      62.335100      68.516500     186.283100     247.663890     231.460010      61.110000      11.400000       2.400000   6.164426e+25
      28.180100      62.279300      68.516500     274.027100     243.564000     231.460010      61.110000       8.600000       4.800000   9.068021e+25
      28.140900      62.223400      68.516500     390.263610     242.516300     231.460010      61.110000       6.400000       5.400000   1.291449e+26
      28.101600      62.167500      68.516500     436.490690     242.766490     231.460010      61.110000       4.800000       2.400000   1.444422e+26
      28.062400      62.111700      68.516500     428.757510     246.774400     231.460010      61.110000       4.000000       2.400000   1.418831e+26
      28.023100      62.055800      68.516500     345.800990     253.678410     231.460010      61.110000       4.800000       2.400000   1.144314e+26
      27.983900      61.999900      68.516500     240.714000     257.735600     231.460010      61.110000       8.000000       3.800000   7.965638e+25
      27.944600      61.944100      68.516500     162.880600     260.772490     231.460010      61.110000       9.400001       4.400000   5.389998e+25
      27.905400      61.888200      68.516500     148.647510     269.645810     231.460010      61.110000      13.400000       3.400000   4.919000e+25
      27.866100      61.832400      68.516500      89.934330     265.667390     231.460010      61.110000      14.800000       2.400000   2.976080e+25
      27.826900      61.776500      68.516500      51.094400     283.599910     231.460010      61.110000      17.600000       2.800000   1.690801e+25
      28.360900      62.481200      74.645400      20.577690     265.335390     231.460010      61.110000      19.400000       2.200000   6.809507e+24
      28.321700      62.425300      74.645400      31.631030     246.478000     231.460010      61.110000      16.600000       3.600000   1.046724e+25
      28.282400      62.369500      74.645400      69.330800     234.520400     231.460010      61.110000      13.400000       2.400000   2.294274e+25
      28.243200      62.313600      74.645400     141.466290     235.261000     231.460010      61.110000      10.800000       2.800000   4.681361e+25
      28.203900      62.257800      74.645400     213.153900     240.296800     231.460010      61.110000       7.600000       2.400000   7.053625e+25
      28.164700      62.201900      74.645400     298.338010     237.639690     231.460010      61.110000       4.800000       4.000000   9.872511e+25
      28.125400      62.146000      74.645400     387.448610     239.173600     231.460010      61.110000       2.200000       2.400000   1.282133e+26
      28.086200      62.090200      74.645400     383.663790     241.469100     231.460010      61.110000       1.400000       2.400000   1.269609e+26
      28.046900      62.034300      74.645400     335.844300     254.890110     231.460010      61.110000       3.000000       2.400000   1.111366e+26
      28.007700      61.978400      74.645400     260.581600     264.116700     231.460010      61.110000       5.200000       2.400000   8.623091e+25
      27.968400      61.922600      74.645400     174.139690     255.296400     231.460010      61.110000       9.200000       3.800000   5.762580e+25
      27.929200      61.866700      74.645400     121.296000     262.509800     231.460010      61.110000      12.400000       3.200000   4.013891e+25
      27.889900      61.810900      74.645400      77.254110     272.867710     231.460010      61.110000      13.800000       2.400000   2.556471e+25
      27.850700      61.755000      74.645400      46.800040     281.726290     231.460010      61.110000      16.800000       3.200000   1.548693e+25
      28.384700      62.459700      80.774200      22.670600     245.952300     231.460010      61.110000      19.600000       2.400000   7.502089e+24
      28.345500      62.403800      80.774200      12.952180     222.278500     231.460010      61.110000      17.600000       3.800000   4.286097e+24
      28.306200      62.348000      80.774200      17.885060     214.616390     231.460010      61.110000      13.600000       3.200000   5.918471e+24
      28.267000      62.292100      80.774200      57.872700     221.773100     231.460010      61.110000      10.600000       3.200000   1.915106e+25
      28.227700      62.236300      80.774200     101.690200     228.124690     231.460010      61.110000       8.600000       3.800000   3.365102e+25
      28.188500      62.180400      80.774200     150.759510     237.195100     231.460010      61.110000       5.800000       3.200000   4.988887e+25
      28.149200      62.124500      80.774200     187.960490     231.108310     231.460010      61.110000       1.400000       3.000000   6.219933e+25
      28.110000      62.068700      80.774200     256.444890     241.812300     231.460010      61.110000       0.600000       1.200000   8.486199e+25
      28.070700      62.012800      80.774200     224.077100     259.035400     231.460010      61.110000       2.800000       4.400000   7.415093e+25
      28.031500      61.957000      80.774200     186.628910     264.020110     231.460010      61.110000       5.600000       3.000000   6.175870e+25
      27.992200      61.901100      80.774200     133.210100     256.119690     231.460010      61.110000       7.800000       2.800000   4.408150e+25
      27.953000      61.845200      80.774200      95.179370     273.979890     231.460010      61.110000      11.000000       2.200000   3.149647e+25
      27.913700      61.789400      80.774200      52.583880     271.434510     231.460010      61.110000      13.600000       2.600000   1.740090e+25
      27.874500      61.733500      80.774200      24.422390     270.582310     231.460010      61.110000      17.400000       3.200000   8.081785e+24
      28.408500      62.438200      86.903100      31.818200     289.837490     231.460010      61.110000      19.800000       2.200000   1.052919e+25
      28.369300      62.382300      86.903100      26.434880     271.301090     231.460010      61.110000      17.000000       3.600000   8.747751e+24
      28.330000      62.326500      86.903100       1.513690     236.468000     231.460010      61.110000      14.000000       3.800000   5.009059e+23
      28.290800      62.270600      86.903100       3.133530     237.588900     231.460010      61.110000      12.000000       3.400000   1.036938e+24
      28.251500      62.214800      86.903100      35.832100     251.059200     231.460010      61.110000       9.000000       3.000000   1.185745e+25
      28.212300      62.158900      86.903100      69.548780     271.278500     231.460010      61.110000       5.200000       4.400000   2.301487e+25
      28.173000      62.103000      86.903100      56.593120     269.568390     231.460010      61.110000       2.600000       5.400000   1.872763e+25
      28.133800      62.047200      86.903100     117.871400     261.960110     231.460010      61.110000       2.800000       4.400000   3.900565e+25
      28.094500      61.991300      86.903100     126.783800     259.493010     231.460010      61.110000       2.800000       5.200000   4.195490e+25
      28.055300      61.935500      86.903100     127.146100     269.007290     231.460010      61.110000       5.400000       3.400000   4.207483e+25
      28.016000      61.879600      86.903100      87.267580     275.952300     231.460010      61.110000       9.600000       3.400000   2.887832e+25
      27.976800      61.823700      86.903100      41.807950     276.147710     231.460010      61.110000      12.000000       4.200000   1.383496e+25
      27.937500      61.767900      86.903100      26.064060     287.786990     231.460010      61.110000      14.000000       4.400000   8.625041e+24
      27.898300      61.712000      86.903100       8.181570     274.464290     231.460010      61.110000      17.000000       2.200000   2.707419e+24
      28.432300      62.416700      93.031900       6.405820     284.893590     231.460010      61.110000      21.000000       3.400000   2.119794e+24
      28.393100      62.360800      93.031900      18.458070     288.080200     231.460010      61.110000      17.800000       2.800000   6.108092e+24
      28.353800      62.305000      93.031900       1.279460     278.640810     231.460010      61.110000      14.800000       2.800000   4.233959e+23
      28.314600      62.249100      93.031900       0.599400     274.622890     231.460010      61.110000      12.000000       3.200000   1.983513e+23
      28.275300      62.193300      93.031900      25.459990     258.353300     231.460010      61.110000       9.200000       2.400000   8.425144e+24
      28.236100      62.137400      93.031900      26.765440     243.859700     231.460010      61.110000       7.400000       2.400000   8.857139e+24
      28.196800      62.081500      93.031900      29.471740     285.797000     231.460010      61.110000       5.000000       3.200000   9.752699e+24
      28.157600      62.025700      93.031900      50.024290     265.187990     231.460010      61.110000       5.200000       3.800000   1.655389e+25
      28.118300      61.969800      93.031900      66.397960     257.845790     231.460010      61.110000       5.200000       3.200000   2.197221e+25
      28.079100      61.914000      93.031900      49.187810     271.475010     231.460010      61.110000       7.000000       3.000000   1.627708e+25
      28.039900      61.858100      93.031900      35.893540     281.687710     231.460010      61.110000       9.600000       3.200000   1.187778e+25
      28.000600      61.802200      93.031900      19.697600     273.443390     231.460010      61.110000      12.600000       2.600000   6.518271e+24
      27.961300      61.746400      93.031900       2.591010     264.401090     231.460010      61.110000      15.400000       2.600000   8.574082e+23
      27.922100      61.690500      93.031900      12.862410     238.930300     231.460010      61.110000      18.400000       3.200000   4.256390e+24
      28.456200      62.395200      99.160800      13.551250     281.543000     231.460010      61.110000      22.200000       3.000000   4.484339e+24
      28.416900      62.339300      99.160800       0.327750     286.877990     231.460010      61.110000      20.000000       3.400000   1.084597e+23
      28.377700      62.283500      99.160800      10.019360     262.442500     231.460010      61.110000      16.200000       4.400000   3.315577e+24
      28.338400      62.227600      99.160800       8.451900     229.654010     231.460010      61.110000      14.000000       3.200000   2.796876e+24
      28.299200      62.171800      99.160800      20.387290     214.007710     231.460010      61.110000      11.400000       2.400000   6.746502e+24
      28.259900      62.115900      99.160800      15.485250     263.379700     231.460010      61.110000       9.400001       2.800000   5.124333e+24
      28.220700      62.060000      99.160800       2.923250     254.364810     231.460010      61.110000       8.400001       3.400000   9.673535e+23
      28.181400      62.004200      99.160800      40.274280     254.890700     231.460010      61.110000       8.200000       3.400000   1.332745e+25
      28.142200      61.948300      99.160800      29.277030     226.103900     231.460010      61.110000       8.000000       2.400000   9.688268e+24
      28.102900      61.892500      99.160800      22.528820     242.392590     231.460010      61.110000       9.600000       2.600000   7.455169e+24
      28.063700      61.836600      99.160800      31.893340     285.535190     231.460010      61.110000      12.200000       2.800000   1.055405e+25
      28.024400      61.780700      99.160800       5.373890     220.317310     231.460010      61.110000      13.600000       2.400000   1.778311e+24
      27.985200      61.724900      99.160800       3.636940     270.711490     231.460010      61.110000      16.000000       3.000000   1.203525e+24
      27.945900      61.669000      99.160800       7.361200     272.673310     231.460010      61.110000      19.000000       2.600000   2.435946e+24
      28.480000      62.373700     105.289600       5.055000     272.767790     231.460010      61.110000      23.600000       3.000000   1.672784e+24
      28.440700      62.317800     105.289600       6.849870     245.966200     231.460010      61.110000      22.200000       3.800000   2.266739e+24
      28.401500      62.262000     105.289600       7.498080     244.543700     231.460010      61.110000      18.000000       4.000000   2.481242e+24
      28.362200      62.206100     105.289600       4.282910     251.452190     231.460010      61.110000      16.600000       4.400000   1.417289e+24
      28.323000      62.150300     105.289600       1.277030     239.147090     231.460010      61.110000      14.400000       3.800000   4.225900e+23
      28.283700      62.094400     105.289600       2.265150     281.404390     231.460010      61.110000      12.600000       3.800000   7.495761e+23
      28.244500      62.038500     105.289600       0.498610     284.564510     231.460010      61.110000      10.000000       2.400000   1.649996e+23
      28.205200      61.982700     105.289600       2.148300     286.994110     231.460010      61.110000      10.200000       2.600000   7.109085e+23
      28.166000      61.926800     105.289600      11.399260     237.709400     231.460010      61.110000      10.800000       2.600000   3.772208e+24
      28.126700      61.871000     105.289600      19.978060     278.846190     231.460010      61.110000      12.800000       3.800000   6.611081e+24
      28.087500      61.815100     105.289600       8.099820     259.199580     231.460010      61.110000      13.800000       2.600000   2.680370e+24
      28.048200      61.759200     105.289600      10.134160     279.116000     231.460010      61.110000      16.200000       2.400000   3.353566e+24
      28.009000      61.703400     105.289600       5.598870     233.119400     231.460010      61.110000      18.200000       3.400000   1.852760e+24
      27.969700      61.647500     105.289600       3.026610     222.242900     231.460010      61.110000      20.600000       3.400000   1.001558e+24
EOF


#####
#    processing
#    First get the fault model by skipping the first few lines of the output
#####
ed static2_out  << EOF
1,/t_rup/d
w ff.mod
EOF

#####
#    create the do_process script that does all of the work
#####
do_process ()
{
#####
#     do_process SITE_LATITUDE SITE_LONGITUDE
STLA=$1
STLO=$2
#####
#     NSUB is the sub fault number
#     PNSUB is a pretty version with 4 digits, e.g., 0001 for
#     file name
#####
NSUB=0
#####
#     make a synthetic for each finite fault element
#####
	while read EVLA EVLO EVDP SLIP RAKE STK DIP TRUP TRISE MOM
	do
		NSUB=`echo $NSUB | awk '{print $1 + 1 }' `
		PBSUB=`echo $NSUB | awk '{printf "%4.4d", $1}' `
		MW=`echo $MOM | awk '{ print 2.*( log($1)/log(10.0) -16.1)/3.0 }' `
#                echo $MOM $MW $DUR
		#####
		#   compute the distance in km ans azimuth from subfault to station
		#####
		DIST=`udelaz -DIST -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		AZ=`udelaz -AZ -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		BAZ=`udelaz -BAZ -EVLA $EVLA -EVLO $EVLO -STLA $STLA -STLO $STLO`
		#####
		#    determine the static deformation
		#####
# get the depth from DCTL and the dist from DEPTH/W.CTL
cat > awkprog << FOE
# This works under gawk - on Solaris try nawk
BEGIN { MDIF = 10000.0 }
{DIF = $EVDP - \$1 ;
if( DIF < 0 ) DIF = - DIF ;
if(DIF < MDIF) { MDIF = DIF ; Hfile = \$2  }
}
END { print Hfile  }
FOE

	cat ${MODEL}/D.CTL | \
		awk -f awkprog > j
	HS=`awk '{print $1}' < j `

cat > awkprog << FOE
# This works under gawk - on Solaris try nawk
BEGIN { MDIF = 10000.0 }
{DIF = $DIST - \$1 ;
if( DIF < 0 ) DIF = - DIF ;
if(DIF < MDIF) { MDIF = DIF ; Dfile = \$7 ; Rate = \$2 ; Dist = \$1 }
}
END { print Dfile , Rate, Dist }
FOE

	cat ${MODEL}/${HS}/W.CTL | \
		awk -f awkprog > j
	FILEPROTO=`awk '{print $1}' < j `

echo $DIST $EVDP ${MODEL}/${HS}/${FILEPROTO}
		#####
		#    go to WORK make GREEN and then mechanism, delay and duration
		#####
		cd WORK
		rm -f *
gsac > /dev/null << EOF
mt to ZNE MW ${MW} AZ ${AZ} BAZ ${BAZ} STK ${STK} RAKE ${RAKE} DIP ${DIP} FILE ${MODEL}/${HS}/${FILEPROTO}
shift F $TRUP
#  
ch EVLA ${EVLA} EVLO ${EVLO} STLA ${STLA} STLO ${STLO}
w
mv T.Z ../STACK/Z.${PBSUB}
mv T.N ../STACK/N.${PBSUB}
mv T.E ../STACK/E.${PBSUB}
q
EOF
cd ${MYTOP}
	done < ff.mod

#####
#     now perform the stacking
#     determine the minimum B time, maximum E time to define the cut window
#     determine the minimum A time to set the first srrival time on the stack
#     These offsets are with respect to the origin time
#####
cd STACK

#####
#    now use gsac to read all in and stack
#####
gsac << EOF
cuterr fillz
cut o o 300
r Z.????
stack absolute
w ../FINALZ/${STLA}_${STLO}.Z
r N.????
stack absolute
w ../FINALN/${STLA}_${STLO}.N
r E.????
stack absolute
w ../FINALE/${STLA}_${STLO}.E
q
EOF

}

#####
#    create a work area for making the synthetic for a sub-fault
#####
rm -fr WORK ; mkdir WORK

#####
#    create a work area to store synthetics for each finite fault
#    which will be used for the stack
#####
rm -fr STACK ; mkdir STACK

#####
#    create directory for final synthetics
#####
rm -fr FINALZ ; mkdir FINALZ
rm -fr FINALN ; mkdir FINALN
rm -fr FINALE ; mkdir FINALE



while [ "${ENDLATLOOP}" != "YES" ]
do
	while [ "${ENDLONLOOP}" != "YES" ]
	do
		#####
		#   process this LAT/LON coordinate
		#####
		cd ${MYTOP}
		do_process $LAT $LON
		LON=`echo $LON $DLON | awk '{print $1 + $2 }' `
		ENDLONLOOP=`echo ${LONMIN} ${LONMAX} ${LON} | awk '{ if ( $3 >= $1 && $3 <= $2 ) print "NO" ; else print "YES" }' ` 
	done
	#####
	# reset the LON loop
	#####
	ENDLONLOOP="NO"
	LON=${LONMIN}
	#####
	# increment and test latitude
	#####
	LAT=`echo ${LAT} ${DLAT} | awk '{print $1 + $2 }' `
	ENDLATLOOP=`echo ${LATMIN} ${LATMAX} ${LAT} | awk '{ if ( $3 >= $1 && $3 <= $2 ) print "NO" ; else print "YES" }' ` 
done


cd ${MYTOP} pwd
Last changed August 9, 2013