Version 2 - contributed by Alistair Harding:
# usage: ts2sio tsfile
# e.g. ts2sio /data/processed/0008/ts.n255 > sioseis_nav_file
# 2000+255:01:08:36.112 017382 N 32 13.2870 W 075 29.1645 test
#
while (<>)
{
my ($timestamp,$shotno,$ns,$latdeg,$latmin,$ew,$longdeg,$longmin)
= split /\s+/;
my ($year,$jday,$hour,$minute,$second) = split /\+|-|:/, $timestamp;
$latdeg = -$latdeg if ($ns eq "S");
$longdeg = -$longdeg if ($ew eq "W");
$, = " "; # separate output with a space
$\ = "\n"; # append newline
print($year,$jday,$hour,$minute,$second,
$latdeg,$latmin,$longdeg,$longmin,$shotno);
}
Version 1 - contributed by Paul Henkart
#!/usr/bin/perl
# usage: ts2sio tsfile
# e.g. ts2sio /data/processed/0008/ts.n255 > sioseis_nav_file
# 2000+255:01:08:36.112 017382 N 32 13.2870 W 075 29.1645 test
#
@lines = <>;
foreach $_ (@lines) { # put each line into $_
split(' '); # parse into array @_
$year = substr(@_[0],0,4);
$jday = substr(@_[0],5,3);
# A negative day means there's something wrong with the fix
# Use the following if you want to ignore the LDEO bad quality flag
$jday = substr(@_[0],5,3);
# Use the following if you want to flag bad fixes as negative day,
# which as of 10 October 2000 is not honored by SIOSEIS.
# $jday = substr(@_[0],4,4);
$hour = substr(@_[0],9,2);
$minute = substr(@_[0],12,2);
$second = substr(@_[0],15,6);
$latdeg = @_[3];
$shotno = @_[1];
if (@_[2] eq "S") { $latdeg = -$latdeg;}
$latmin = @_[4];
$longdeg = @_[6];
if (@_[5] eq "W") { $longdeg = -$longdeg;}
$longmin = @_[7];
print $year," ",$jday," ",$hour," ",$minute," ",$second," ",
$latdeg," ", $latmin," ", $longdeg," ", $longmin," ", $shotno,"\n";
}
Return to EW0008 example. Go to SIOSEIS examples.Go to the list of seismic processes. Go to SIOSEIS introduction.