PACS-SONET Data Inventory Update
Pilot balloon data / $countrynam{$mycountry}
Number of observations per month |
1-14 |
15-29 |
30-44 |
>= 45 |
Html_header_lines
columnhea(1);
foreach $site (@stncountry) {
if ($stncountry{$site} && $stncountry{$site} eq $mycountry)
{
countobs();
}
}
columnhea(2);
print "
";
print "";
print "\n";
#
sub countobs {
if (-d "/www2/httpd/htteams/pacs/data/$stncountry{$site}/$stndirs{$site}") {
chdir("/www2/httpd/htteams/pacs/data/$stncountry{$site}/$stndirs{$site}");
inirow($site);
# foreach $year ( @anio ) {
for($iyear = $iniyear{$mycountry}; $iyear <= $endyear{$mycountry}; $iyear++) {
$a2o = substr($iyear,2,2);
$year = "year" . $a2o;
if (-d "$year") {
chdir($year);
foreach $mes ( @monthseq ) {
if(-d "$mes$a2o") {
$count=0;
foreach (<$mes$a2o/*.WIN>) {
$count++;
}
$totobs{$mes . $a2o} = $totobs{$mes . $a2o} + $count;
if ($count > 0) { $totstn{$mes . $a2o}++;}
numobs($count,$stndirs{$site},$year,$mes,$a2o);
}
else {
nodatamo();
}
}
chdir("../");
}
else {
nodatayr();
}
}
endrow($site);
chdir("../");
}
} #end subcountobs
#
sub columnhea {
if($_[0] == 1) {
#
foreach $year (@anio) {
$a2o = substr($year,4,2);
foreach $mes (@monthseq) {
$totobs{$mes . $a2o} = 0;
$totstn{$mes . $a2o} = 0;
}
}
#
print " | ";
for($iyear = $iniyear{$mycountry}; $iyear <= $endyear{$mycountry}; $iyear++) {
print "$iyear | ";
}
print "
\n";
}
#
print " | ";
for($iyear = $iniyear{$mycountry}; $iyear <= $endyear{$mycountry}; $iyear++) {
foreach $mes (@monthfst) {
print "$mes | ";
}
}
print " |
\n";
if($_[0] == 2) {
#
$lastup = `date +"%m/%d/%Y"`;
$grandtot = 0;
print "Obs Stns | ";
for($iyear = $iniyear{$mycountry}; $iyear <= $endyear{$mycountry}; $iyear++) {
$a2o = substr($iyear,2,2);
foreach $mes (@monthseq) {
if($totobs{$mes . $a2o} > 0) {
print "$totobs{$mes . $a2o} $totstn{$mes . $a2o} | ";
}
else {
print " | ";
}
$grandtot = $grandtot + $totobs{$mes . $a2o};
}
}
print "$grandtot Obs Stns |
\n";
#
print " | ";
for($iyear = $iniyear{$mycountry}; $iyear <= $endyear{$mycountry}; $iyear++) {
print "$iyear | ";
}
print "Last updated: $lastup |
\n";
}
}
sub inirow {
print "$_[0] $stnnames{$_[0]} | \n";
}
sub endrow {
print "$_[0] $stnnames{$_[0]} ($countrynam{$stncountry{$_[0]}}) |
\n";
}
sub numobs {
$country=$stncountry{$site};
if($_[0] > 44) {
$color = "#a0d0ff";
}
elsif($_[0] > 29) {
$color = "#00ffff";
}
elsif($_[0] > 14) {
$color = "#00ff00";
}
elsif($_[0] > 0) {
$color = "#ffff00";
}
else {
$color = "#ffffff";
}
print "$_[0] ";
#
#Add a link to the server-parsed document that will be generated later
print "Gem | \n";
# Open and write to file
open (HTXT,">/www2/httpd/htteams/pacs/inventories/$country$_[1]$_[3]$_[4].shtml") || die "Imposible escribir hypertext\n";
print HTXT "PACS-SONET data $country $_[1] $_[3]$_[4]\n";
close HTXT;
}
#
sub nodatamo {
print " | ";
}
sub nodatayr {
for ($imonth = 1; $imonth <= 12 ; $imonth++) {
nodatamo();
}
}
sub noyear {
# do nothing
}