The "zero-time" of the cross-correlation is mainly just record keeping, and
really dependent on what you want to do with later. For example, if you
just wanted to plot your CC then you could account for the 300s shift in
whatever plotting method you're using (GMT, matlab/rsac, obspy).
If you have sac files and you really want to account for the shift in the
data file directly you can write a sac macro (for example);
#!/bin/bash
for file in *.SAC
do
echo "r $file" >> split.m
echo "ch b (-1.0 * ( &1,e - &1,b ) / 2.0)" >> split.m
echo "w $file" >> split.m
echo "quit" >> split.m
sac <<EOF>> sac.output
m split.m
quit
EOF
done
The above will add the offset to all the sac files in the current working
directory (and clobber!). More specifically, the line;
ch b (-1.0 * ( &1,e - &1,b ) / 2.0)
changes the beginning header value to be the negative time of one half the
length of the sac record. The ending sac header values are autocalculated.
If you're not used to writing sac macros, you can also do this in obspy,
but its more of a pain since changes made directly to certain fields of the
sac header are not written when the modified file is written to disk, e.g.
trace=obspy.read(file)[0]
trace.stats.sac.b=-(trace.stats.sac.e-trace.stats.sac.b)/2
trace.write(file,'SAC')
will NOT change the header times. You need to change the primary trace
header record;
trace=obspy.read(file)[0]
t_shift=(trace.stats.sac.e-trace.stats.sac.b)/2
new_starttime=trace.stats.starttime-datetime.timedelta(seconds=t_shift)
trace.stats.starttime=new_starttime
trace.write(file,'SAC')
-ashton
On Mon, Jun 12, 2017 at 4:53 AM, Crowder, Emily <emily.crowder(a)abdn.ac.uk>
wrote:
I have set "maxlag" to be 300 s, so I would
like cross-correlations
centred on zero, +/- 300 s. Instead, MSNoise is giving me
cross-correlations from 0 s to 600 s. In the SAC header B = 0.000000e+00,
and E = 6.000000e+02. Why is this happening? How can it be corrected?
Thanks in advance,
Emily
~~~~~~~~~~~~~~~~~~~~~~~~~
Emily Crowder MSc BSc
PhD Student
School of Geosciences
University of Aberdeen
Aberdeen AB24 3UE
Scotland
Em: emily.crowder(a)abdn.ac.uk
~~~~~~~~~~~~~~~~~~~~~~~~~
The University of Aberdeen is a charity registered in Scotland, No
SC013683.
Tha Oilthigh Obar Dheathain na charthannas clàraichte ann an Alba, Àir.
SC013683.
_______________________________________________
MSNoise mailing list
MSNoise(a)mailman-as.oma.be
http://mailman-as.oma.be/mailman/listinfo/msnoise
--
Ashton F. Flinders, Ph.D
U.S. Geological Survey
345 Middlefield Road
Menlo Park, CA 94025
(650) 329-5050