-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreqfast_expl.pl
More file actions
executable file
·53 lines (44 loc) · 1.9 KB
/
breqfast_expl.pl
File metadata and controls
executable file
·53 lines (44 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /usr/bin/env perl
# Antelope database script
#
# breqfast_expl.pl starttime endtime sta_file label
use lib "$ENV{ANTELOPE}/data/perl/";
use Datascope;
$begtime = $ARGV[0];
$endtime = $ARGV[1];
$stafile = $ARGV[2]; # file with station info
$label = $ARGV[3]; # label of seed file
#$outfile = "iris_req_$label"; # name of email
#$cat_db = "$in_db"; # name of database w/ event info
#$begTimeOff = 60 * 2; # time before origin (sec)
#$endTimeOff = 60 * 5; # time after origin (sec)
$startTime = str2epoch($begtime);
$endTime = str2epoch($endtime);
($startyear, $startmonth, $startday, $starthour, $startmin, $startsec) = split(' ',epoch2str($startTime,'%Y %m %d %H %M %S.%s'));
($endyear, $endmonth, $endday, $endhour, $endmin, $endsec) = split(' ',epoch2str($endTime,'%Y %m %d %H %M %S.%s'));
open(FILEIN, "<" , $stafile) or die "Can't open $stafile: $!";
for ($ctr = 0; <FILEIN>; $ctr++) {
#($sta[$ctr], $lat[$ctr], $lon[$ctr], $net[$ctr]) = split(' ',$_);
($sta[$ctr], $net[$ctr]) = split(' ',$_);
}
close(FILEIN);
foreach (0 .. $#sta) {
$outfile = "iris_req_$sta[$_]_$label";
open(FILEOUT, ">" , $outfile) or die "Can't open $outfile: $!";
print FILEOUT ".NAME Mark Williams\n";
print FILEOUT ".INST Oregon State University\n" ;
print FILEOUT ".MAIL 104 COAS Admin, Corvallis, OR 97333\n";
print FILEOUT ".EMAIL mwilliams\@coas.oregonstate.edu\n" ;
print FILEOUT ".PHONE 541-737-2847\n" ;
print FILEOUT ".FAX 541-633-2064\n" ;
print FILEOUT ".MEDIA Electronic\n" ;
print FILEOUT ".ALTERNATE MEDIA Electronic\n" ;
print FILEOUT ".ALTERNATE MEDIA Electronic\n" ;
print FILEOUT ".LABEL $sta[$_]_$label\n" ;
print FILEOUT ".END\n\n" ;
print FILEOUT "$sta[$_] $net[$_] $startyear $startmonth $startday $starthour $startmin $startsec $endyear $endmonth $endday $endhour $endmin $endsec 3 BH? HH? EH?\n";
close(FILEOUT);
print "Wrote file: \"$outfile\"\n";
}
$temp = @sta;
print "Generated $temp request email(s).\n"