-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetectionCount.pl
More file actions
executable file
·53 lines (42 loc) · 1.05 KB
/
detectionCount.pl
File metadata and controls
executable file
·53 lines (42 loc) · 1.05 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
#! /usr/bin/env perl
#
# by Mark 2010.278
#
# USAGE
#####################################################################
$help = <<"EOF";
Usage: detectionCount.pl
-h print this help
EOF
#####################################################################
use Getopt::Std;
#use Geo::Distance;
#use Time::Local;
getopts('h');
print $help and exit if $opt_h;
$dbdir = "/Volumes/colza_HD/obs2007/detect/obs2007";
$sitetbl = "$dbdir.site";
$decttbl = "$dbdir.detection";
open(DBSITE, "<$sitetbl") or die("Can't open site file...");
while(<DBSITE>) {
@staline = split;
$obsname = $staline[0];
$rec{$obsname} = { lat => $staline[3],
lon => $staline[4],
elv => $staline[5]
};
}
close(DBSITE);
print "STA Depth # of Det\n";
foreach $obs (keys %rec) {
$count = 0;
open(DBDECT, "<$decttbl") or die("Can't open detection file...");
while(<DBDECT>) {
$count++ if ( m/$obs/ && m/D/ );
}
$rec{$obs}{detections} = $count;
close(DBDECT);
if ($rec{$obs}{detections}){
print "$obs $rec{$obs}{elv} $rec{$obs}{detections}\n";
}
}