#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser); # version: 2002-03-07 # update: 2007-01-23 #$datadir="d:\\web\\weather\\regional\\data\\database"; #$datadir1="d:\\web\\weather\\regional\\data\\txt"; $datadir="/var/www/html/1STWX/regional/data/database"; $datadir1="/var/www/html/1STWX/regional/data/txt"; $query= new CGI; print $query->header; %cityName = ( 'Bethlehem', 'BETHLEHEM', 'Bloemfontein', 'BLOEMFONTEIN', 'Cape Town', 'CAPE TOWN INTERNATIONAL AIRPORT', 'Durban', 'DURBAN', 'East London', 'EAST LONDON', 'George', 'GEORGE', 'Johannesburg', 'JOHANNESBURG', 'Kimberley', 'KIMBERLEY', 'Ladysmith', 'LADYSMITH', 'Nelspruit', 'NELSPRUIT', 'Pietermaritzburg', 'PIETERMARITZBURG', 'Pietersburg', 'PIETERSBURG', 'Port Elizabeth', 'PORT ELIZABETH', 'Pretoria', 'PRETORIA', 'Richards Bay', 'RICHARDS BAY', 'Upington', 'UPINGTON', ); %citycode = ( 'Bethlehem', 'fabe', 'Bloemfontein', 'fabl', 'Cape Town', 'fact', 'Durban', 'fadn', 'East London', 'fael', 'George', 'fagg', 'Johannesburg', 'fajs', 'Kimberley', 'fakm', 'Ladysmith', 'fals', 'Nelspruit', 'fans', 'Pietermaritzburg', 'fapm', 'Pietersburg', 'fapb', 'Port Elizabeth', 'fape', 'Pretoria', 'fapr', 'Richards Bay', 'farb', 'Upington', 'faup', ); %raincities = ( 'George', '1', 'Cape Town', '1', 'Port Elizabeth', '1', 'East London', '1', 'Durban', '1', 'Richards Bay', '1', 'Pietermaritzburg', '1', 'Ladysmith', '1', 'Upington', '1', 'Kimberley', '1', 'Bloemfontein', '1', 'Bethlehem', '1', 'Pietersburg', '1', 'Nelspruit', '1', 'Johannesburg', '1', 'Pretoria', '1', ); if($query->param){ $city = $query->param('CITY'); $variable = $query->param('VARIABLE'); $year = $query->param('YEAR'); $citydir = $city; $citydir =~ s/ //g; #remove any spaces $citydir =~ tr/A-Z/a-z/; #make lower case } $month = "ALL"; $start = ((($year - 1960) * 12) + 1); $end = ((($year - 1960) * 12) + 12); if(($variable eq "MONTHLY RAINFALL DATA")||($variable eq "MAX 24HR RAINFALL")||($variable eq "TEMPERATURE CLIMATE DATA")){ print"

$cityName{$city}
$variable

"; } else{ print"

$cityName{$city}
$year
$variable

"; } print"If you use this data, you must read our disclaimer and accredit the SAWs
(South African Weather Service) and www.1stweather.com as sources!

Please wait while your data is being generated.......

"; $DATAFILE_TX="$datadir/$citycode{$city}_daily_TX.txt"; $DATAFILE_TN="$datadir/$citycode{$city}_daily_TN.txt"; $DATAFILE_TM="$datadir/$citycode{$city}_daily_TM.txt"; $DATAFILE_RAIN1="$datadir/$citycode{$city}_monthly_RR.txt"; $DATAFILE_RAIN2="$datadir/$citycode{$city}_max24_RR.txt"; $DATAFILE_RAIN3="$datadir/$citycode{$city}_daily_RR.txt"; $DATAFILE_TEMP1="$datadir/$citycode{$city}_monthly_TX.txt"; $DATAFILE_TEMP2="$datadir/$citycode{$city}_monthly_TM.txt"; $DATAFILE_TEMP3="$datadir/$citycode{$city}_monthly_TN.txt"; $DATAFILE_CA="$datadir/$citycode{$city}_monthly_CA.txt"; #&process_new_daily_rain($city); if($variable eq "DAILY MAXIMUM TEMPERATURE"){ open DATAFILE_TX or die "Can't open $DATAFILE_TX datafile : $!"; #print"DATAFILE = $DATAFILE_TX

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an date $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } &process(@temp, $year, $month, $variable); #&climate_days(@temp, $variable); print"

Request completed!"; exit; } elsif($variable eq "DAILY AVERAGE TEMPERATURE"){ open DATAFILE_TM or die "Can't open $DATAFILE_TM datafile : $!"; #print"DATAFILE = $DATAFILE_TM

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an id number $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } &process(@temp, $year, $month, $variable); #&climate_days(@temp, $variable); print"

Request completed!"; exit; } elsif($variable eq "DAILY MINIMUM TEMPERATURE"){ open DATAFILE_TN or die "Can't open $DATAFILE_TN datafile : $!"; #print"DATAFILE = $DATAFILE_TN

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } &process(@temp, $year, $month, $variable); #&climate_days(@temp, $variable); print"

Request completed!"; exit; } elsif($variable eq "MONTHLY RAINFALL DATA"){ if ($raincities{$city}) { open DATAFILE_RAIN1 or die "Can't open $DATAFILE_RAIN1 datafile : $!"; #print"DATAFILE = $DATAFILE_RAIN1

\n"; $n=0; while () { chomp; @rain = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $rain[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $rain[1]; # JAN etc $data[$n]{'02'} = $rain[2]; $data[$n]{'03'} = $rain[3]; $data[$n]{'04'} = $rain[4]; $data[$n]{'05'} = $rain[5]; $data[$n]{'06'} = $rain[6]; $data[$n]{'07'} = $rain[7]; $data[$n]{'08'} = $rain[8]; $data[$n]{'09'} = $rain[9]; $data[$n]{'10'} = $rain[10]; $data[$n]{'11'} = $rain[11]; $data[$n]{'12'} = $rain[12]; $data[$n]{'13'} = $rain[13]; # year tot } &process_rain1(@rain); print"

Request completed!"; exit; } else{ print"

Sorry, no data available for your requested city"; } } elsif($variable eq "MONTHLY & YEARLY MAXIMUM TEMPERATURE"){ open DATAFILE_TEMP1 or die "Can't open $DATAFILE_TEMP1 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; $var = "TX"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; # JAN etc $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; # year tot } &process_temp1(@temp, $var); print"

Request completed!"; exit; } elsif($variable eq "MONTHLY & YEARLY AVERAGE TEMPERATURE"){ open DATAFILE_TEMP2 or die "Can't open $DATAFILE_TEMP2 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; $var = "TM"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; # JAN etc $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; # year tot } &process_temp1(@temp, $var); print"

Request completed!"; exit; } elsif($variable eq "MONTHLY & YEARLY MINIMUM TEMPERATURE"){ open DATAFILE_TEMP3 or die "Can't open $DATAFILE_TEMP3 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; $var = "TN"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; # JAN etc $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; # year tot } &process_temp1(@temp, $var); print"

Request completed!"; exit; } elsif(($variable eq "MONTHLY TEMPERATURE GRAPHS")||($variable eq "ANNUAL TEMPERATURE GRAPHS")){ open DATAFILE_TEMP1 or die "Can't open $DATAFILE_TEMP1 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; while () { chomp; @temptx = split(/;/); # Split the line into the data fields. $n++; $datatx[$n]{'00'} = $temptx[0]; # First field is the date YYYY/MM $datatx[$n]{'01'} = $temptx[1]; # JAN etc $datatx[$n]{'02'} = $temptx[2]; $datatx[$n]{'03'} = $temptx[3]; $datatx[$n]{'04'} = $temptx[4]; $datatx[$n]{'05'} = $temptx[5]; $datatx[$n]{'06'} = $temptx[6]; $datatx[$n]{'07'} = $temptx[7]; $datatx[$n]{'08'} = $temptx[8]; $datatx[$n]{'09'} = $temptx[9]; $datatx[$n]{'10'} = $temptx[10]; $datatx[$n]{'11'} = $temptx[11]; $datatx[$n]{'12'} = $temptx[12]; $datatx[$n]{'13'} = $temptx[13]; # year tot } open DATAFILE_TEMP2 or die "Can't open $DATAFILE_TEMP2 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; while () { chomp; @temptn = split(/;/); # Split the line into the data fields. $n++; $datatn[$n]{'00'} = $temptn[0]; # First field is the date YYYY/MM $datatn[$n]{'01'} = $temptn[1]; # JAN etc $datatn[$n]{'02'} = $temptn[2]; $datatn[$n]{'03'} = $temptn[3]; $datatn[$n]{'04'} = $temptn[4]; $datatn[$n]{'05'} = $temptn[5]; $datatn[$n]{'06'} = $temptn[6]; $datatn[$n]{'07'} = $temptn[7]; $datatn[$n]{'08'} = $temptn[8]; $datatn[$n]{'09'} = $temptn[9]; $datatn[$n]{'10'} = $temptn[10]; $datatn[$n]{'11'} = $temptn[11]; $datatn[$n]{'12'} = $temptn[12]; $datatn[$n]{'13'} = $temptn[13]; # year tot } open DATAFILE_TEMP3 or die "Can't open $DATAFILE_TEMP3 datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $n=0; while () { chomp; @temptm = split(/;/); # Split the line into the data fields. $n++; $datatm[$n]{'00'} = $temptm[0]; # First field is the date YYYY/MM $datatm[$n]{'01'} = $temptm[1]; # JAN etc $datatm[$n]{'02'} = $temptm[2]; $datatm[$n]{'03'} = $temptm[3]; $datatm[$n]{'04'} = $temptm[4]; $datatm[$n]{'05'} = $temptm[5]; $datatm[$n]{'06'} = $temptm[6]; $datatm[$n]{'07'} = $temptm[7]; $datatm[$n]{'08'} = $temptm[8]; $datatm[$n]{'09'} = $temptm[9]; $datatm[$n]{'10'} = $temptm[10]; $datatm[$n]{'11'} = $temptm[11]; $datatm[$n]{'12'} = $temptm[12]; $datatm[$n]{'13'} = $temptm[13]; # year tot } &temp_graphs(@temptx,@temptn,@temptm,$year); print"

Request completed!"; exit; } elsif($variable eq "MAX 24HR RAINFALL"){ if ($raincities{$city}) { open DATAFILE_RAIN2 or die "Can't open $DATAFILE_RAIN2 datafile : $!"; #print"DATAFILE = $DATAFILE_RAIN2

\n"; while () { chomp; @rain = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $rain[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $rain[1]; # JAN max 24hr rainfall $data[$n]{'02'} = $rain[2]; # JAN day ofmax 24hr rainfall $data[$n]{'03'} = $rain[3]; $data[$n]{'04'} = $rain[4]; $data[$n]{'05'} = $rain[5]; $data[$n]{'06'} = $rain[6]; $data[$n]{'07'} = $rain[7]; $data[$n]{'08'} = $rain[8]; $data[$n]{'09'} = $rain[9]; $data[$n]{'10'} = $rain[10]; $data[$n]{'11'} = $rain[11]; $data[$n]{'12'} = $rain[12]; $data[$n]{'13'} = $rain[13]; $data[$n]{'14'} = $rain[14]; $data[$n]{'15'} = $rain[15]; $data[$n]{'16'} = $rain[16]; $data[$n]{'17'} = $rain[17]; $data[$n]{'18'} = $rain[18]; $data[$n]{'19'} = $rain[19]; $data[$n]{'20'} = $rain[20]; $data[$n]{'21'} = $rain[21]; $data[$n]{'22'} = $rain[22]; $data[$n]{'23'} = $rain[23]; $data[$n]{'24'} = $rain[24]; } &process_rain2(@rain, $year); print"

Request completed!"; exit; } else{ print"

Sorry, no data available for your requested city"; } } elsif($variable eq "DAILY RAINFALL DATA"){ if ($raincities{$city}) { open DATAFILE_RAIN3 or die "Can't open $DATAFILE_RAIN3 datafile : $!"; #print"DATAFILE = $DATAFILE_RAIN2

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an id number $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } &process(@temp, $year, $month, $variable); # &rain_graphs(@temp,$year); print"

Request completed!"; exit; } else{ print"

Sorry, no data available for your requested city - we're adding cities as fast as we can.
The monthly (1990-2000) and max24hr rainfall data is currently available!

CLick the BACK button on your browser to continue!

"; } } elsif($variable eq "MONTHLY RAINFALL GRAPHS"){ open DATAFILE_RAIN1 or die "Can't open $DATAFILE_RAIN1 datafile : $!"; $n=0; if ($raincities{$city}) { while () { chomp; @varrr = split(/;/); # Split the line into the data fields. $n++; $datarr[$n]{'00'} = $varrr[0]; # First field is the date YYYY/MM $datarr[$n]{'01'} = $varrr[1]; # JAN etc $datarr[$n]{'02'} = $varrr[2]; $datarr[$n]{'03'} = $varrr[3]; $datarr[$n]{'04'} = $varrr[4]; $datarr[$n]{'05'} = $varrr[5]; $datarr[$n]{'06'} = $varrr[6]; $datarr[$n]{'07'} = $varrr[7]; $datarr[$n]{'08'} = $varrr[8]; $datarr[$n]{'09'} = $varrr[9]; $datarr[$n]{'10'} = $varrr[10]; $datarr[$n]{'11'} = $varrr[11]; $datarr[$n]{'12'} = $varrr[12]; $datarr[$n]{'13'} = $varrr[13]; # year tot } &rain_graphs(@varrr,$year); print"

Request completed!"; exit; } else{ print"

Sorry, no data available for your requested city - we're adding cities as fast as we can.
The monthly (1990-2000) and max24hr rainfall data is currently available!

CLick the BACK button on your browser to continue!

"; } } elsif($variable eq "ALL DAILY TEMPERATURE VARIABLES"){ open DATAFILE_TX or die "Can't open $DATAFILE_TX datafile : $!"; open DATAFILE_TN or die "Can't open $DATAFILE_TN datafile : $!"; open DATAFILE_TM or die "Can't open $DATAFILE_TM datafile : $!"; $variable = "MAXIMUM TEMPERATURE"; #print"DATAFILE = $DATAFILE_TX $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an date $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; #print"MAX $data[$n]{'00'} $data[$n]{'01'}
"; } #print"MAX N= 469 : $data[469]{'00'} $data[469]{'01'} $data[469]{'02'} $data[469]{'03'} $data[469]{'04'} $data[469]{'05'} $data[469]{'06'} $data[469]{'07'} $data[469]{'08'} $data[469]{'09'} $data[469]{'10'} $data[469]{'11'} $data[469]{'12'} $data[469]{'13'} $data[469]{'14'} $data[469]{'15'} $data[469]{'16'} $data[469]{'17'} $data[469]{'18'} $data[469]{'19'} $data[469]{'20'}$data[469]{'21'} $data[469]{'22'} $data[469]{'23'} $data[469]{'24'} $data[469]{'25'} $data[469]{'26'} $data[469]{'27'} $data[469]{'28'} $data[469]{'29'} $data[469]{'30'} $data[469]{'31'}
"; &process(@temp, $year, $month, $variable); @temp = (); $n = 0; $sum = 0; $sum_tot = 0; $count = 0; $count_tot = 0; $variable = "MINIMUM TEMPERATURE"; $month = "ALL"; #print"DATAFILE = $DATAFILE_TN $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } #print"MIN N= 469 : $data[469]{'00'} $data[469]{'01'} $data[469]{'02'} $data[469]{'03'} $data[469]{'04'} $data[469]{'05'} $data[469]{'06'} $data[469]{'07'} $data[469]{'08'} $data[469]{'09'} $data[469]{'10'} $data[469]{'11'} $data[469]{'12'} $data[469]{'13'} $data[469]{'14'} $data[469]{'15'} $data[469]{'16'} $data[469]{'17'} $data[469]{'18'} $data[469]{'19'} $data[469]{'20'}$data[469]{'21'} $data[469]{'22'} $data[469]{'23'} $data[469]{'24'} $data[469]{'25'} $data[469]{'26'} $data[469]{'27'} $data[469]{'28'} $data[469]{'29'} $data[469]{'30'} $data[469]{'31'}
"; &process(@temp, $year, $month, $variable); @temp=(); $n = 0; $sum = 0; $sum_tot = 0; $count = 0; $count_tot = 0; $variable = "AVERAGE TEMPERATURE"; $month = "ALL"; #print"DATAFILE = $DATAFILE_TM $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an id number $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; #print"AVE $data[$n]{'00'} $data[$n]{'01'}
"; } &process(@temp, $year, $month, $variable); print"

Request completed!"; exit; } elsif($variable eq "DAILY TEMPERATURE CLIMATE DATA"){ open DATAFILE_TX or die "Can't open $DATAFILE_TX datafile : $!"; open DATAFILE_TN or die "Can't open $DATAFILE_TN datafile : $!"; open DATAFILE_TM or die "Can't open $DATAFILE_TM datafile : $!"; $variable = "DAILY MAXIMUM TEMPERATURE"; $variable1 = "TEMPERATURE CLIMATE DATA"; #print"DATAFILE = $DATAFILE_TX $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an date $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; #print"MAX $data[$n]{'00'} $data[$n]{'01'}
"; } for ($y = 1;$y <=$n; $y++){ # Calculate the number of months with no data for ($x = 1;$x <32; $x++){ $x = sprintf("%02d",$x); if($data[$y]{$x} eq "****"){ $day_no_tot++; } } if($day_no_tot > 29){ $month_no_tot++; } $day_no_tot = 0; } $tot_months = $n - $month_no_tot; #print "MONTHS : TOT = $n, MONTH NO = $month_no_tot: YES : $tot_months"; #print"MAX N= 469 : $data[469]{'00'} $data[469]{'01'} $data[469]{'02'} $data[469]{'03'} $data[469]{'04'} $data[469]{'05'} $data[469]{'06'} $data[469]{'07'} $data[469]{'08'} $data[469]{'09'} $data[469]{'10'} $data[469]{'11'} $data[469]{'12'} $data[469]{'13'} $data[469]{'14'} $data[469]{'15'} $data[469]{'16'} $data[469]{'17'} $data[469]{'18'} $data[469]{'19'} $data[469]{'20'}$data[469]{'21'} $data[469]{'22'} $data[469]{'23'} $data[469]{'24'} $data[469]{'25'} $data[469]{'26'} $data[469]{'27'} $data[469]{'28'} $data[469]{'29'} $data[469]{'30'} $data[469]{'31'}
"; &climate_days(@temp, $variable,$tot_months); @temp = (); $n = 0; $sum = 0; $sum_tot = 0; $count = 0; $count_tot = 0; $variable = "DAILY MINIMUM TEMPERATURE"; $month = "ALL"; $day_no_tot = 0; $tot_months = 0; $month_no_tot = 0; #print"DATAFILE = $DATAFILE_TN $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is the date YYYY/MM $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; } for ($y = 1;$y <=$n; $y++){ # Calculate the number of months with no data for ($x = 1;$x <32; $x++){ $x = sprintf("%02d",$x); if($data[$y]{$x} eq "****"){ $day_no_tot++; } } if($day_no_tot > 29){ $month_no_tot++; } $day_no_tot = 0; } $tot_months = $n - $month_no_tot; #print "MONTHS : TOT = $n, MONTH NO = $month_no_tot: YES : $tot_months"; #print"MIN N= 469 : $data[469]{'00'} $data[469]{'01'} $data[469]{'02'} $data[469]{'03'} $data[469]{'04'} $data[469]{'05'} $data[469]{'06'} $data[469]{'07'} $data[469]{'08'} $data[469]{'09'} $data[469]{'10'} $data[469]{'11'} $data[469]{'12'} $data[469]{'13'} $data[469]{'14'} $data[469]{'15'} $data[469]{'16'} $data[469]{'17'} $data[469]{'18'} $data[469]{'19'} $data[469]{'20'}$data[469]{'21'} $data[469]{'22'} $data[469]{'23'} $data[469]{'24'} $data[469]{'25'} $data[469]{'26'} $data[469]{'27'} $data[469]{'28'} $data[469]{'29'} $data[469]{'30'} $data[469]{'31'}
"; &climate_days(@temp, $variable, $tot_months); @temp=(); $n = 0; $sum = 0; $sum_tot = 0; $count = 0; $count_tot = 0; $variable = "DAILY AVERAGE TEMPERATURE"; $month = "ALL"; $day_no_tot =0; $tot_months = 0; $month_no_tot = 0; #print"DATAFILE = $DATAFILE_TM $variable $month/$year

\n"; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $temp[0]; # First field is an id number $data[$n]{'01'} = $temp[1]; $data[$n]{'02'} = $temp[2]; $data[$n]{'03'} = $temp[3]; $data[$n]{'04'} = $temp[4]; $data[$n]{'05'} = $temp[5]; $data[$n]{'06'} = $temp[6]; $data[$n]{'07'} = $temp[7]; $data[$n]{'08'} = $temp[8]; $data[$n]{'09'} = $temp[9]; $data[$n]{'10'} = $temp[10]; $data[$n]{'11'} = $temp[11]; $data[$n]{'12'} = $temp[12]; $data[$n]{'13'} = $temp[13]; $data[$n]{'14'} = $temp[14]; $data[$n]{'15'} = $temp[15]; $data[$n]{'16'} = $temp[16]; $data[$n]{'17'} = $temp[17]; $data[$n]{'18'} = $temp[18]; $data[$n]{'19'} = $temp[19]; $data[$n]{'20'} = $temp[20]; $data[$n]{'21'} = $temp[21]; $data[$n]{'22'} = $temp[22]; $data[$n]{'23'} = $temp[23]; $data[$n]{'24'} = $temp[24]; $data[$n]{'25'} = $temp[25]; $data[$n]{'26'} = $temp[26]; $data[$n]{'27'} = $temp[27]; $data[$n]{'28'} = $temp[28]; $data[$n]{'29'} = $temp[29]; $data[$n]{'30'} = $temp[30]; $data[$n]{'31'} = $temp[31]; #print"AVE $data[$n]{'00'} $data[$n]{'01'}
"; } for ($y = 1;$y <=$n; $y++){ # Calculate the number of months with no data for ($x = 1;$x <32; $x++){ $x = sprintf("%02d",$x); if($data[$y]{$x} eq "****"){ $day_no_tot++; } } if($day_no_tot > 29){ $month_no_tot++; } $day_no_tot = 0; } $tot_months = $n - $month_no_tot; #print "MONTHS : TOT = $n, MONTH NO = $month_no_tot: YES : $tot_months"; &climate_days(@temp, $variable,$tot_months); print"

Request completed!"; exit; } sub process{ $maxn = 0; # A counter for the number of entries. $yeartot = 0; $mon=0; if ($month ne "ALL"){ &month(@temp, $year, $month, $variable); } else{ &year(@temp, $year, $month, $variable); } #MONTHLY SUBROUTINE sub month{ $fonts{1} = ""; $fonts{2} = ""; $fonts{3} = ""; $fonts{4} = ""; $fonts{5} = ""; $fonts{6} = ""; $fonts{7} = ""; $fonts{8} = ""; $fonts{9} = ""; $fonts{10} = ""; $fonts{11} = ""; $fonts{12} = ""; $fonts{13} = ""; $fonts{14} = ""; $fonts{15} = ""; $fonts{16} = ""; $fonts{17} = ""; $fonts{18} = ""; $fonts{19} = ""; $fonts{20} = ""; $fonts{21} = ""; $fonts{22} = ""; $fonts{23} = ""; $fonts{24} = ""; $fonts{25} = ""; $fonts{26} = ""; $fonts{27} = ""; $fonts{28} = ""; $fonts{29} = ""; $fonts{30} = ""; $fonts{31} = ""; #print "MONTH = '$month'"; if($month eq "01"){ $n = ((($year - 1960) * 12) + 1); } if($month eq "02"){ $n = ((($year - 1960) * 12) + 2); } if($month eq "03"){ $n = ((($year - 1960) * 12) + 3); } if($month eq "04"){ $n = ((($year - 1960) * 12) + 4); } if($month eq "05"){ $n = ((($year - 1960) * 12) + 5); } if($month eq "06"){ $n = ((($year - 1960) * 12) + 6); } if($month eq "07"){ $n = ((($year - 1960) * 12) + 7); } if($month eq "08"){ $n = ((($year - 1960) * 12) + 8); } if($month eq "09"){ $n = ((($year - 1960) * 12) + 9); } if($month eq "10"){ $n = ((($year - 1960) * 12) + 10); } if($month eq "11"){ $n = ((($year - 1960) * 12) + 11); } if($month eq "12"){ $n = ((($year - 1960) * 12) + 12); } #print "

"; $len = length($data[$n]{'29'}); #print "$data[$n]{'00'}: 29 = |$data[$n]{'29'}| AND LENGTH = $len
"; if($len < 1 ){ $data[$n]{'29'} = "****"; #print "$data[$n]{'00'}: $data[$n]{'29'} AND LENGTH = $len

"; } $len = length($data[$n]{'30'}); #print "$data[$n]{'00'}: 30 = |$data[$n]{'30'}| AND LENGTH = $len
"; if($len < 1){ $data[$n]{'30'} = "****"; #print "$data[$n]{'00'}: $data[$n]{'30'} AND LENGTH = $len

"; } $len = length($data[$n]{'31'}); #print "$data[$n]{'00'}: 31 = |$data[$n]{'31'}| AND LENGTH = $len
"; if($len < 1){ $data[$n]{'31'} = "****"; #print "$data[$n]{'00'}: $data[$n]{'31'} AND LENGTH = $len

"; } #print "MONTH = '$month'"; #print "N = '$n'"; &data_routine(@temp, $n, $month); if($count < 1){ print"No data available for $data_date[$n]!"; exit; } #print "

PRE-TABLE....
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20}$data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'} $data[$n]{'25'} $data[$n]{'26'} $data[$n]{'27'} $data[$n]{'28'} $data[$n]{'29'} $data[$n]{'30'} $data[$n]{'31'}
"; print"
$year$month
01$fonts{1}$data[$n]{'01'}
02$fonts{2}$data[$n]{'02'}
03$fonts{3}$data[$n]{'03'}
04$fonts{4}$data[$n]{'04'}
05$fonts{5}$data[$n]{'05'}
06$fonts{6}$data[$n]{'06'}
07$fonts{7}$data[$n]{'07'}
08$fonts{8}$data[$n]{'08'}
09$fonts{9}$data[$n]{'09'}
10$fonts{10}$data[$n]{'10'}
11$fonts{11}$data[$n]{'11'}
12$fonts{12}$data[$n]{'12'}
13$fonts{13}$data[$n]{'13'}
14$fonts{14}$data[$n]{'14'}
15$fonts{15}$data[$n]{'15'}
16$fonts{16}$data[$n]{'16'}
17$fonts{17}$data[$n]{'17'}
18$fonts{18}$data[$n]{'18'}
19$fonts{19}$data[$n]{'19'}
20$fonts{20}$data[$n]{'20'}
21$fonts{21}$data[$n]{'21'}
22$fonts{22}$data[$n]{'22'}
23$fonts{23}$data[$n]{'23'}
24$fonts{24}$data[$n]{'24'}
25$fonts{25}$data[$n]{'25'}
26$fonts{26}$data[$n]{'26'}
27$fonts{27}$data[$n]{'27'}
28$fonts{28}$data[$n]{'28'}
29$fonts{29}$data[$n]{'29'}
30$fonts{30}$data[$n]{'30'}
31$fonts{31}$data[$n]{'31'}
"; $ave_temp = sprintf("%02.1f", $sum/$count); $hi_temp = sprintf("%02.1f", $hi_temp); $lo_temp = sprintf("%02.1f", $lo_temp); print "

STATISTICS : $cityName{$city} ($month/$year)

"; print"Total days with data = $count
"; print"AVE $variable = $ave_temp °C
"; print"HIGHEST $variable = $hi_temp °C recorded on $day_hi_temp
"; print"LOWEST $variable = $lo_temp °C recorded on $day_lo_temp
"; exit; } # YEARLY SUBROUTINE # sub year{ for($x = 0; $x <= $n; $x++){ $fonts[$x]{1} = ""; $fonts[$x]{2} = ""; $fonts[$x]{3} = ""; $fonts[$x]{4} = ""; $fonts[$x]{5} = ""; $fonts[$x]{6} = ""; $fonts[$x]{7} = ""; $fonts[$x]{8} = ""; $fonts[$x]{9} = ""; $fonts[$x]{10} = ""; $fonts[$x]{11} = ""; $fonts[$x]{12} = ""; $fonts[$x]{13} = ""; $fonts[$x]{14} = ""; $fonts[$x]{15} = ""; $fonts[$x]{16} = ""; $fonts[$x]{17} = ""; $fonts[$x]{18} = ""; $fonts[$x]{19} = ""; $fonts[$x]{20} = ""; $fonts[$x]{21} = ""; $fonts[$x]{22} = ""; $fonts[$x]{23} = ""; $fonts[$x]{24} = ""; $fonts[$x]{25} = ""; $fonts[$x]{26} = ""; $fonts[$x]{27} = ""; $fonts[$x]{28} = ""; $fonts[$x]{29} = ""; $fonts[$x]{30} = ""; $fonts[$x]{31} = ""; } $day_40 = 0; $day_35 = 0; $day_30 = 0; $day_more_25 = 0; $day_less_25 = 0; $day_more_20 = 0; $day_less_20 = 0; $day_more_15 = 0; $day_less_15 = 0; $day_less_10 = 0; $day_more_10 = 0; $day_5 = 0; $day_0 = 0; $day_m5 = 0; #JAN $month = "01"; $n = ((($year - 1960) * 12) + 1); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20'}$data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'} $data[$n]{'25'} $data[$n]{'26'} $data[$n]{'27'} $data[$n]{'28'} $data[$n]{'29'} $data[$n]{'30'} $data[$n]{'31'}
"; &check_no_data(@temp, $n); $no_data_01 = $no_data; #print"$no_data_01
"; &data_routine(@temp, $n, $month); $count_01 = $count; $sum_01 = $sum; $count_tot = $count_tot + $count_01; $sum_tot = $sum_tot + $sum_01; if($count_01 < 1){ $ave_temp_01 = "N/A"; $hi_temp_01 = "N/A"; $lo_temp_01 = "N/A"; $day_hi_temp_01 = "N/A"; $day_lo_temp_01 = "N/A"; } else{ $ave_temp_01 = sprintf("%02.1f", $sum_01/$count_01); $hi_temp_01 = sprintf("%02.1f", $hi_temp); $lo_temp_01 = sprintf("%02.1f", $lo_temp); $day_hi_temp_01 = $day_hi_temp; $day_lo_temp_01 = $day_lo_temp; } #FEB $month = "02"; $n = ((($year - 1960) * 12) + 2); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_02 = $no_data; #print"$no_data_02
"; &data_routine(@temp, $n, $month); $count_02 = $count; $sum_02 = $sum; $count_tot = $count_tot + $count_02; $sum_tot = $sum_tot + $sum_02; if($count_02 < 1){ $ave_temp_02 = "N/A"; $hi_temp_02 = "N/A"; $lo_temp_02 = "N/A"; $day_hi_temp_02 = "N/A"; $day_lo_temp_02 = "N/A"; } else{ $ave_temp_02 = sprintf("%02.1f", $sum_02/$count_02); $hi_temp_02 = sprintf("%02.1f", $hi_temp); $lo_temp_02 = sprintf("%02.1f", $lo_temp); $day_hi_temp_02 = $day_hi_temp; $day_lo_temp_02 = $day_lo_temp; } #MAR $month = "03"; $n = ((($year - 1960) * 12) + 3); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_03 = $no_data; #print"$no_data_03
"; &data_routine(@temp, $n, $month); $count_03 = $count; $sum_03 = $sum; $count_tot = $count_tot + $count_03; $sum_tot = $sum_tot + $sum_03; if($count_03 < 1){ $ave_temp_03 = "N/A"; $hi_temp_03 = "N/A"; $lo_temp_03 = "N/A"; $day_hi_temp_03 = "N/A"; $day_lo_temp_03 = "N/A"; } else{ $ave_temp_03 = sprintf("%02.1f", $sum_03/$count_03); $hi_temp_03 = sprintf("%02.1f", $hi_temp); $lo_temp_03 = sprintf("%02.1f", $lo_temp); $day_hi_temp_03 = $day_hi_temp; $day_lo_temp_03 = $day_lo_temp; } #APR $month = "04"; $n = ((($year - 1960) * 12) + 4); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_04 = $no_data; &data_routine(@temp, $n, $month); $count_04 = $count; $sum_04 = $sum; $count_tot = $count_tot + $count_04; $sum_tot = $sum_tot + $sum_04; if($count_04 < 1){ $ave_temp_04 = "N/A"; $hi_temp_04 = "N/A"; $lo_temp_04 = "N/A"; $day_hi_temp_04 = "N/A"; $day_lo_temp_04 = "N/A"; } else{ $ave_temp_04 = sprintf("%02.1f", $sum_04/$count_04); $hi_temp_04 = sprintf("%02.1f", $hi_temp); $lo_temp_04 = sprintf("%02.1f", $lo_temp); $day_hi_temp_04 = $day_hi_temp; $day_lo_temp_04 = $day_lo_temp; } #MAY $month = "05"; $n = ((($year - 1960) * 12) + 5); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_05 = $no_data; &data_routine(@temp, $n, $month); $count_05 = $count; $sum_05 = $sum; $count_tot = $count_tot + $count_05; $sum_tot = $sum_tot + $sum_05; if($count_05 < 1){ $ave_temp_05 = "N/A"; $hi_temp_05 = "N/A"; $lo_temp_05 = "N/A"; $day_hi_temp_05 = "N/A"; $day_lo_temp_05 = "N/A"; } else{ $ave_temp_05 = sprintf("%02.1f", $sum_05/$count_05); $hi_temp_05 = sprintf("%02.1f", $hi_temp); $lo_temp_05 = sprintf("%02.1f", $lo_temp); $day_hi_temp_05 = $day_hi_temp; $day_lo_temp_05 = $day_lo_temp; } #JUN $month = "06"; $n = ((($year - 1960) * 12) + 6); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_06 = $no_data; &data_routine(@temp, $n, $month); $count_06 = $count; $sum_06 = $sum; $count_tot = $count_tot + $count_06; $sum_tot = $sum_tot + $sum_06; if($count_06 < 1){ $ave_temp_06 = "N/A"; $hi_temp_06 = "N/A"; $lo_temp_06 = "N/A"; $day_hi_temp_06 = "N/A"; $day_lo_temp_06 = "N/A"; } else{ $ave_temp_06 = sprintf("%02.1f", $sum_06/$count_06); $hi_temp_06 = sprintf("%02.1f", $hi_temp); $lo_temp_06 = sprintf("%02.1f", $lo_temp); $day_hi_temp_06 = $day_hi_temp; $day_lo_temp_06 = $day_lo_temp; } #JUL $month = "07"; $n = ((($year - 1960) * 12) + 7); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_07 = $no_data; &data_routine(@temp, $n, $month); $count_07 = $count; $sum_07 = $sum; $count_tot = $count_tot + $count_07; $sum_tot = $sum_tot + $sum_07; if($count_07 < 1){ $ave_temp_07 = "N/A"; $hi_temp_07 = "N/A"; $lo_temp_07 = "N/A"; $day_hi_temp_07 = "N/A"; $day_lo_temp_07 = "N/A"; } else{ $ave_temp_07 = sprintf("%02.1f", $sum_07/$count_07); $hi_temp_07 = sprintf("%02.1f", $hi_temp); $lo_temp_07 = sprintf("%02.1f", $lo_temp); $day_hi_temp_07 = $day_hi_temp; $day_lo_temp_07 = $day_lo_temp; } #AUG $month = "08"; $n = ((($year - 1960) * 12) + 8); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_08 = $no_data; &data_routine(@temp, $n, $month); $count_08 = $count; $sum_08 = $sum; $count_tot = $count_tot + $count_08; $sum_tot = $sum_tot + $sum_08; if($count_08 < 1){ $ave_temp_08 = "N/A"; $hi_temp_08 = "N/A"; $lo_temp_08 = "N/A"; $day_hi_temp_08 = "N/A"; $day_lo_temp_08 = "N/A"; } else{ $ave_temp_08 = sprintf("%02.1f", $sum_08/$count_08); $hi_temp_08 = sprintf("%02.1f", $hi_temp); $lo_temp_08 = sprintf("%02.1f", $lo_temp); $day_hi_temp_08 = $day_hi_temp; $day_lo_temp_08 = $day_lo_temp; } #SEP $month = "09"; $n = ((($year - 1960) * 12) + 9); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_09 = $no_data; &data_routine(@temp, $n, $month); $count_09 = $count; $sum_09 = $sum; $count_tot = $count_tot + $count_09; $sum_tot = $sum_tot + $sum_09; if($count_09 < 1){ $ave_temp_09 = "N/A"; $hi_temp_09 = "N/A"; $lo_temp_09 = "N/A"; $day_hi_temp_09 = "N/A"; $day_lo_temp_09 = "N/A"; } else{ $ave_temp_09 = sprintf("%02.1f", $sum_09/$count_09); $hi_temp_09 = sprintf("%02.1f", $hi_temp); $lo_temp_09 = sprintf("%02.1f", $lo_temp); $day_hi_temp_09 = $day_hi_temp; $day_lo_temp_09 = $day_lo_temp; } #OCT $month = "10"; $n = ((($year - 1960) * 12) + 10); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_10 = $no_data; &data_routine(@temp, $n, $month); $count_10 = $count; $sum_10 = $sum; $count_tot = $count_tot + $count_10; $sum_tot = $sum_tot + $sum_10; if($count_10 < 1){ $ave_temp_10 = "N/A"; $hi_temp_10 = "N/A"; $lo_temp_10 = "N/A"; $day_hi_temp_10 = "N/A"; $day_lo_temp_10 = "N/A"; } else{ $ave_temp_10 = sprintf("%02.1f", $sum_10/$count_10); $hi_temp_10 = sprintf("%02.1f", $hi_temp); $lo_temp_10 = sprintf("%02.1f", $lo_temp); $day_hi_temp_10 = $day_hi_temp; $day_lo_temp_10 = $day_lo_temp; } #NOV $month = "11"; $n = ((($year - 1960) * 12) + 11); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_11 = $no_data; &data_routine(@temp, $n, $month); $count_11 = $count; $sum_11 = $sum; $count_tot = $count_tot + $count_11; $sum_tot = $sum_tot + $sum_11; if($count_11 < 1){ $ave_temp_11 = "N/A"; $hi_temp_11 = "N/A"; $lo_temp_11 = "N/A"; $day_hi_temp_11 = "N/A"; $day_lo_temp_11 = "N/A"; } else{ $ave_temp_11 = sprintf("%02.1f", $sum_11/$count_11); $hi_temp_11 = sprintf("%02.1f", $hi_temp); $lo_temp_11 = sprintf("%02.1f", $lo_temp); $day_hi_temp_11 = $day_hi_temp; $day_lo_temp_11 = $day_lo_temp; } #DEC $month = "12"; $n = ((($year - 1960) * 12) + 12); $len = length($data[$n]{'29'}); if($len < 1 ){ $data[$n]{'29'} = "****"; } $len = length($data[$n]{'30'}); if($len < 1){ $data[$n]{'30'} = "****"; } $len = length($data[$n]{'31'}); if($len < 1){ $data[$n]{'31'} = "****"; } &check_no_data(@temp, $n); $no_data_12 = $no_data; &data_routine(@temp, $n, $month); $count_12 = $count; $sum_12 = $sum; $count_tot = $count_tot + $count_12; $sum_tot = $sum_tot + $sum_12; if($count_12 < 1){ $ave_temp_12 = "N/A"; $hi_temp_12 = "N/A"; $lo_temp_12 = "N/A"; $day_hi_temp_12 = "N/A"; $day_lo_temp_12 = "N/A"; } else{ $ave_temp_12 = sprintf("%02.1f", $sum_12/$count_12); $hi_temp_12 = sprintf("%02.1f", $hi_temp); $lo_temp_12 = sprintf("%02.1f", $lo_temp); $day_hi_temp_12 = $day_hi_temp; $day_lo_temp_12 = $day_lo_temp; } if($variable1 eq "TEMPERATURE CLIMATE DATA"){ return } else{ & climate_info($DATAFILE_CA); # get the climatic averages $sum_01 = sprintf("%03.1f", $sum_01); #rainfall totals $sum_02 = sprintf("%03.1f", $sum_02); #rainfall totals $sum_03 = sprintf("%03.1f", $sum_03); #rainfall totals $sum_04 = sprintf("%03.1f", $sum_04); #rainfall totals $sum_05 = sprintf("%03.1f", $sum_05); #rainfall totals $sum_06 = sprintf("%03.1f", $sum_06); #rainfall totals $sum_07 = sprintf("%03.1f", $sum_07); #rainfall totals $sum_08 = sprintf("%03.1f", $sum_08); #rainfall totals $sum_09 = sprintf("%03.1f", $sum_09); #rainfall totals $sum_10 = sprintf("%03.1f", $sum_10); #rainfall totals $sum_11 = sprintf("%03.1f", $sum_11); #rainfall totals $sum_12 = sprintf("%03.1f", $sum_12); #rainfall totals $rain_percent_01 = sprintf("%02d",($sum_01/$MONTHLY_AVG_RR[0])*100); $rain_percent_02 = sprintf("%02d",($sum_02/$MONTHLY_AVG_RR[1])*100); $rain_percent_03 = sprintf("%02d",($sum_03/$MONTHLY_AVG_RR[2])*100); $rain_percent_04 = sprintf("%02d",($sum_04/$MONTHLY_AVG_RR[3])*100); $rain_percent_05 = sprintf("%02d",($sum_05/$MONTHLY_AVG_RR[4])*100); $rain_percent_06 = sprintf("%02d",($sum_06/$MONTHLY_AVG_RR[5])*100); $rain_percent_07 = sprintf("%02d",($sum_07/$MONTHLY_AVG_RR[6])*100); $rain_percent_08 = sprintf("%02d",($sum_08/$MONTHLY_AVG_RR[7])*100); $rain_percent_09 = sprintf("%02d",($sum_09/$MONTHLY_AVG_RR[8])*100); $rain_percent_10 = sprintf("%02d",($sum_10/$MONTHLY_AVG_RR[9])*100); $rain_percent_11 = sprintf("%02d",($sum_11/$MONTHLY_AVG_RR[10])*100); $rain_percent_12 = sprintf("%02d",($sum_12/$MONTHLY_AVG_RR[11])*100); $rain_percent_year = sprintf("%02d",($sum_tot/$MONTHLY_AVG_RR[12])*100); if($no_data_01 == 31){ $sum_01 = "N/A"; $rain_percent_01 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_01 = "N/A"; } if($no_data_02 >= 28){ $sum_02 = "N/A"; $rain_percent_02 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_02 = "N/A"; } if($no_data_03 == 31){ $sum_03 = "N/A"; $rain_percent_03 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_03 = "N/A"; } if($no_data_04 == 30){ $sum_04 = "N/A"; $rain_percent_04 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_04 = "N/A"; } if($no_data_05 == 31){ $sum_05 = "N/A"; $rain_percent_05 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_05 = "N/A"; } if($no_data_06 == 30){ $sum_06 = "N/A"; $rain_percent_06 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_06 = "N/A"; } if($no_data_07 == 31){ $sum_07 = "N/A"; $rain_percent_07 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_07 = "N/A"; } if($no_data_08 == 31){ $sum_08 = "N/A"; $rain_percent_08 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_08 = "N/A"; } if($no_data_09 == 30){ $sum_09 = "N/A"; $rain_percent_09 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_09 = "N/A"; } if($no_data_10 == 31){ $sum_10 = "N/A"; $rain_percent_10 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_10 = "N/A"; } if($no_data_11 == 30){ $sum_11 = "N/A"; $rain_percent_11 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_11 = "N/A"; } if($no_data_12 == 31){ $sum_12 = "N/A"; $rain_percent_12 = "N/A"; $rain_percent_year = "N/A"; $sum_tot = "N/A"; $count_tot = "N/A"; $count_12 = "N/A"; } print"

"; if($variable eq "DAILY RAINFALL DATA"){ print"
$cityName{$city}
$year
$variable
$year JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
01 $fonts[$n-11]{1}$data[$n-11]{'01'} $fonts[$n-10]{1}$data[$n-10]{'01'} $fonts[$n-9]{1}$data[$n-9]{'01'} $fonts[$n-8]{1}$data[$n-8]{'01'} $fonts[$n-7]{1}$data[$n-7]{'01'} $fonts[$n-6]{1}$data[$n-6]{'01'} $fonts[$n-5]{1}$data[$n-5]{'01'} $fonts[$n-4]{1}$data[$n-4]{'01'} $fonts[$n-3]{1}$data[$n-3]{'01'} $fonts[$n-2]{1}$data[$n-2]{'01'} $fonts[$n-1]{1}$data[$n-1]{'01'} $fonts[$n]{1}$data[$n]{'01'}
02 $fonts[$n-11]{2}$data[$n-11]{'02'} $fonts[$n-10]{2}$data[$n-10]{'02'} $fonts[$n-9]{2}$data[$n-9]{'02'} $fonts[$n-8]{2}$data[$n-8]{'02'} $fonts[$n-7]{2}$data[$n-7]{'02'} $fonts[$n-6]{2}$data[$n-6]{'02'} $fonts[$n-5]{2}$data[$n-5]{'02'} $fonts[$n-4]{2}$data[$n-4]{'02'} $fonts[$n-3]{2}$data[$n-3]{'02'} $fonts[$n-2]{2}$data[$n-2]{'02'} $fonts[$n-1]{2}$data[$n-1]{'02'} $fonts[$n]{2}$data[$n]{'02'}
03 $fonts[$n-11]{3}$data[$n-11]{'03'} $fonts[$n-10]{3}$data[$n-10]{'03'} $fonts[$n-9]{3}$data[$n-9]{'03'} $fonts[$n-8]{3}$data[$n-8]{'03'} $fonts[$n-7]{3}$data[$n-7]{'03'} $fonts[$n-6]{3}$data[$n-6]{'03'} $fonts[$n-5]{3}$data[$n-5]{'03'} $fonts[$n-4]{3}$data[$n-4]{'03'} $fonts[$n-3]{3}$data[$n-3]{'03'} $fonts[$n-2]{3}$data[$n-2]{'03'} $fonts[$n-1]{3}$data[$n-1]{'03'} $fonts[$n]{3}$data[$n]{'03'}
04 $fonts[$n-11]{4}$data[$n-11]{'04'} $fonts[$n-10]{4}$data[$n-10]{'04'} $fonts[$n-9]{4}$data[$n-9]{'04'} $fonts[$n-8]{4}$data[$n-8]{'04'} $fonts[$n-7]{4}$data[$n-7]{'04'} $fonts[$n-6]{4}$data[$n-6]{'04'} $fonts[$n-5]{4}$data[$n-5]{'04'} $fonts[$n-4]{4}$data[$n-4]{'04'} $fonts[$n-3]{4}$data[$n-3]{'04'} $fonts[$n-2]{4}$data[$n-2]{'04'} $fonts[$n-1]{4}$data[$n-1]{'04'} $fonts[$n]{4}$data[$n]{'04'}
05 $fonts[$n-11]{5}$data[$n-11]{'05'} $fonts[$n-10]{5}$data[$n-10]{'05'} $fonts[$n-9]{5}$data[$n-9]{'05'} $fonts[$n-8]{5}$data[$n-8]{'05'} $fonts[$n-7]{5}$data[$n-7]{'05'} $fonts[$n-6]{5}$data[$n-6]{'05'} $fonts[$n-5]{5}$data[$n-5]{'05'} $fonts[$n-4]{5}$data[$n-4]{'05'} $fonts[$n-3]{5}$data[$n-3]{'05'} $fonts[$n-2]{5}$data[$n-2]{'05'} $fonts[$n-1]{5}$data[$n-1]{'05'} $fonts[$n]{5}$data[$n]{'05'}
06 $fonts[$n-11]{6}$data[$n-11]{'06'} $fonts[$n-10]{6}$data[$n-10]{'06'} $fonts[$n-9]{6}$data[$n-9]{'06'} $fonts[$n-8]{6}$data[$n-8]{'06'} $fonts[$n-7]{6}$data[$n-7]{'06'} $fonts[$n-6]{6}$data[$n-6]{'06'} $fonts[$n-5]{6}$data[$n-5]{'06'} $fonts[$n-4]{6}$data[$n-4]{'06'} $fonts[$n-3]{6}$data[$n-3]{'06'} $fonts[$n-2]{6}$data[$n-2]{'06'} $fonts[$n-1]{6}$data[$n-1]{'06'} $fonts[$n]{6}$data[$n]{'06'}
07 $fonts[$n-11]{7}$data[$n-11]{'07'} $fonts[$n-10]{7}$data[$n-10]{'07'} $fonts[$n-9]{7}$data[$n-9]{'07'} $fonts[$n-8]{7}$data[$n-8]{'07'} $fonts[$n-7]{7}$data[$n-7]{'07'} $fonts[$n-6]{7}$data[$n-6]{'07'} $fonts[$n-5]{7}$data[$n-5]{'07'} $fonts[$n-4]{7}$data[$n-4]{'07'} $fonts[$n-3]{7}$data[$n-3]{'07'} $fonts[$n-2]{7}$data[$n-2]{'07'} $fonts[$n-1]{7}$data[$n-1]{'07'} $fonts[$n]{7}$data[$n]{'07'}
08 $fonts[$n-11]{8}$data[$n-11]{'08'} $fonts[$n-10]{8}$data[$n-10]{'08'} $fonts[$n-9]{8}$data[$n-9]{'08'} $fonts[$n-8]{8}$data[$n-8]{'08'} $fonts[$n-7]{8}$data[$n-7]{'08'} $fonts[$n-6]{8}$data[$n-6]{'08'} $fonts[$n-5]{8}$data[$n-5]{'08'} $fonts[$n-4]{8}$data[$n-4]{'08'} $fonts[$n-3]{8}$data[$n-3]{'08'} $fonts[$n-2]{8}$data[$n-2]{'08'} $fonts[$n-1]{8}$data[$n-1]{'08'} $fonts[$n]{8}$data[$n]{'08'}
09 $fonts[$n-11]{9}$data[$n-11]{'09'} $fonts[$n-10]{9}$data[$n-10]{'09'} $fonts[$n-9]{9}$data[$n-9]{'09'} $fonts[$n-8]{9}$data[$n-8]{'09'} $fonts[$n-7]{9}$data[$n-7]{'09'} $fonts[$n-6]{9}$data[$n-6]{'09'} $fonts[$n-5]{9}$data[$n-5]{'09'} $fonts[$n-4]{9}$data[$n-4]{'09'} $fonts[$n-3]{9}$data[$n-3]{'09'} $fonts[$n-2]{9}$data[$n-2]{'09'} $fonts[$n-1]{9}$data[$n-1]{'09'} $fonts[$n]{9}$data[$n]{'09'}
10 $fonts[$n-11]{10}$data[$n-11]{'10'} $fonts[$n-10]{10}$data[$n-10]{'10'} $fonts[$n-9]{10}$data[$n-9]{'10'} $fonts[$n-8]{10}$data[$n-8]{'10'} $fonts[$n-7]{10}$data[$n-7]{'10'} $fonts[$n-6]{10}$data[$n-6]{'10'} $fonts[$n-5]{10}$data[$n-5]{'10'} $fonts[$n-4]{10}$data[$n-4]{'10'} $fonts[$n-3]{10}$data[$n-3]{'10'} $fonts[$n-2]{10}$data[$n-2]{'10'} $fonts[$n-1]{10}$data[$n-1]{'10'} $fonts[$n]{10}$data[$n]{'10'}
11 $fonts[$n-11]{11}$data[$n-11]{'11'} $fonts[$n-10]{11}$data[$n-10]{'11'} $fonts[$n-9]{11}$data[$n-9]{'11'} $fonts[$n-8]{11}$data[$n-8]{'11'} $fonts[$n-7]{11}$data[$n-7]{'11'} $fonts[$n-6]{11}$data[$n-6]{'11'} $fonts[$n-5]{11}$data[$n-5]{'11'} $fonts[$n-4]{11}$data[$n-4]{'11'} $fonts[$n-3]{11}$data[$n-3]{'11'} $fonts[$n-2]{11}$data[$n-2]{'11'} $fonts[$n-1]{11}$data[$n-1]{'11'} $fonts[$n]{11}$data[$n]{'11'}
12 $fonts[$n-11]{12}$data[$n-11]{'12'} $fonts[$n-10]{12}$data[$n-10]{'12'} $fonts[$n-9]{12}$data[$n-9]{'12'} $fonts[$n-8]{12}$data[$n-8]{'12'} $fonts[$n-7]{12}$data[$n-7]{'12'} $fonts[$n-6]{12}$data[$n-6]{'12'} $fonts[$n-5]{12}$data[$n-5]{'12'} $fonts[$n-4]{12}$data[$n-4]{'12'} $fonts[$n-3]{12}$data[$n-3]{'12'} $fonts[$n-2]{12}$data[$n-2]{'12'} $fonts[$n-1]{12}$data[$n-1]{'12'} $fonts[$n]{12}$data[$n]{'12'}
13 $fonts[$n-11]{13}$data[$n-11]{'13'} $fonts[$n-10]{13}$data[$n-10]{'13'} $fonts[$n-9]{13}$data[$n-9]{'13'} $fonts[$n-8]{13}$data[$n-8]{'13'} $fonts[$n-7]{13}$data[$n-7]{'13'} $fonts[$n-6]{13}$data[$n-6]{'13'} $fonts[$n-5]{13}$data[$n-5]{'13'} $fonts[$n-4]{13}$data[$n-4]{'13'} $fonts[$n-3]{13}$data[$n-3]{'13'} $fonts[$n-2]{13}$data[$n-2]{'13'} $fonts[$n-1]{13}$data[$n-1]{'13'} $fonts[$n]{13}$data[$n]{'13'}
14 $fonts[$n-11]{14}$data[$n-11]{'14'} $fonts[$n-10]{14}$data[$n-10]{'14'} $fonts[$n-9]{14}$data[$n-9]{'14'} $fonts[$n-8]{14}$data[$n-8]{'14'} $fonts[$n-7]{14}$data[$n-7]{'14'} $fonts[$n-6]{14}$data[$n-6]{'14'} $fonts[$n-5]{14}$data[$n-5]{'14'} $fonts[$n-4]{14}$data[$n-4]{'14'} $fonts[$n-3]{14}$data[$n-3]{'14'} $fonts[$n-2]{14}$data[$n-2]{'14'} $fonts[$n-1]{14}$data[$n-1]{'14'} $fonts[$n]{14}$data[$n]{'14'}
15 $fonts[$n-11]{15}$data[$n-11]{'15'} $fonts[$n-10]{15}$data[$n-10]{'15'} $fonts[$n-9]{15}$data[$n-9]{'15'} $fonts[$n-8]{15}$data[$n-8]{'15'} $fonts[$n-7]{15}$data[$n-7]{'15'} $fonts[$n-6]{15}$data[$n-6]{'15'} $fonts[$n-5]{15}$data[$n-5]{'15'} $fonts[$n-4]{15}$data[$n-4]{'15'} $fonts[$n-3]{15}$data[$n-3]{'15'} $fonts[$n-2]{15}$data[$n-2]{'15'} $fonts[$n-1]{15}$data[$n-1]{'15'} $fonts[$n]{15}$data[$n]{'15'}
16 $fonts[$n-11]{16}$data[$n-11]{'16'} $fonts[$n-10]{16}$data[$n-10]{'16'} $fonts[$n-9]{16}$data[$n-9]{'16'} $fonts[$n-8]{16}$data[$n-8]{'16'} $fonts[$n-7]{16}$data[$n-7]{'16'} $fonts[$n-6]{16}$data[$n-6]{'16'} $fonts[$n-5]{16}$data[$n-5]{'16'} $fonts[$n-4]{16}$data[$n-4]{'16'} $fonts[$n-3]{16}$data[$n-3]{'16'} $fonts[$n-2]{16}$data[$n-2]{'16'} $fonts[$n-1]{16}$data[$n-1]{'16'} $fonts[$n]{16}$data[$n]{'16'}
17 $fonts[$n-11]{17}$data[$n-11]{'17'} $fonts[$n-10]{17}$data[$n-10]{'17'} $fonts[$n-9]{17}$data[$n-9]{'17'} $fonts[$n-8]{17}$data[$n-8]{'17'} $fonts[$n-7]{17}$data[$n-7]{'17'} $fonts[$n-6]{17}$data[$n-6]{'17'} $fonts[$n-5]{17}$data[$n-5]{'17'} $fonts[$n-4]{17}$data[$n-4]{'17'} $fonts[$n-3]{17}$data[$n-3]{'17'} $fonts[$n-2]{17}$data[$n-2]{'17'} $fonts[$n-1]{17}$data[$n-1]{'17'} $fonts[$n]{17}$data[$n]{'17'}
18 $fonts[$n-11]{18}$data[$n-11]{'18'} $fonts[$n-10]{18}$data[$n-10]{'18'} $fonts[$n-9]{18}$data[$n-9]{'18'} $fonts[$n-8]{18}$data[$n-8]{'18'} $fonts[$n-7]{18}$data[$n-7]{'18'} $fonts[$n-6]{18}$data[$n-6]{'18'} $fonts[$n-5]{18}$data[$n-5]{'18'} $fonts[$n-4]{18}$data[$n-4]{'18'} $fonts[$n-3]{18}$data[$n-3]{'18'} $fonts[$n-2]{18}$data[$n-2]{'18'} $fonts[$n-1]{18}$data[$n-1]{'18'} $fonts[$n]{18}$data[$n]{'18'}
19 $fonts[$n-11]{19}$data[$n-11]{'19'} $fonts[$n-10]{19}$data[$n-10]{'19'} $fonts[$n-9]{19}$data[$n-9]{'19'} $fonts[$n-8]{19}$data[$n-8]{'19'} $fonts[$n-7]{19}$data[$n-7]{'19'} $fonts[$n-6]{19}$data[$n-6]{'19'} $fonts[$n-5]{19}$data[$n-5]{'19'} $fonts[$n-4]{19}$data[$n-4]{'19'} $fonts[$n-3]{19}$data[$n-3]{'19'} $fonts[$n-2]{19}$data[$n-2]{'19'} $fonts[$n-1]{19}$data[$n-1]{'19'} $fonts[$n]{19}$data[$n]{'19'}
20 $fonts[$n-11]{20}$data[$n-11]{'20'} $fonts[$n-10]{20}$data[$n-10]{'20'} $fonts[$n-9]{20}$data[$n-9]{'20'} $fonts[$n-8]{20}$data[$n-8]{'20'} $fonts[$n-7]{20}$data[$n-7]{'20'} $fonts[$n-6]{20}$data[$n-6]{'20'} $fonts[$n-5]{20}$data[$n-5]{'20'} $fonts[$n-4]{20}$data[$n-4]{'20'} $fonts[$n-3]{20}$data[$n-3]{'20'} $fonts[$n-2]{20}$data[$n-2]{'20'} $fonts[$n-1]{20}$data[$n-1]{'20'} $fonts[$n]{20}$data[$n]{'20'}
21 $fonts[$n-11]{21}$data[$n-11]{'21'} $fonts[$n-10]{21}$data[$n-10]{'21'} $fonts[$n-9]{21}$data[$n-9]{'21'} $fonts[$n-8]{21}$data[$n-8]{'21'} $fonts[$n-7]{21}$data[$n-7]{'21'} $fonts[$n-6]{21}$data[$n-6]{'21'} $fonts[$n-5]{21}$data[$n-5]{'21'} $fonts[$n-4]{21}$data[$n-4]{'21'} $fonts[$n-3]{21}$data[$n-3]{'21'} $fonts[$n-2]{21}$data[$n-2]{'21'} $fonts[$n-1]{21}$data[$n-1]{'21'} $fonts[$n]{21}$data[$n]{'21'}
22 $fonts[$n-11]{22}$data[$n-11]{'22'} $fonts[$n-10]{22}$data[$n-10]{'22'} $fonts[$n-9]{22}$data[$n-9]{'22'} $fonts[$n-8]{22}$data[$n-8]{'22'} $fonts[$n-7]{22}$data[$n-7]{'22'} $fonts[$n-6]{22}$data[$n-6]{'22'} $fonts[$n-5]{22}$data[$n-5]{'22'} $fonts[$n-4]{22}$data[$n-4]{'22'} $fonts[$n-3]{22}$data[$n-3]{'22'} $fonts[$n-2]{22}$data[$n-2]{'22'} $fonts[$n-1]{22}$data[$n-1]{'22'} $fonts[$n]{22}$data[$n]{'22'}
23 $fonts[$n-11]{23}$data[$n-11]{'23'} $fonts[$n-10]{23}$data[$n-10]{'23'} $fonts[$n-9]{23}$data[$n-9]{'23'} $fonts[$n-8]{23}$data[$n-8]{'23'} $fonts[$n-7]{23}$data[$n-7]{'23'} $fonts[$n-6]{23}$data[$n-6]{'23'} $fonts[$n-5]{23}$data[$n-5]{'23'} $fonts[$n-4]{23}$data[$n-4]{'23'} $fonts[$n-3]{23}$data[$n-3]{'23'} $fonts[$n-2]{23}$data[$n-2]{'23'} $fonts[$n-1]{23}$data[$n-1]{'23'} $fonts[$n]{23}$data[$n]{'23'}
24 $fonts[$n-11]{24}$data[$n-11]{'24'} $fonts[$n-10]{24}$data[$n-10]{'24'} $fonts[$n-9]{24}$data[$n-9]{'24'} $fonts[$n-8]{24}$data[$n-8]{'24'} $fonts[$n-7]{24}$data[$n-7]{'24'} $fonts[$n-6]{24}$data[$n-6]{'24'} $fonts[$n-5]{24}$data[$n-5]{'24'} $fonts[$n-4]{24}$data[$n-4]{'24'} $fonts[$n-3]{24}$data[$n-3]{'24'} $fonts[$n-2]{24}$data[$n-2]{'24'} $fonts[$n-1]{24}$data[$n-1]{'24'} $fonts[$n]{24}$data[$n]{'24'}
25 $fonts[$n-11]{25}$data[$n-11]{'25'} $fonts[$n-10]{25}$data[$n-10]{'25'} $fonts[$n-9]{25}$data[$n-9]{'25'} $fonts[$n-8]{25}$data[$n-8]{'25'} $fonts[$n-7]{25}$data[$n-7]{'25'} $fonts[$n-6]{25}$data[$n-6]{'25'} $fonts[$n-5]{25}$data[$n-5]{'25'} $fonts[$n-4]{25}$data[$n-4]{'25'} $fonts[$n-3]{25}$data[$n-3]{'25'} $fonts[$n-2]{25}$data[$n-2]{'25'} $fonts[$n-1]{25}$data[$n-1]{'25'} $fonts[$n]{25}$data[$n]{'25'}
26 $fonts[$n-11]{26}$data[$n-11]{'26'} $fonts[$n-10]{26}$data[$n-10]{'26'} $fonts[$n-9]{26}$data[$n-9]{'26'} $fonts[$n-8]{26}$data[$n-8]{'26'} $fonts[$n-7]{26}$data[$n-7]{'26'} $fonts[$n-6]{26}$data[$n-6]{'26'} $fonts[$n-5]{26}$data[$n-5]{'26'} $fonts[$n-4]{26}$data[$n-4]{'26'} $fonts[$n-3]{26}$data[$n-3]{'26'} $fonts[$n-2]{26}$data[$n-2]{'26'} $fonts[$n-1]{26}$data[$n-1]{'26'} $fonts[$n]{26}$data[$n]{'26'}
27 $fonts[$n-11]{27}$data[$n-11]{'27'} $fonts[$n-10]{27}$data[$n-10]{'27'} $fonts[$n-9]{27}$data[$n-9]{'27'} $fonts[$n-8]{27}$data[$n-8]{'27'} $fonts[$n-7]{27}$data[$n-7]{'27'} $fonts[$n-6]{27}$data[$n-6]{'27'} $fonts[$n-5]{27}$data[$n-5]{'27'} $fonts[$n-4]{27}$data[$n-4]{'27'} $fonts[$n-3]{27}$data[$n-3]{'27'} $fonts[$n-2]{27}$data[$n-2]{'27'} $fonts[$n-1]{27}$data[$n-1]{'27'} $fonts[$n]{27}$data[$n]{'27'}
28 $fonts[$n-11]{28}$data[$n-11]{'28'} $fonts[$n-10]{28}$data[$n-10]{'28'} $fonts[$n-9]{28}$data[$n-9]{'28'} $fonts[$n-8]{28}$data[$n-8]{'28'} $fonts[$n-7]{28}$data[$n-7]{'28'} $fonts[$n-6]{28}$data[$n-6]{'28'} $fonts[$n-5]{28}$data[$n-5]{'28'} $fonts[$n-4]{28}$data[$n-4]{'28'} $fonts[$n-3]{28}$data[$n-3]{'28'} $fonts[$n-2]{28}$data[$n-2]{'28'} $fonts[$n-1]{28}$data[$n-1]{'28'} $fonts[$n]{28}$data[$n]{'28'}
29 $fonts[$n-11]{29}$data[$n-11]{'29'} $fonts[$n-10]{29}$data[$n-10]{'29'} $fonts[$n-9]{29}$data[$n-9]{'29'} $fonts[$n-8]{29}$data[$n-8]{'29'} $fonts[$n-7]{29}$data[$n-7]{'29'} $fonts[$n-6]{29}$data[$n-6]{'29'} $fonts[$n-5]{29}$data[$n-5]{'29'} $fonts[$n-4]{29}$data[$n-4]{'29'} $fonts[$n-3]{29}$data[$n-3]{'29'} $fonts[$n-2]{29}$data[$n-2]{'29'} $fonts[$n-1]{29}$data[$n-1]{'29'} $fonts[$n]{29}$data[$n]{'29'}
30 $fonts[$n-11]{30}$data[$n-11]{'30'} $fonts[$n-10]{30}$data[$n-10]{'30'} $fonts[$n-9]{30}$data[$n-9]{'30'} $fonts[$n-8]{30}$data[$n-8]{'30'} $fonts[$n-7]{30}$data[$n-7]{'30'} $fonts[$n-6]{30}$data[$n-6]{'30'} $fonts[$n-5]{30}$data[$n-5]{'30'} $fonts[$n-4]{30}$data[$n-4]{'30'} $fonts[$n-3]{30}$data[$n-3]{'30'} $fonts[$n-2]{30}$data[$n-2]{'30'} $fonts[$n-1]{30}$data[$n-1]{'30'} $fonts[$n]{30}$data[$n]{'30'}
31 $fonts[$n-11]{31}$data[$n-11]{'31'} $fonts[$n-10]{31}$data[$n-10]{'31'} $fonts[$n-9]{31}$data[$n-9]{'31'} $fonts[$n-8]{31}$data[$n-8]{'31'} $fonts[$n-7]{31}$data[$n-7]{'31'} $fonts[$n-6]{31}$data[$n-6]{'31'} $fonts[$n-5]{31}$data[$n-5]{'31'} $fonts[$n-4]{31}$data[$n-4]{'31'} $fonts[$n-3]{31}$data[$n-3]{'31'} $fonts[$n-2]{31}$data[$n-2]{'31'} $fonts[$n-1]{31}$data[$n-1]{'31'} $fonts[$n]{31}$data[$n]{'31'}
TOT $sum_01 $sum_02 $sum_03 $sum_04 $sum_05 $sum_06 $sum_07 $sum_08 $sum_09 $sum_10 $sum_11 $sum_12
AVE $MONTHLY_AVG_RR[0] $MONTHLY_AVG_RR[1] $MONTHLY_AVG_RR[2] $MONTHLY_AVG_RR[3] $MONTHLY_AVG_RR[4] $MONTHLY_AVG_RR[5] $MONTHLY_AVG_RR[6] $MONTHLY_AVG_RR[7] $MONTHLY_AVG_RR[8] $MONTHLY_AVG_RR[9] $MONTHLY_AVG_RR[10] $MONTHLY_AVG_RR[11]
% AVE $rain_percent_01 $rain_percent_02 $rain_percent_03 $rain_percent_04 $rain_percent_05 $rain_percent_06 $rain_percent_07 $rain_percent_08 $rain_percent_09 $rain_percent_10 $rain_percent_11 $rain_percent_12

Values in RED indicate the highest $variable reached & BLUE, the lowest for each month!

#### = missing rainfall data
**** = no rainfall data recorded on a particular day

"; } else{ print"
**** = missing or no temperature data recorded
"; } $hi_temp_year = 0; $lo_temp_year = 50; $day_hi_temp_year = 99; $day_lo_temp_year = 99; if($hi_temp_01 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_01 >= $hi_temp_year){ $hi_temp_year = $hi_temp_01; $day_hi_temp_year = "JAN $day_hi_temp_01 $year"; } } if($hi_temp_02 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_02 >= $hi_temp_year){ $hi_temp_year = $hi_temp_02; $day_hi_temp_year = "FEB $day_hi_temp_02 $year"; } } if($hi_temp_03 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_03 >= $hi_temp_year){ $hi_temp_year = $hi_temp_03; $day_hi_temp_year = "MAR $day_hi_temp_03 $year"; } } if($hi_temp_04 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_04 >= $hi_temp_year){ $hi_temp_year = $hi_temp_04; $day_hi_temp_year = "APR $day_hi_temp_04 $year"; } } if($hi_temp_05 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_05 >= $hi_temp_year){ $hi_temp_year = $hi_temp_05; $day_hi_temp_year = "MAY $day_hi_temp_05 $year"; } } if($hi_temp_06 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_06 >= $hi_temp_year){ $hi_temp_year = $hi_temp_06; $day_hi_temp_year = "JUN $day_hi_temp_06 $year"; } } if($hi_temp_07 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_07 >= $hi_temp_year){ $hi_temp_year = $hi_temp_07; $day_hi_temp_year = "JUL $day_hi_temp_07 $year"; } } if($hi_temp_08 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_08 >= $hi_temp_year){ $hi_temp_year = $hi_temp_08; $day_hi_temp_year = "AUG $day_hi_temp_08 $year"; } } if($hi_temp_09 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_09 >= $hi_temp_year){ $hi_temp_year = $hi_temp_09; $day_hi_temp_year = "SEP $day_hi_temp_09 $year"; } } if($hi_temp_10 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_10 >= $hi_temp_year){ $hi_temp_year = $hi_temp_10; $day_hi_temp_year = "OCT $day_hi_temp_10 $year"; } } if($hi_temp_11 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_11 >= $hi_temp_year){ $hi_temp_year = $hi_temp_11; $day_hi_temp_year = "NOV $day_hi_temp_11 $year"; } } if($hi_temp_12 eq "N/A"){ $hi_temp_year = $hi_temp_year; $day_hi_temp_year = $day_hi_temp_year; } else{ if($hi_temp_12 >= $hi_temp_year){ $hi_temp_year = $hi_temp_12; $day_hi_temp_year = "DEC $day_hi_temp_12 $year"; } } if($lo_temp_01 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year;} else{ if($lo_temp_01 >= $lo_temp_year){ $lo_temp_year = $lo_temp_01; $day_lo_temp_year = "JAN $day_lo_temp_01 $year"; } } if($lo_temp_02 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_02 <= $lo_temp_year){ $lo_temp_year = $lo_temp_02; $day_lo_temp_year = "FEB $day_lo_temp_02 $year"; } } if($lo_temp_03 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_03 <= $lo_temp_year){ $lo_temp_year = $lo_temp_03; $day_lo_temp_year = "MAR $day_lo_temp_03 $year"; } } if($lo_temp_04 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_04 <= $lo_temp_year){ $lo_temp_year = $lo_temp_04; $day_lo_temp_year = "APR $day_lo_temp_04 $year"; } } if($lo_temp_05 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_05 <= $lo_temp_year){ $lo_temp_year = $lo_temp_05; $day_lo_temp_year = "MAY $day_lo_temp_05 $year"; } } if($lo_temp_06 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_06 <= $lo_temp_year){ $lo_temp_year = $lo_temp_06; $day_lo_temp_year = "JUN $day_lo_temp_06 $year"; } } if($lo_temp_07 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_07 <= $lo_temp_year){ $lo_temp_year = $lo_temp_07; $day_lo_temp_year = "JUL $day_lo_temp_07 $year"; } } if($lo_temp_08 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_08 <= $lo_temp_year){ $lo_temp_year = $lo_temp_08; $day_lo_temp_year = "AUG $day_lo_temp_08 $year"; } } if($lo_temp_09 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_09 <= $lo_temp_year){ $lo_temp_year = $lo_temp_09; $day_lo_temp_year = "SEP $day_lo_temp_09 $year"; } } if($lo_temp_10 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_10 <= $lo_temp_year){ $lo_temp_year = $lo_temp_10; $day_lo_temp_year = "OCT $day_lo_temp_10 $year"; } } if($lo_temp_11 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_11 <= $lo_temp_year){ $lo_temp_year = $lo_temp_11; $day_lo_temp_year = "NOV $day_lo_temp_11 $year"; } } if($lo_temp_12 eq "N/A"){ $lo_temp_year = $lo_temp_year; $day_lo_temp_year = $day_lo_temp_year; } else{ if($lo_temp_12 <= $lo_temp_year){ $lo_temp_year = $lo_temp_12; $day_lo_temp_year = "DEC $day_lo_temp_12 $year"; } } if($sum_tot < 1){ $sum_tot = "N/A"; } if($variable eq "DAILY RAINFALL DATA"){ print"

$cityName{$city}
$year
MONTHLY RAINFALL
$year HIGHEST DATE LOWEST DATE TOTAL RAINY DAYS
JAN $hi_temp_01 $day_hi_temp_01 $lo_temp_01 $day_lo_temp_01 $sum_01 $count_01
FEB $hi_temp_02 $day_hi_temp_02 $lo_temp_02 $day_lo_temp_02 $sum_02 $count_02
MAR $hi_temp_03 $day_hi_temp_03 $lo_temp_03 $day_lo_temp_03 $sum_03 $count_03
APR $hi_temp_04 $day_hi_temp_04 $lo_temp_04 $day_lo_temp_04 $sum_04 $count_04
MAY $hi_temp_05 $day_hi_temp_05 $lo_temp_05 $day_lo_temp_05 $sum_05 $count_05
JUN $hi_temp_06 $day_hi_temp_06 $lo_temp_06 $day_lo_temp_06 $sum_06 $count_06
JUL $hi_temp_07 $day_hi_temp_07 $lo_temp_07 $day_lo_temp_07 $sum_07 $count_07
AUG $hi_temp_08 $day_hi_temp_08 $lo_temp_08 $day_lo_temp_08 $sum_08 $count_08
SEP $hi_temp_09 $day_hi_temp_09 $lo_temp_09 $day_lo_temp_09 $sum_09 $count_09
OCT $hi_temp_10 $day_hi_temp_10 $lo_temp_10 $day_lo_temp_10 $sum_10 $count_10
NOV $hi_temp_11 $day_hi_temp_11 $lo_temp_11 $day_lo_temp_11 $sum_11 $count_11
DEC $hi_temp_12 $day_hi_temp_12 $lo_temp_12 $day_lo_temp_12 $sum_12 $count_12
YEAR $hi_temp_year $day_hi_temp_year $lo_temp_year $day_lo_temp_year $sum_tot $count_tot

$sum_tot mm fell in $year ( $rain_percent_year % of the long-term climate mean of $MONTHLY_AVG_RR[12] mm!)

0.0mm indicates that precipitation fell, but was not measurable!

"; } else{ $ave_temp_year = sprintf("%02.1f", $sum_tot/$count_tot); $sum_tot = sprintf("%04.1f", $sum_tot); $hi_temp_year = sprintf("%02.1f", $hi_temp_year); $lo_temp_year = sprintf("%02.1f", $lo_temp_year); $percent = ($count_tot/365)*100; $percent = sprintf("%03d", $percent); print"

$cityName{$city}  $year
$variable
$year HIGHEST DATE LOWEST DATE AVERAGE DATA DAYS
JAN $hi_temp_01 $day_hi_temp_01 $lo_temp_01 $day_lo_temp_01 $ave_temp_01 $count_01
FEB $hi_temp_02 $day_hi_temp_02 $lo_temp_02 $day_lo_temp_02 $ave_temp_02 $count_02
MAR $hi_temp_03 $day_hi_temp_03 $lo_temp_03 $day_lo_temp_03 $ave_temp_03 $count_03
APR $hi_temp_04 $day_hi_temp_04 $lo_temp_04 $day_lo_temp_04 $ave_temp_04 $count_04
MAY $hi_temp_05 $day_hi_temp_05 $lo_temp_05 $day_lo_temp_05 $ave_temp_05 $count_05
JUN $hi_temp_06 $day_hi_temp_06 $lo_temp_06 $day_lo_temp_06 $ave_temp_06 $count_06
JUL $hi_temp_07 $day_hi_temp_07 $lo_temp_07 $day_lo_temp_07 $ave_temp_07 $count_07
AUG $hi_temp_08 $day_hi_temp_08 $lo_temp_08 $day_lo_temp_08 $ave_temp_08 $count_08
SEP $hi_temp_09 $day_hi_temp_09 $lo_temp_09 $day_lo_temp_09 $ave_temp_09 $count_09
OCT $hi_temp_10 $day_hi_temp_10 $lo_temp_10 $day_lo_temp_10 $ave_temp_10 $count_10
NOV $hi_temp_11 $day_hi_temp_11 $lo_temp_11 $day_lo_temp_11 $ave_temp_11 $count_11
DEC $hi_temp_12 $day_hi_temp_12 $lo_temp_12 $day_lo_temp_12 $ave_temp_12 $count_12
YEAR $hi_temp_year $day_hi_temp_year $lo_temp_year $day_lo_temp_year $ave_temp_year $count_tot ($percent%)

"; if($variable eq "DAILY MAXIMUM TEMP"){ print"
$city  $year  $variable - No. of Days
DAYS >=40° >=35° >=30° >=25° >=20° >=15° <=10°
$year $day_40 $day_35 $day_30 $day_more_25 $day_more_20 $day_more_15 $day_less_10
"; } elsif($variable eq "DAILY MINIMUM TEMP"){ print"
$city  $year  $variable - No. of Days
DAYS >=25° >=20° <=15° <=10° <=5° <=0° <=-5°
$year $day_more_25 $day_more_20 $day_less_15 $day_less_10 $day_5 $day_0 $day_m5
"; } elsif($variable eq "DAILY AVERAGE TEMP"){ print"
$city  $year  $variable - No. of Days
DAYS >=30° >=25° >=20° >=15° >=10° <=10° <=0°
$year $day_30 $day_more_25 $day_more_20 $day_more_15 $day_more_10 $day_less_10 $day_0
"; } } } } sub data_routine{ #print "

PRE-LOOP PROCESSED....$month
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20'}$data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'} $data[$n]{'25'} $data[$n]{'26'} $data[$n]{'27'} $data[$n]{'28'} $data[$n]{'29'} $data[$n]{'30'} $data[$n]{'31'}
"; $data_year[$n] = substr($data[$n]{'00'},0,4); # YYYY/MM $data_month[$n] = substr($data[$n]{'00'},5,2); # YYYY/MM $data_date[$n] = $data[$n]{'00'}; # YYYY/MM if($year eq $data_year[$n]){ if($month eq $data_month[$n]){ $count = 0; $sum = 0; # Day 1 $lo_temp = 50; $hi_temp = 0; $day_lo_temp = 99; $day_hi_temp = 99; if(($data[$n]{'01'} ne "****") && ($data[$n]{'01'} ne "####")){ $count++; $sum = $sum + $data[$n]{'01'}; if($data[$n]{'01'} >= $hi_temp){ $hi_temp = $data[$n]{'01'}; $day_hi_temp = 1; } if($data[$n]{'01'} <= $lo_temp){ $lo_temp = $data[$n]{'01'}; $day_lo_temp = 1; } } # Day 2 if(($data[$n]{'02'} ne "****") && ($data[$n]{'02'} ne "####")){ $count++; $sum = $sum + $data[$n]{'02'}; if($data[$n]{'02'} >= $hi_temp){ $hi_temp = $data[$n]{'02'}; $day_hi_temp = 2; } if($data[$n]{'02'} <= $lo_temp){ $lo_temp = $data[$n]{'02'}; $day_lo_temp = 2; } } # Day 3 if(($data[$n]{'03'} ne "****") && ($data[$n]{'03'} ne "####")){ $count++; $sum = $sum + $data[$n]{'03'}; if($data[$n]{'03'} >= $hi_temp){ $hi_temp = $data[$n]{'03'}; $day_hi_temp = 3; } if($data[$n]{'03'} <= $lo_temp){ $lo_temp = $data[$n]{'03'}; $day_lo_temp = 3; } } # Day 4 if(($data[$n]{'04'} ne "****") && ($data[$n]{'04'} ne "####")){ $count++; $sum = $sum + $data[$n]{'04'}; if($data[$n]{'04'} >= $hi_temp){ $hi_temp = $data[$n]{'04'}; $day_hi_temp = 4; } if($data[$n]{'04'} <= $lo_temp){ $lo_temp = $data[$n]{'04'}; $day_lo_temp = 4; } } # Day 5 if(($data[$n]{'05'} ne "****") && ($data[$n]{'05'} ne "####")){ $count++; $sum = $sum + $data[$n]{'05'}; if($data[$n]{'05'} >= $hi_temp){ $hi_temp = $data[$n]{'05'}; $day_hi_temp = 5; } if($data[$n]{'05'} <= $lo_temp){ $lo_temp = $data[$n]{'05'}; $day_lo_temp = 5; } } # Day 6 if(($data[$n]{'06'} ne "****") && ($data[$n]{'06'} ne "####")){ $count++; $sum = $sum + $data[$n]{'06'}; if($data[$n]{'06'} >= $hi_temp){ $hi_temp = $data[$n]{'06'}; $day_hi_temp = 6; } if($data[$n]{'06'} <= $lo_temp){ $lo_temp = $data[$n]{'06'}; $day_lo_temp = 6; } } # Day 7 if(($data[$n]{'07'} ne "****") && ($data[$n]{'07'} ne "####")){ $count++; $sum = $sum + $data[$n]{'07'}; if($data[$n]{'07'} >= $hi_temp){ $hi_temp = $data[$n]{'07'}; $day_hi_temp = 7; } if($data[$n]{'07'} <= $lo_temp){ $lo_temp = $data[$n]{'07'}; $day_lo_temp = 7; } } # Day 8 if(($data[$n]{'08'} ne "****") && ($data[$n]{'08'} ne "####")){ $count++; $sum = $sum + $data[$n]{'08'}; if($data[$n]{'08'} >= $hi_temp){ $hi_temp = $data[$n]{'08'}; $day_hi_temp = 8; } if($data[$n]{'08'} <= $lo_temp){ $lo_temp = $data[$n]{'08'}; $day_lo_temp = 8; } } # Day 9 if(($data[$n]{'09'} ne "****") && ($data[$n]{'09'} ne "####")){ $count++; $sum = $sum + $data[$n]{'09'}; if($data[$n]{'09'} >= $hi_temp){ $hi_temp = $data[$n]{'09'}; $day_hi_temp = 9; } if($data[$n]{'09'} <= $lo_temp){ $lo_temp = $data[$n]{'09'}; $day_lo_temp = 9; } } # Day 10 if(($data[$n]{'10'} ne "****") && ($data[$n]{'10'} ne "####")){ $count++; $sum = $sum + $data[$n]{'10'}; if($data[$n]{'10'} >= $hi_temp){ $hi_temp = $data[$n]{'10'}; $day_hi_temp = 10; } if($data[$n]{'10'} <= $lo_temp){ $lo_temp = $data[$n]{'10'}; $day_lo_temp = 10; } } # Day 11 if(($data[$n]{'11'} ne "****") && ($data[$n]{'11'} ne "####")){ $count++; $sum = $sum + $data[$n]{'11'}; if($data[$n]{'11'} >= $hi_temp){ $hi_temp = $data[$n]{'11'}; $day_hi_temp = 11; } if($data[$n]{'11'} <= $lo_temp){ $lo_temp = $data[$n]{'11'}; $day_lo_temp = 11; } } # Day 12 if(($data[$n]{'12'} ne "****") && ($data[$n]{'12'} ne "####")){ $count++; $sum = $sum + $data[$n]{'12'}; if($data[$n]{'12'} >= $hi_temp){ $hi_temp = $data[$n]{'12'}; $day_hi_temp = 12; } if($data[$n]{'12'} <= $lo_temp){ $lo_temp = $data[$n]{'12'}; $day_lo_temp = 12; } } # Day 13 if(($data[$n]{'13'} ne "****") && ($data[$n]{'13'} ne "####")){ $count++; $sum = $sum + $data[$n]{'13'}; if($data[$n]{'13'} >= $hi_temp){ $hi_temp = $data[$n]{'13'}; $day_hi_temp = 13; } if($data[$n]{'13'} <= $lo_temp){ $lo_temp = $data[$n]{'13'}; $day_lo_temp = 13; } } # Day 14 if(($data[$n]{'14'} ne "****") && ($data[$n]{'14'} ne "####")){ $count++; $sum = $sum + $data[$n]{'14'}; if($data[$n]{'14'} >= $hi_temp){ $hi_temp = $data[$n]{'14'}; $day_hi_temp = 14; } if($data[$n]{'14'} <= $lo_temp){ $lo_temp = $data[$n]{'14'}; $day_lo_temp = 14; } } # Day 15 if(($data[$n]{'15'} ne "****") && ($data[$n]{'15'} ne "####")){ $count++; $sum = $sum + $data[$n]{'15'}; if($data[$n]{'15'} >= $hi_temp){ $hi_temp = $data[$n]{'15'}; $day_hi_temp = 15; } if($data[$n]{'15'} <= $lo_temp){ $lo_temp = $data[$n]{'15'}; $day_lo_temp = 15; } } # Day 16 if(($data[$n]{'16'} ne "****") && ($data[$n]{'16'} ne "####")){ $count++; $sum = $sum + $data[$n]{'16'}; if($data[$n]{'16'} >= $hi_temp){ $hi_temp = $data[$n]{'16'}; $day_hi_temp = 16; } if($data[$n]{'16'} <= $lo_temp){ $lo_temp = $data[$n]{'16'}; $day_lo_temp = 16; } } # Day 17 if(($data[$n]{'17'} ne "****") && ($data[$n]{'17'} ne "####")){ $count++; $sum = $sum + $data[$n]{'17'}; if($data[$n]{'17'} >= $hi_temp){ $hi_temp = $data[$n]{'17'}; $day_hi_temp = 17; } if($data[$n]{'17'} <= $lo_temp){ $lo_temp = $data[$n]{'17'}; $day_lo_temp = 17; } } # Day 18 if(($data[$n]{'18'} ne "****") && ($data[$n]{'18'} ne "####")){ $count++; $sum = $sum + $data[$n]{'18'}; if($data[$n]{'18'} >= $hi_temp){ $hi_temp = $data[$n]{'18'}; $day_hi_temp = 18; } if($data[$n]{'18'} <= $lo_temp){ $lo_temp = $data[$n]{'18'}; $day_lo_temp = 18; } } # Day 19 if(($data[$n]{'19'} ne "****") && ($data[$n]{'19'} ne "####")){ $count++; $sum = $sum + $data[$n]{'19'}; if($data[$n]{'19'} >= $hi_temp){ $hi_temp = $data[$n]{'19'}; $day_hi_temp = 19; } if($data[$n]{'19'} <= $lo_temp){ $lo_temp = $data[$n]{'19'}; $day_lo_temp = 19; } } # Day 20 if(($data[$n]{'20'} ne "****") && ($data[$n]{'20'} ne "####")){ $count++; $sum = $sum + $data[$n]{'20'}; if($data[$n]{'20'} >= $hi_temp){ $hi_temp = $data[$n]{'20'}; $day_hi_temp = 20; } if($data[$n]{'20'} <= $lo_temp){ $lo_temp = $data[$n]{'20'}; $day_lo_temp = 20; } } # Day 21 if(($data[$n]{'21'} ne "****") && ($data[$n]{'21'} ne "####")){ $count++; $sum = $sum + $data[$n]{'21'}; if($data[$n]{'21'} >= $hi_temp){ $hi_temp = $data[$n]{'21'}; $day_hi_temp = 21; } if($data[$n]{'21'} <= $lo_temp){ $lo_temp = $data[$n]{'21'}; $day_lo_temp = 21; } } # Day 22 if(($data[$n]{'22'} ne "****") && ($data[$n]{'22'} ne "####")){ $count++; $sum = $sum + $data[$n]{'22'}; if($data[$n]{'22'} >= $hi_temp){ $hi_temp = $data[$n]{'22'}; $day_hi_temp = 22; } if($data[$n]{'22'} <= $lo_temp){ $lo_temp = $data[$n]{'22'}; $day_lo_temp = 22; } } # Day 23 if(($data[$n]{'23'} ne "****") && ($data[$n]{'23'} ne "####")){ $count++; $sum = $sum + $data[$n]{'23'}; if($data[$n]{'23'} >= $hi_temp){ $hi_temp = $data[$n]{'23'}; $day_hi_temp = 23; } if($data[$n]{'23'} <= $lo_temp){ $lo_temp = $data[$n]{'23'}; $day_lo_temp = 23; } } # Day 24 if(($data[$n]{'24'} ne "****") && ($data[$n]{'24'} ne "####")){ $count++; $sum = $sum + $data[$n]{'24'}; if($data[$n]{'24'} >= $hi_temp){ $hi_temp = $data[$n]{'24'}; $day_hi_temp = 24; } if($data[$n]{'24'} <= $lo_temp){ $lo_temp = $data[$n]{'24'}; $day_lo_temp = 24; } } # Day 25 if(($data[$n]{'25'} ne "****") && ($data[$n]{'25'} ne "####")){ $count++; $sum = $sum + $data[$n]{'25'}; if($data[$n]{'25'} >= $hi_temp){ $hi_temp = $data[$n]{'25'}; $day_hi_temp = 25; } if($data[$n]{'25'} <= $lo_temp){ $lo_temp = $data[$n]{'25'}; $day_lo_temp = 25; } } # Day 26 if(($data[$n]{'26'} ne "****") && ($data[$n]{'26'} ne "####")){ $count++; $sum = $sum + $data[$n]{'26'}; if($data[$n]{'26'} >= $hi_temp){ $hi_temp = $data[$n]{'26'}; $day_hi_temp = 26; } if($data[$n]{'26'} <= $lo_temp){ $lo_temp = $data[$n]{'26'}; $day_lo_temp = 26; } } # Day 27 if(($data[$n]{'27'} ne "****") && ($data[$n]{'27'} ne "####")){ $count++; $sum = $sum + $data[$n]{'27'}; if($data[$n]{'27'} >= $hi_temp){ $hi_temp = $data[$n]{'27'}; $day_hi_temp = 27; } if($data[$n]{'27'} <= $lo_temp){ $lo_temp = $data[$n]{'27'}; $day_lo_temp = 27; } } # Day 28 if(($data[$n]{'28'} ne "****") && ($data[$n]{'28'} ne "####")){ $count++; $sum = $sum + $data[$n]{'28'}; if($data[$n]{'28'} >= $hi_temp){ $hi_temp = $data[$n]{'28'}; $day_hi_temp = 28; } if($data[$n]{'28'} <= $lo_temp){ $lo_temp = $data[$n]{'28'}; $day_lo_temp = 28; } } # Day 29 if(($data[$n]{'29'} ne "****") && ($data[$n]{'29'} ne "####")){ $count++; $sum = $sum + $data[$n]{'29'}; if($data[$n]{'29'} >= $hi_temp){ $hi_temp = $data[$n]{'29'}; $day_hi_temp = 29; } if($data[$n]{'29'} <= $lo_temp){ $lo_temp = $data[$n]{'29'}; $day_lo_temp = 29; } } # Day 30 if(($data[$n]{'30'} ne "****") && ($data[$n]{'30'} ne "####")){ $count++; $sum = $sum + $data[$n]{'30'}; if($data[$n]{'30'} >= $hi_temp){ $hi_temp = $data[$n]{'30'}; $day_hi_temp = 30; } if($data[$n]{'30'} <= $lo_temp){ $lo_temp = $data[$n]{'30'}; $day_lo_temp = 30; } } # Day 31 if(($data[$n]{'31'} ne "****") && ($data[$n]{'31'} ne "####")){ $count++; $sum = $sum + $data[$n]{'31'}; if($data[$n]{'31'} >= $hi_temp){ $hi_temp = $data[$n]{'31'}; $day_hi_temp = 31; } if($data[$n]{'31'} <= $lo_temp){ $lo_temp = $data[$n]{'31'}; $day_lo_temp = 31; } } # Days between certain values or greater than or less than! for ($x = 1;$x <32; $x++){ $x = sprintf("%02d",$x); if($data[$n]{$x} ne "****"){ if($data[$n]{$x} >= 40){ $day_40++; } if($data[$n]{$x} >= 35){ $day_35++; } if($data[$n]{$x} >= 30){ $day_30++; } if($data[$n]{$x} >= 25){ $day_more_25++; } if($data[$n]{$x} < 25){ $day_less_25++; } if($data[$n]{$x} >= 20){ $day_more_20++; } if($data[$n]{$x} < 20){ $day_less_20++; } if($data[$n]{$x} >= 15){ $day_more_15++; } if($data[$n]{$x} < 15){ $day_less_15++; } if($data[$n]{$x} >= 10){ $day_more_10++; } if($data[$n]{$x} < 10){ $day_less_10++; } if($data[$n]{$x} < 0){ $day_0++; } if($data[$n]{$x} < -5){ $day_m5++; } } } } } $fonts{$day_lo_temp} = ""; $fonts{$day_hi_temp} = ""; $fonts[$n]{$day_lo_temp} = ""; $fonts[$n]{$day_hi_temp} = ""; #print "

$data[$n]{'00'} POST LOOP - PROCESSED....
"; # print"N= $n : $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20}$data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'} $data[$n]{'25'} $data[$n]{'26'} $data[$n]{'27'} $data[$n]{'28'} $data[$n]{'29'} $data[$n]{'30'} $data[$n]{'31'}
year = $data_year[$n] month = $data_month[$n] hitemp = $hi_temp day = $day_hi_temp lotemp= $lo_temp day = $day_lo_temp count = $count SUM = $sum
"; return $fonts{$day_lo_temp}, $fonts{$day_hi_temp}, $data_year[$n], $data_month[$n], $hi_temp, $day_hi_temp, $lo_temp, $day_lot_temp, $count, $data[$n]{'01'}, $data[$n]{'02'}, $data[$n]{'03'}, $temp[$n,4], $temp[$n,5], $temp[$n,6], $temp[$n,7], $temp[$n,8], $temp[$n,9], $temp[$n,10], $temp[$n,11], $temp[$n,12], $temp[$n,13], $temp[$n,14], $temp[$n,15], $temp[$n,16], $temp[$n,17], $temp[$n,18], $temp[$n,19], $temp[$n,20], $temp[$n,21], $temp[$n,22], $temp[$n,23], $temp[$n,24], $temp[$n,25], $temp[$n,26], $temp[$n,27], $temp[$n,28], $temp[$n,29], $temp[$n,30], $temp[$n,31]; } } #MONTHLY TEMP ROUTINES: sub process_temp1{ &climate_info($DATAFILE_CA); $maxn = 0; # A counter for the number of entries. $yeartot = 0; $mon=0; $maxn = 0; # A counter for the number of entries. for($n = 1; $n <= 50; $n++){ $fonts[$n]{1} = ""; $fonts[$n]{2} = ""; $fonts[$n]{3} = ""; $fonts[$n]{4} = ""; $fonts[$n]{5} = ""; $fonts[$n]{6} = ""; $fonts[$n]{7} = ""; $fonts[$n]{8} = ""; $fonts[$n]{9} = ""; $fonts[$n]{10} = ""; $fonts[$n]{11} = ""; $fonts[$n]{12} = ""; } @yeartot = (); for ($n = 1;$n <=50;$n++){ &data_routine_temp(@temp, $n); #print"N= $n : $data[$n]{'00'} $sum $count $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'}
"; push(@yeartot, $sum); if($count < 1){ $hi_temp = "N/A"; $lo_temp = "N/A"; $month_hi_temp = "N/A"; $month_lo_temp = "N/A"; push(@value_maxtemp,$hi_temp); push(@value_mintemp,$lo_temp); push(@month_maxtemp,$month_hi_temp); push(@month_mintemp,$month_lo_temp); } else{ $hi_temp = sprintf("%03.1f", $hi_temp); $lo_temp = sprintf("%03.1f", $lo_temp); $day_hi_temp = $month_hi_temp; $day_lo_temp = $month_lo_temp; push(@value_maxtemp,$hi_temp); push(@value_mintemp,$lo_temp); push(@month_maxtemp,$month_hi_temp); push(@month_mintemp,$month_lo_temp); } #print"N = $n, total = $year_total[$n]
"; #push(%year_total,$data[$n]{'13'},$data[$n]{'00'}); # print"data[$n]{'13'} = $data[$n]{'13'} $data[$n]{'00'}
"; } $n = 1; for($w = 0;$w<13;$w++){ if($var eq "TX"){ $MONTHLY_AVG[$w] = $MONTHLY_AVG_TX[$w]; $year_ave = $MONTHLY_AVG_TX[12]; } elsif($var eq "TN"){ $MONTHLY_AVG[$w] = $MONTHLY_AVG_TN[$w]; $year_ave = $MONTHLY_AVG_TN[12]; } elsif($var eq "TM"){ $MONTHLY_AVG[$w] = $MONTHLY_AVG_TM[$w]; $year_ave = $MONTHLY_AVG_TM[12]; } elsif($var eq "RR"){ $MONTHLY_AVG[$w] = $MONTHLY_AVG_RR[$w]; $year_ave = $MONTHLY_AVG_RR[12]; } } for($y=0; $y < 51;$y++){ if ($data[$y+1]{'13'} eq "####"){ $percents{$y+1} = "N/A"; } else{ $percents{$y+1} = sprintf("%2.1f",$data[$y+1]{'13'}-$year_ave); } } for($y=0; $y < 50;$y=$y+10){ print"

$cityName{$city}
$variable [°C]
$data[$y+1]{'00'} $data[$y+2]{'00'} $data[$y+3]{'00'} $data[$y+4]{'00'} $data[$y+5]{'00'} $data[$y+6]{'00'} $data[$y+7]{'00'} $data[$y+8]{'00'} $data[$y+9]{'00'} $data[$y+10]{'00'} AVE
JAN $fonts[$y+1]{1}$data[$y+1]{'01'} $fonts[$y+2]{1}$data[$y+2]{'01'} $fonts[$y+3]{1}$data[$y+3]{'01'} $fonts[$y+4]{1}$data[$y+4]{'01'} $fonts[$y+5]{1}$data[$y+5]{'01'} $fonts[$y+6]{1}$data[$y+6]{'01'} $fonts[$y+7]{1}$data[$y+7]{'01'} $fonts[$y+8]{1}$data[$y+8]{'01'} $fonts[$y+9]{1}$data[$y+9]{'01'} $fonts[$y+10]{1}$data[$y+10]{'01'} $MONTHLY_AVG[0]
FEB $fonts[$y+1]{2}$data[$y+1]{'02'} $fonts[$y+2]{2}$data[$y+2]{'02'} $fonts[$y+3]{2}$data[$y+3]{'02'} $fonts[$y+4]{2}$data[$y+4]{'02'} $fonts[$y+5]{2}$data[$y+5]{'02'} $fonts[$y+6]{2}$data[$y+6]{'02'} $fonts[$y+7]{2}$data[$y+7]{'02'} $fonts[$y+8]{2}$data[$y+8]{'02'} $fonts[$y+9]{2}$data[$y+9]{'02'} $fonts[$y+10]{2}$data[$y+10]{'02'} $MONTHLY_AVG[1]
MAR $fonts[$y+1]{3}$data[$y+1]{'03'} $fonts[$y+2]{3}$data[$y+2]{'03'} $fonts[$y+3]{3}$data[$y+3]{'03'} $fonts[$y+4]{3}$data[$y+4]{'03'} $fonts[$y+5]{3}$data[$y+5]{'03'} $fonts[$y+6]{3}$data[$y+6]{'03'} $fonts[$y+7]{3}$data[$y+7]{'03'} $fonts[$y+8]{3}$data[$y+8]{'03'} $fonts[$y+9]{3}$data[$y+9]{'03'} $fonts[$y+10]{3}$data[$y+10]{'03'} $MONTHLY_AVG[2]
APR $fonts[$y+1]{4}$data[$y+1]{'04'} $fonts[$y+2]{4}$data[$y+2]{'04'} $fonts[$y+3]{4}$data[$y+3]{'04'} $fonts[$y+4]{4}$data[$y+4]{'04'} $fonts[$y+5]{4}$data[$y+5]{'04'} $fonts[$y+6]{4}$data[$y+6]{'04'} $fonts[$y+7]{4}$data[$y+7]{'04'} $fonts[$y+8]{4}$data[$y+8]{'04'} $fonts[$y+9]{4}$data[$y+9]{'04'} $fonts[$y+10]{4}$data[$y+10]{'04'} $MONTHLY_AVG[3]
MAY $fonts[$y+1]{5}$data[$y+1]{'05'} $fonts[$y+2]{5}$data[$y+2]{'05'} $fonts[$y+3]{5}$data[$y+3]{'05'} $fonts[$y+4]{5}$data[$y+4]{'05'} $fonts[$y+5]{5}$data[$y+5]{'05'} $fonts[$y+6]{5}$data[$y+6]{'05'} $fonts[$y+7]{5}$data[$y+7]{'05'} $fonts[$y+8]{5}$data[$y+8]{'05'} $fonts[$y+9]{5}$data[$y+9]{'05'} $fonts[$y+10]{5}$data[$y+10]{'05'} $MONTHLY_AVG[4]
JUN $fonts[$y+1]{6}$data[$y+1]{'06'} $fonts[$y+2]{6}$data[$y+2]{'06'} $fonts[$y+3]{6}$data[$y+3]{'06'} $fonts[$y+4]{6}$data[$y+4]{'06'} $fonts[$y+5]{6}$data[$y+5]{'06'} $fonts[$y+6]{6}$data[$y+6]{'06'} $fonts[$y+7]{6}$data[$y+7]{'06'} $fonts[$y+8]{6}$data[$y+8]{'06'} $fonts[$y+9]{6}$data[$y+9]{'06'} $fonts[$y+10]{6}$data[$y+10]{'06'} $MONTHLY_AVG[5]
JUL $fonts[$y+1]{7}$data[$y+1]{'07'} $fonts[$y+2]{7}$data[$y+2]{'07'} $fonts[$y+3]{7}$data[$y+3]{'07'} $fonts[$y+4]{7}$data[$y+4]{'07'} $fonts[$y+5]{7}$data[$y+5]{'07'} $fonts[$y+6]{7}$data[$y+6]{'07'} $fonts[$y+7]{7}$data[$y+7]{'07'} $fonts[$y+8]{7}$data[$y+8]{'07'} $fonts[$y+9]{7}$data[$y+9]{'07'} $fonts[$y+10]{7}$data[$y+10]{'07'} $MONTHLY_AVG[6]
AUG $fonts[$y+1]{8}$data[$y+1]{'08'} $fonts[$y+2]{8}$data[$y+2]{'08'} $fonts[$y+3]{8}$data[$y+3]{'08'} $fonts[$y+4]{8}$data[$y+4]{'08'} $fonts[$y+5]{8}$data[$y+5]{'08'} $fonts[$y+6]{8}$data[$y+6]{'08'} $fonts[$y+7]{8}$data[$y+7]{'08'} $fonts[$y+8]{8}$data[$y+8]{'08'} $fonts[$y+9]{8}$data[$y+9]{'08'} $fonts[$y+10]{8}$data[$y+10]{'08'} $MONTHLY_AVG[7]
SEP $fonts[$y+1]{9}$data[$y+1]{'09'} $fonts[$y+2]{9}$data[$y+2]{'09'} $fonts[$y+3]{9}$data[$y+3]{'09'} $fonts[$y+4]{9}$data[$y+4]{'09'} $fonts[$y+5]{9}$data[$y+5]{'09'} $fonts[$y+6]{9}$data[$y+6]{'09'} $fonts[$y+7]{9}$data[$y+7]{'09'} $fonts[$y+8]{9}$data[$y+8]{'09'} $fonts[$y+9]{9}$data[$y+9]{'09'} $fonts[$y+10]{9}$data[$y+10]{'09'} $MONTHLY_AVG[8]
OCT $fonts[$y+1]{10}$data[$y+1]{'10'} $fonts[$y+2]{10}$data[$y+2]{'10'} $fonts[$y+3]{10}$data[$y+3]{'10'} $fonts[$y+4]{10}$data[$y+4]{'10'} $fonts[$y+5]{10}$data[$y+5]{'10'} $fonts[$y+6]{10}$data[$y+6]{'10'} $fonts[$y+7]{10}$data[$y+7]{'10'} $fonts[$y+8]{10}$data[$y+8]{'10'} $fonts[$y+9]{10}$data[$y+9]{'10'} $fonts[$y+10]{10}$data[$y+10]{'10'} $MONTHLY_AVG[9]
NOV $fonts[$y+1]{11}$data[$y+1]{'11'} $fonts[$y+2]{11}$data[$y+2]{'11'} $fonts[$y+3]{11}$data[$y+3]{'11'} $fonts[$y+4]{11}$data[$y+4]{'11'} $fonts[$y+5]{11}$data[$y+5]{'11'} $fonts[$y+6]{11}$data[$y+6]{'11'} $fonts[$y+7]{11}$data[$y+7]{'11'} $fonts[$y+8]{11}$data[$y+8]{'11'} $fonts[$y+9]{11}$data[$y+9]{'11'} $fonts[$y+10]{11}$data[$y+10]{'11'} $MONTHLY_AVG[10]
DEC $fonts[$y+1]{12}$data[$y+1]{'12'} $fonts[$y+2]{12}$data[$y+2]{'12'} $fonts[$y+3]{12}$data[$y+3]{'12'} $fonts[$y+4]{12}$data[$y+4]{'12'} $fonts[$y+5]{12}$data[$y+5]{'12'} $fonts[$y+6]{12}$data[$y+6]{'12'} $fonts[$y+7]{12}$data[$y+7]{'12'} $fonts[$y+8]{12}$data[$y+8]{'12'} $fonts[$y+9]{12}$data[$y+9]{'12'} $fonts[$y+10]{12}$data[$y+10]{'12'} $MONTHLY_AVG[11]
AVE $data[$y+1]{'13'} $data[$y+2]{'13'} $data[$y+3]{'13'} $data[$y+4]{'13'} $data[$y+5]{'13'} $data[$y+6]{'13'} $data[$y+7]{'13'} $data[$y+8]{'13'} $data[$y+9]{'13'} $data[$y+10]{'13'} $MONTHLY_AVG[12]
MAX $value_maxtemp[$y] $value_maxtemp[$y+1] $value_maxtemp[$y+2] $value_maxtemp[$y+3] $value_maxtemp[$y+4] $value_maxtemp[$y+5] $value_maxtemp[$y+6] $value_maxtemp[$y+7] $value_maxtemp[$y+8] $value_maxtemp[$y+9]
MIN $value_mintemp[$y] $value_mintemp[$y+1] $value_mintemp[$y+2] $value_mintemp[$y+3] $value_mintemp[$y+4] $value_mintemp[$y+5] $value_mintemp[$y+6] $value_mintemp[$y+7] $value_mintemp[$y+8] $value_mintemp[$y+9]
DEP $percents{$y+1} $percents{$y+2} $percents{$y+3} $percents{$y+4} $percents{$y+5} $percents{$y+6} $percents{$y+7} $percents{$y+8} $percents{$y+9} $percents{$y+10}

$city $variable = $year_ave°C (Long-term climate average)

Values in RED indicate the highest $variable reached & BLUE, the lowest for each month!
DEP = departure from average
### = missing data

"; } return $year_ave; } sub data_routine_temp{ #print "

PRE-LOOP PROCESSED.... $data[$n]{'00'}
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'}
"; $count = 0; $sum = 0; $lo_temp = 50; $hi_temp = 0; $month_lo_temp = 99; $month_hi_temp = 99; # month 1 if($data[$n]{'01'} ne "####"){ $count++; $sum = $sum + $data[$n]{'01'}; if($data[$n]{'01'} >= $hi_temp){ $hi_temp = $data[$n]{'01'}; $month_hi_temp = 1; } if($data[$n]{'01'} <= $lo_temp){ $lo_temp = $data[$n]{'01'}; $month_lo_temp = 1; } } # month 2 if($data[$n]{'02'} ne "####"){ $count++; $sum = $sum + $data[$n]{'02'}; if($data[$n]{'02'} >= $hi_temp){ $hi_temp = $data[$n]{'02'}; $month_hi_temp = 2; } if($data[$n]{'02'} <= $lo_temp){ $lo_temp = $data[$n]{'02'}; $month_lo_temp = 2; } } # month 3 if($data[$n]{'03'} ne "####"){ $count++; $sum = $sum + $data[$n]{'03'}; if($data[$n]{'03'} >= $hi_temp){ $hi_temp = $data[$n]{'03'}; $month_hi_temp = 3; } if($data[$n]{'03'} <= $lo_temp){ $lo_temp = $data[$n]{'03'}; $month_lo_temp = 3; } } # month 4 if($data[$n]{'04'} ne "####"){ $count++; $sum = $sum + $data[$n]{'04'}; if($data[$n]{'04'} >= $hi_temp){ $hi_temp = $data[$n]{'04'}; $month_hi_temp = 4; } if($data[$n]{'04'} <= $lo_temp){ $lo_temp = $data[$n]{'04'}; $month_lo_temp = 4; } } # month 5 if($data[$n]{'05'} ne "####"){ $count++; $sum = $sum + $data[$n]{'05'}; if($data[$n]{'05'} >= $hi_temp){ $hi_temp = $data[$n]{'05'}; $month_hi_temp = 5; } if($data[$n]{'05'} <= $lo_temp){ $lo_temp = $data[$n]{'05'}; $month_lo_temp = 5; } } # month 6 if($data[$n]{'06'} ne "####"){ $count++; $sum = $sum + $data[$n]{'06'}; if($data[$n]{'06'} >= $hi_temp){ $hi_temp = $data[$n]{'06'}; $month_hi_temp = 6; } if($data[$n]{'06'} <= $lo_temp){ $lo_temp = $data[$n]{'06'}; $month_lo_temp = 6; } } # month 7 if($data[$n]{'07'} ne "####"){ $count++; $sum = $sum + $data[$n]{'07'}; if($data[$n]{'07'} >= $hi_temp){ $hi_temp = $data[$n]{'07'}; $month_hi_temp = 7; } if($data[$n]{'07'} <= $lo_temp){ $lo_temp = $data[$n]{'07'}; $month_lo_temp = 7; } } # month 8 if($data[$n]{'08'} ne "####"){ $count++; $sum = $sum + $data[$n]{'08'}; if($data[$n]{'08'} >= $hi_temp){ $hi_temp = $data[$n]{'08'}; $month_hi_temp = 8; } if($data[$n]{'08'} <= $lo_temp){ $lo_temp = $data[$n]{'08'}; $month_lo_temp = 8; } } # month 9 if($data[$n]{'09'} ne "####"){ $count++; $sum = $sum + $data[$n]{'09'}; if($data[$n]{'09'} >= $hi_temp){ $hi_temp = $data[$n]{'09'}; $month_hi_temp = 9; $fonts[$n]{9} = ""; } if($data[$n]{'09'} <= $lo_temp){ $lo_temp = $data[$n]{'09'}; $month_lo_temp = 9; } } # month 10 if($data[$n]{'10'} ne "####"){ $count++; $sum = $sum + $data[$n]{'10'}; if($data[$n]{'10'} >= $hi_temp){ $hi_temp = $data[$n]{'10'}; $month_hi_temp = 10; } if($data[$n]{'10'} <= $lo_temp){ $lo_temp = $data[$n]{'10'}; $month_lo_temp = 10; } } # month 11 if($data[$n]{'11'} ne "####"){ $count++; $sum = $sum + $data[$n]{'11'}; if($data[$n]{'11'} >= $hi_temp){ $hi_temp = $data[$n]{'11'}; $month_hi_temp = 11; } if($data[$n]{'11'} <= $lo_temp){ $lo_temp = $data[$n]{'11'}; $month_lo_temp = 11; } } # month 12 if($data[$n]{'12'} ne "####"){ $count++; $sum = $sum + $data[$n]{'12'}; if($data[$n]{'12'} >= $hi_temp){ $hi_temp = $data[$n]{'12'}; $month_hi_temp = 12; } if($data[$n]{'12'} <= $lo_temp){ $lo_temp = $data[$n]{'12'}; $month_lo_temp = 12; } } $fonts[$n]{$month_hi_temp} = ""; $fonts[$n]{$month_lo_temp} = ""; #print "

$data[$n]{'00'} POST LOOP - PROCESSED....
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} #
hitemp = $hi_temp month = $month_hi_temp lotemp= $lo_temp month = $month_lo_temp count = $count SUM = $sum
"; return $fonts{$month_lo_temp}, $fonts{$month_hi_temp}, $hi_temp, $month_hi_temp, $lo_temp, $month_lo_temp, $sum, $count, $data[$n]{'01'}, $data[$n]{'02'}, $data[$n]{'03'}, $data[$n]{'04'}, $data[$n]{'05'}, $data[$n]{'06'}, $data[$n]{'07'}, $data[$n]{'08'}, $data[$n]{'09'}, $data[$n]{'10'}, $data[$n]{'11'}, $data[$n]{'12'} ; } # RAINFALL ROUTINES sub process_rain1{ #mean monthly rainfalls Long-term climate average @FACT = ("12.6","14.9","18.1","43.8","68.5","100.8","82.2","71.9","42.0","32.8","17.0","17.3","531.4"); @FAGG = ("65.5","57.6","76.1","65.7","49.3","40.9","42.6","61.8","58.8","77.4","66.1","64.3","726.1"); @FAPE = ("38.2","41.0","51.2","55.6","55.0","56.9","46.3","64.6","61.0","57.9","53.2","38.2","621.3"); @FAEL = ("75.8","88.5","106.0","76.8","47.2","33.4","41.6","70.9","74.7","98.3","109.9","76.5","907.0"); @FADN = ("136.5","116.7","121.6","74.8","54.3","27.5","45.3","51.6","67.5","100.5","109.9","110.1","1016.3"); @FARB = ("148.3","154.6","133.5","130.0","89.9","71.8","72.1","59.1","75.3","110.9","132.4","93.4","1286.3"); @FAPM = ("134.8","115.5","108.5","48.0","23.2","12.8","13.4","25.3","53.7","76.8","100.2","117.3","843.0"); @FALS = ("140.2","106.1","94.6","41.3","16.0","7.5","6.9","20.2","31.5","71.5","91.4","109.8","741.3"); @FAUP = ("27.4","33.1","37.4","21.1","8.5","3.8","2.9","3.3","4.3","11.7","16.0","18.8","182.7"); @FAKM = ("63.1","70.5","67.1","45.0","15.2","6.2","6.5","6.8","10.9","35.3","42.5","48.8","417.8"); @FABL = ("88.9","100.1","75.8","50.5","17.0","11.0","8.7","13.0","20.7","50.2","61.2","63.1","563.9"); @FABE = ("108.0","96.5","82.1","44.3","20.3","7.9","7.7","19.3","29.4","77.6","93.6","99.9","684.9"); @FAPB = ("89.7","64.9","54.4","32.6","11.9","5.1","2.9","4.7","13.3","41.3","85.1","85.0","489.9"); @FANS = ("128.8","113.8","98.4","53.7","14.8","8.6","9.3","10.7","24.7","70.3","110.6","122.6","776.4"); @FAJS = ("126.4","101.4","95.7","49.4","15.1","8.1","3.6","6.2","23.9","75.6","114.7","112.0","728.0"); @FAPR = ("130.1","88.9","87.5","49.5","12.6","5.6","2.2","4.5","18.3","73.6","103.8","111.2","688.0"); $maxn = 0; # A counter for the number of entries. $yeartot = 0; $mon=0; $maxn = 0; # A counter for the number of entries. for($n = 1; $n <= 50; $n++){ $fonts[$n]{1} = ""; $fonts[$n]{2} = ""; $fonts[$n]{3} = ""; $fonts[$n]{4} = ""; $fonts[$n]{5} = ""; $fonts[$n]{6} = ""; $fonts[$n]{7} = ""; $fonts[$n]{8} = ""; $fonts[$n]{9} = ""; $fonts[$n]{10} = ""; $fonts[$n]{11} = ""; $fonts[$n]{12} = ""; } @yeartot = (); for ($n = 1;$n <=50;$n++){ &data_routine_rain(@rain, $n); #print"N= $n : $data[$n]{'00'} $sum $count $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'}
"; push(@yeartot, $sum); if($count < 1){ $hi_rain = "N/A"; $lo_rain = "N/A"; $month_hi_rain = "N/A"; $month_lo_rain = "N/A"; push(@value_maxrain,$hi_rain); push(@value_minrain,$lo_rain); push(@month_maxrain,$month_hi_rain); push(@month_minrain,$month_lo_rain); } else{ $hi_rain = sprintf("%03.1f", $hi_rain); $lo_rain = sprintf("%03.1f", $lo_rain); $day_hi_rain = $month_hi_rain; $day_lo_rain = $month_lo_rain; push(@value_maxrain,$hi_rain); push(@value_minrain,$lo_rain); push(@month_maxrain,$month_hi_rain); push(@month_minrain,$month_lo_rain); } #print"N = $n, total = $year_total[$n]
"; #push(%year_total,$data[$n]{'13'},$data[$n]{'00'}); # print"data[$n]{'13'} = $data[$n]{'13'} $data[$n]{'00'}
"; } $n = 1; #updated 01/26/2001 if ($cityName{$city} eq "CAPE TOWN INTERNATIONAL AIRPORT"){ push(@MONTHLY_AVG,"12.6","14.9","18.1","43.8","68.5","100.8","82.2","71.9","42.0","32.8","17.0","17.3","531.4"); $year_ave = $FACT[12]; } elsif ($cityName{$city} eq "GEORGE"){ push(@MONTHLY_AVG,"65.5","57.6","76.1","65.7","49.3","40.9","42.6","61.8","58.8","77.4","66.1","64.3","726.1"); $year_ave = $FAGG[12]; } elsif ($cityName{$city} eq "PORT ELIZABETH"){ push(@MONTHLY_AVG,"38.2","41.0","51.2","55.6","55.0","56.9","46.3","64.6","61.0","57.9","53.2","38.2","621.3"); $year_ave = $FAPE[12]; } elsif ($cityName{$city} eq "EAST LONDON"){ push(@MONTHLY_AVG,"75.8","88.5","106.0","76.8","47.2","33.4","41.6","70.9","74.7","98.3","109.9","76.5","907.0"); $year_ave = $FAEL[12]; } elsif ($cityName{$city} eq "DURBAN"){ push(@MONTHLY_AVG,"136.5","116.7","121.6","74.8","54.3","27.5","45.3","51.6","67.5","100.5","109.9","110.1","1016.3"); $year_ave = $FADN[12]; } elsif ($cityName{$city} eq "RICHARDS BAY"){ push(@MONTHLY_AVG,"148.3","154.6","133.5","130.0","89.9","71.8","72.1","59.1","75.3","110.9","132.4","93.4","1286.3"); $year_ave = $FARB[12]; } elsif ($cityName{$city} eq "PIETERMARITZBURG"){ push(@MONTHLY_AVG,"134.8","115.5","108.5","48.0","23.2","12.8","13.4","25.3","53.7","76.8","100.2","117.3","843.0"); $year_ave = $FAPM[12]; } elsif ($cityName{$city} eq "LADYSMITH"){ push(@MONTHLY_AVG,"140.2","106.1","94.6","41.3","16.0","7.5","6.9","20.2","31.5","71.5","91.4","109.8","741.3"); $year_ave = $FALS[12]; } elsif ($cityName{$city} eq "UPINGTON"){ push(@MONTHLY_AVG,"27.4","33.1","37.4","21.1","8.5","3.8","2.9","3.3","4.3","11.7","16.0","18.8","182.7"); $year_ave = $FAUP[12]; } elsif ($cityName{$city} eq "KIMBERLEY"){ push(@MONTHLY_AVG,"63.1","70.5","67.1","45.0","15.2","6.2","6.5","6.8","10.9","35.3","42.5","48.8","417.8"); $year_ave = $FAKM[12]; } elsif ($cityName{$city} eq "BLOEMFONTEIN"){ push(@MONTHLY_AVG,"88.9","100.1","75.8","50.5","17.0","11.0","8.7","13.0","20.7","50.2","61.2","63.1","563.9"); $year_ave = $FABL[12]; } elsif ($cityName{$city} eq "BETHLEHEM"){ push(@MONTHLY_AVG,"108.0","96.5","82.1","44.3","20.3","7.9","7.7","19.3","29.4","77.6","93.6","99.9","684.9"); $year_ave = $FABE[12]; } elsif ($cityName{$city} eq "PIETERSBURG"){ push(@MONTHLY_AVG,"87.5","64.9","54.4","31.8","11.9","5.1","2.9","4.7","13.3","41.3","85.1","85.0","486.2"); $year_ave = $FAPB[12]; } elsif ($cityName{$city} eq "NELSPRUIT"){ push(@MONTHLY_AVG,"128.8","113.8","98.4","53.7","14.8","8.6","9.3","10.7","24.7","70.3","110.6","122.6","776.4"); $year_ave = $FANS[12]; } elsif ($cityName{$city} eq "JOHANNESBURG"){ push(@MONTHLY_AVG,"126.4","101.4","95.7","49.4","15.1","8.1","3.6","6.2","23.9","75.6","114.7","112.0","728.0"); $year_ave = $FAJS[12]; } elsif ($cityName{$city} eq "PRETORIA"){ push(@MONTHLY_AVG,"130.1","88.9","87.5","49.5","12.6","5.6","2.2","4.5","18.3","73.6","103.8","111.2","688.0"); $year_ave = $FAPR[12]; } for($y=0; $y < 51;$y++){ if ($data[$y+1]{'13'} eq "####"){ $percents{$y+1} = "N/A"; } else{ $percents{$y+1} = sprintf("%3d",($data[$y+1]{'13'}/$year_ave)*100); } } for($y=0; $y < 50;$y=$y+10){ print"

$cityName{$city}
MONTHLY RAINFALL (mm)
$data[$y+1]{'00'} $data[$y+2]{'00'} $data[$y+3]{'00'} $data[$y+4]{'00'} $data[$y+5]{'00'} $data[$y+6]{'00'} $data[$y+7]{'00'} $data[$y+8]{'00'} $data[$y+9]{'00'} $data[$y+10]{'00'} AVE
JAN $fonts[$y+1]{1}$data[$y+1]{'01'} $fonts[$y+2]{1}$data[$y+2]{'01'} $fonts[$y+3]{1}$data[$y+3]{'01'} $fonts[$y+4]{1}$data[$y+4]{'01'} $fonts[$y+5]{1}$data[$y+5]{'01'} $fonts[$y+6]{1}$data[$y+6]{'01'} $fonts[$y+7]{1}$data[$y+7]{'01'} $fonts[$y+8]{1}$data[$y+8]{'01'} $fonts[$y+9]{1}$data[$y+9]{'01'} $fonts[$y+10]{1}$data[$y+10]{'01'} $MONTHLY_AVG[0]
FEB $fonts[$y+1]{2}$data[$y+1]{'02'} $fonts[$y+2]{2}$data[$y+2]{'02'} $fonts[$y+3]{2}$data[$y+3]{'02'} $fonts[$y+4]{2}$data[$y+4]{'02'} $fonts[$y+5]{2}$data[$y+5]{'02'} $fonts[$y+6]{2}$data[$y+6]{'02'} $fonts[$y+7]{2}$data[$y+7]{'02'} $fonts[$y+8]{2}$data[$y+8]{'02'} $fonts[$y+9]{2}$data[$y+9]{'02'} $fonts[$y+10]{2}$data[$y+10]{'02'} $MONTHLY_AVG[1]
MAR $fonts[$y+1]{3}$data[$y+1]{'03'} $fonts[$y+2]{3}$data[$y+2]{'03'} $fonts[$y+3]{3}$data[$y+3]{'03'} $fonts[$y+4]{3}$data[$y+4]{'03'} $fonts[$y+5]{3}$data[$y+5]{'03'} $fonts[$y+6]{3}$data[$y+6]{'03'} $fonts[$y+7]{3}$data[$y+7]{'03'} $fonts[$y+8]{3}$data[$y+8]{'03'} $fonts[$y+9]{3}$data[$y+9]{'03'} $fonts[$y+10]{3}$data[$y+10]{'03'} $MONTHLY_AVG[2]
APR $fonts[$y+1]{4}$data[$y+1]{'04'} $fonts[$y+2]{4}$data[$y+2]{'04'} $fonts[$y+3]{4}$data[$y+3]{'04'} $fonts[$y+4]{4}$data[$y+4]{'04'} $fonts[$y+5]{4}$data[$y+5]{'04'} $fonts[$y+6]{4}$data[$y+6]{'04'} $fonts[$y+7]{4}$data[$y+7]{'04'} $fonts[$y+8]{4}$data[$y+8]{'04'} $fonts[$y+9]{4}$data[$y+9]{'04'} $fonts[$y+10]{4}$data[$y+10]{'04'} $MONTHLY_AVG[3]
MAY $fonts[$y+1]{5}$data[$y+1]{'05'} $fonts[$y+2]{5}$data[$y+2]{'05'} $fonts[$y+3]{5}$data[$y+3]{'05'} $fonts[$y+4]{5}$data[$y+4]{'05'} $fonts[$y+5]{5}$data[$y+5]{'05'} $fonts[$y+6]{5}$data[$y+6]{'05'} $fonts[$y+7]{5}$data[$y+7]{'05'} $fonts[$y+8]{5}$data[$y+8]{'05'} $fonts[$y+9]{5}$data[$y+9]{'05'} $fonts[$y+10]{5}$data[$y+10]{'05'} $MONTHLY_AVG[4]
JUN $fonts[$y+1]{6}$data[$y+1]{'06'} $fonts[$y+2]{6}$data[$y+2]{'06'} $fonts[$y+3]{6}$data[$y+3]{'06'} $fonts[$y+4]{6}$data[$y+4]{'06'} $fonts[$y+5]{6}$data[$y+5]{'06'} $fonts[$y+6]{6}$data[$y+6]{'06'} $fonts[$y+7]{6}$data[$y+7]{'06'} $fonts[$y+8]{6}$data[$y+8]{'06'} $fonts[$y+9]{6}$data[$y+9]{'06'} $fonts[$y+10]{6}$data[$y+10]{'06'} $MONTHLY_AVG[5]
JUL $fonts[$y+1]{7}$data[$y+1]{'07'} $fonts[$y+2]{7}$data[$y+2]{'07'} $fonts[$y+3]{7}$data[$y+3]{'07'} $fonts[$y+4]{7}$data[$y+4]{'07'} $fonts[$y+5]{7}$data[$y+5]{'07'} $fonts[$y+6]{7}$data[$y+6]{'07'} $fonts[$y+7]{7}$data[$y+7]{'07'} $fonts[$y+8]{7}$data[$y+8]{'07'} $fonts[$y+9]{7}$data[$y+9]{'07'} $fonts[$y+10]{7}$data[$y+10]{'07'} $MONTHLY_AVG[6]
AUG $fonts[$y+1]{8}$data[$y+1]{'08'} $fonts[$y+2]{8}$data[$y+2]{'08'} $fonts[$y+3]{8}$data[$y+3]{'08'} $fonts[$y+4]{8}$data[$y+4]{'08'} $fonts[$y+5]{8}$data[$y+5]{'08'} $fonts[$y+6]{8}$data[$y+6]{'08'} $fonts[$y+7]{8}$data[$y+7]{'08'} $fonts[$y+8]{8}$data[$y+8]{'08'} $fonts[$y+9]{8}$data[$y+9]{'08'} $fonts[$y+10]{8}$data[$y+10]{'08'} $MONTHLY_AVG[7]
SEP $fonts[$y+1]{9}$data[$y+1]{'09'} $fonts[$y+2]{9}$data[$y+2]{'09'} $fonts[$y+3]{9}$data[$y+3]{'09'} $fonts[$y+4]{9}$data[$y+4]{'09'} $fonts[$y+5]{9}$data[$y+5]{'09'} $fonts[$y+6]{9}$data[$y+6]{'09'} $fonts[$y+7]{9}$data[$y+7]{'09'} $fonts[$y+8]{9}$data[$y+8]{'09'} $fonts[$y+9]{9}$data[$y+9]{'09'} $fonts[$y+10]{9}$data[$y+10]{'09'} $MONTHLY_AVG[8]
OCT $fonts[$y+1]{10}$data[$y+1]{'10'} $fonts[$y+2]{10}$data[$y+2]{'10'} $fonts[$y+3]{10}$data[$y+3]{'10'} $fonts[$y+4]{10}$data[$y+4]{'10'} $fonts[$y+5]{10}$data[$y+5]{'10'} $fonts[$y+6]{10}$data[$y+6]{'10'} $fonts[$y+7]{10}$data[$y+7]{'10'} $fonts[$y+8]{10}$data[$y+8]{'10'} $fonts[$y+9]{10}$data[$y+9]{'10'} $fonts[$y+10]{10}$data[$y+10]{'10'} $MONTHLY_AVG[9]
NOV $fonts[$y+1]{11}$data[$y+1]{'11'} $fonts[$y+2]{11}$data[$y+2]{'11'} $fonts[$y+3]{11}$data[$y+3]{'11'} $fonts[$y+4]{11}$data[$y+4]{'11'} $fonts[$y+5]{11}$data[$y+5]{'11'} $fonts[$y+6]{11}$data[$y+6]{'11'} $fonts[$y+7]{11}$data[$y+7]{'11'} $fonts[$y+8]{11}$data[$y+8]{'11'} $fonts[$y+9]{11}$data[$y+9]{'11'} $fonts[$y+10]{11}$data[$y+10]{'11'} $MONTHLY_AVG[10]
DEC $fonts[$y+1]{12}$data[$y+1]{'12'} $fonts[$y+2]{12}$data[$y+2]{'12'} $fonts[$y+3]{12}$data[$y+3]{'12'} $fonts[$y+4]{12}$data[$y+4]{'12'} $fonts[$y+5]{12}$data[$y+5]{'12'} $fonts[$y+6]{12}$data[$y+6]{'12'} $fonts[$y+7]{12}$data[$y+7]{'12'} $fonts[$y+8]{12}$data[$y+8]{'12'} $fonts[$y+9]{12}$data[$y+9]{'12'} $fonts[$y+10]{12}$data[$y+10]{'12'} $MONTHLY_AVG[11]
TOTAL $data[$y+1]{'13'} $data[$y+2]{'13'} $data[$y+3]{'13'} $data[$y+4]{'13'} $data[$y+5]{'13'} $data[$y+6]{'13'} $data[$y+7]{'13'} $data[$y+8]{'13'} $data[$y+9]{'13'} $data[$y+10]{'13'} $MONTHLY_AVG[12]
MAX $value_maxrain[$y] $value_maxrain[$y+1] $value_maxrain[$y+2] $value_maxrain[$y+3] $value_maxrain[$y+4] $value_maxrain[$y+5] $value_maxrain[$y+6] $value_maxrain[$y+7] $value_maxrain[$y+8] $value_maxrain[$y+9]
MIN $value_minrain[$y] $value_minrain[$y+1] $value_minrain[$y+2] $value_minrain[$y+3] $value_minrain[$y+4] $value_minrain[$y+5] $value_minrain[$y+6] $value_minrain[$y+7] $value_minrain[$y+8] $value_minrain[$y+9]
% AVE $percents{$y+1} $percents{$y+2} $percents{$y+3} $percents{$y+4} $percents{$y+5} $percents{$y+6} $percents{$y+7} $percents{$y+8} $percents{$y+9} $percents{$y+10}

$city annual rainfall average = $year_ave mm (Long-term climate average)

Values in RED indicate the highest $variable reached & BLUE, the lowest for each month! "; } return $year_ave; } sub data_routine_rain{ #print "

PRE-LOOP PROCESSED.... $data[$n]{'00'}
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'}
"; $count = 0; $sum = 0; $lo_rain = 50; $hi_rain = 0; $month_lo_rain = 99; $month_hi_rain = 99; # month 1 if($data[$n]{'01'} ne "####"){ $count++; $sum = $sum + $data[$n]{'01'}; if($data[$n]{'01'} >= $hi_rain){ $hi_rain = $data[$n]{'01'}; $month_hi_rain = 1; } if($data[$n]{'01'} <= $lo_rain){ $lo_rain = $data[$n]{'01'}; $month_lo_rain = 1; } } # month 2 if($data[$n]{'02'} ne "####"){ $count++; $sum = $sum + $data[$n]{'02'}; if($data[$n]{'02'} >= $hi_rain){ $hi_rain = $data[$n]{'02'}; $month_hi_rain = 2; } if($data[$n]{'02'} <= $lo_rain){ $lo_rain = $data[$n]{'02'}; $month_lo_rain = 2; } } # month 3 if($data[$n]{'03'} ne "####"){ $count++; $sum = $sum + $data[$n]{'03'}; if($data[$n]{'03'} >= $hi_rain){ $hi_rain = $data[$n]{'03'}; $month_hi_rain = 3; } if($data[$n]{'03'} <= $lo_rain){ $lo_rain = $data[$n]{'03'}; $month_lo_rain = 3; } } # month 4 if($data[$n]{'04'} ne "####"){ $count++; $sum = $sum + $data[$n]{'04'}; if($data[$n]{'04'} >= $hi_rain){ $hi_rain = $data[$n]{'04'}; $month_hi_rain = 4; } if($data[$n]{'04'} <= $lo_rain){ $lo_rain = $data[$n]{'04'}; $month_lo_rain = 4; } } # month 5 if($data[$n]{'05'} ne "####"){ $count++; $sum = $sum + $data[$n]{'05'}; if($data[$n]{'05'} >= $hi_rain){ $hi_rain = $data[$n]{'05'}; $month_hi_rain = 5; } if($data[$n]{'05'} <= $lo_rain){ $lo_rain = $data[$n]{'05'}; $month_lo_rain = 5; } } # month 6 if($data[$n]{'06'} ne "####"){ $count++; $sum = $sum + $data[$n]{'06'}; if($data[$n]{'06'} >= $hi_rain){ $hi_rain = $data[$n]{'06'}; $month_hi_rain = 6; } if($data[$n]{'06'} <= $lo_rain){ $lo_rain = $data[$n]{'06'}; $month_lo_rain = 6; } } # month 7 if($data[$n]{'07'} ne "####"){ $count++; $sum = $sum + $data[$n]{'07'}; if($data[$n]{'07'} >= $hi_rain){ $hi_rain = $data[$n]{'07'}; $month_hi_rain = 7; } if($data[$n]{'07'} <= $lo_rain){ $lo_rain = $data[$n]{'07'}; $month_lo_rain = 7; } } # month 8 if($data[$n]{'08'} ne "####"){ $count++; $sum = $sum + $data[$n]{'08'}; if($data[$n]{'08'} >= $hi_rain){ $hi_rain = $data[$n]{'08'}; $month_hi_rain = 8; } if($data[$n]{'08'} <= $lo_rain){ $lo_rain = $data[$n]{'08'}; $month_lo_rain = 8; } } # month 9 if($data[$n]{'09'} ne "####"){ $count++; $sum = $sum + $data[$n]{'09'}; if($data[$n]{'09'} >= $hi_rain){ $hi_rain = $data[$n]{'09'}; $month_hi_rain = 9; $fonts[$n]{9} = ""; } if($data[$n]{'09'} <= $lo_rain){ $lo_rain = $data[$n]{'09'}; $month_lo_rain = 9; } } # month 10 if($data[$n]{'10'} ne "####"){ $count++; $sum = $sum + $data[$n]{'10'}; if($data[$n]{'10'} >= $hi_rain){ $hi_rain = $data[$n]{'10'}; $month_hi_rain = 10; } if($data[$n]{'10'} <= $lo_rain){ $lo_rain = $data[$n]{'10'}; $month_lo_rain = 10; } } # month 11 if($data[$n]{'11'} ne "####"){ $count++; $sum = $sum + $data[$n]{'11'}; if($data[$n]{'11'} >= $hi_rain){ $hi_rain = $data[$n]{'11'}; $month_hi_rain = 11; } if($data[$n]{'11'} <= $lo_rain){ $lo_rain = $data[$n]{'11'}; $month_lo_rain = 11; } } # month 12 if($data[$n]{'12'} ne "####"){ $count++; $sum = $sum + $data[$n]{'12'}; if($data[$n]{'12'} >= $hi_rain){ $hi_rain = $data[$n]{'12'}; $month_hi_rain = 12; } if($data[$n]{'12'} <= $lo_rain){ $lo_rain = $data[$n]{'12'}; $month_lo_rain = 12; } } $fonts[$n]{$month_hi_rain} = ""; $fonts[$n]{$month_lo_rain} = ""; #print "

$data[$n]{'00'} POST LOOP - PROCESSED....
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} #
hirain = $hi_rain month = $month_hi_rain lorain= $lo_rain month = $month_lo_rain count = $count SUM = $sum
"; return $fonts{$month_lo_rain}, $fonts{$month_hi_rain}, $hi_rain, $month_hi_rain, $lo_rain, $month_lo_rain, $sum, $count, $data[$n]{'01'}, $data[$n]{'02'}, $data[$n]{'03'}, $data[$n]{'04'}, $data[$n]{'05'}, $data[$n]{'06'}, $data[$n]{'07'}, $data[$n]{'08'}, $data[$n]{'09'}, $data[$n]{'10'}, $data[$n]{'11'}, $data[$n]{'12'} ; } sub process_rain2{ for($n = 0; $n <= 43; $n++){ $fonts[$n]{1} = ""; $fonts[$n]{2} = ""; $fonts[$n]{3} = ""; $fonts[$n]{4} = ""; $fonts[$n]{5} = ""; $fonts[$n]{6} = ""; $fonts[$n]{7} = ""; $fonts[$n]{8} = ""; $fonts[$n]{9} = ""; $fonts[$n]{10} = ""; $fonts[$n]{11} = ""; $fonts[$n]{12} = ""; $fonts[$n]{13} = ""; $fonts[$n]{14} = ""; $fonts[$n]{15} = ""; $fonts[$n]{16} = ""; $fonts[$n]{17} = ""; $fonts[$n]{18} = ""; $fonts[$n]{19} = ""; $fonts[$n]{20} = ""; $fonts[$n]{21} = ""; $fonts[$n]{22} = ""; $fonts[$n]{23} = ""; $fonts[$n]{24} = ""; } for ($n = 1;$n <43;$n++){ &data_routine_rain2(@rain, $n); #print"N= $n : $data[$n]{'00'} $sum $count $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'}
"; } # Calculate the highest and lowest ever MAX24hr rainfall values for each MONTH for ($x = 1;$x <24; $x = $x + 2){ $x = sprintf("%02d",$x); $y = sprintf("%02d",$x+1); $lo_max24hr{$x} = 500.0; $hi_max24hr{$x} = 0.0; for ($n = 1;$n <43;$n++){ if($data[$n]{$x} ne "****"){ if($data[$n]{$x} >= $hi_max24hr{$x}){ $hi_max24hr{$x} = $data[$n]{$x}; } if($data[$n]{$x} <= $lo_max24hr{$x}){ #print"YEAR($n) : $data[$n]{'00'} - DATA {'$x'} = $data[$n]{$x} MAX = $lo_max24hr{$x} mm
"; $lo_max24hr{$x} = $data[$n]{$x}; #print"lo_max24hr{$x} = $lo_max24hr{$x} mm!

"; } } } } # Calculate the highest and lowest ever MAX24hr rainfall values $lo_max24hr = 500; $hi_max24hr = 0; $day_lo_max24hr = 99; $day_hi_max24hr = 99; for ($n = 1;$n <43;$n++){ if($max24hr_VAL[$n-1] >= $hi_max24hr){ $hi_max24hr = $max24hr_VAL[$n-1]; $day_hi_max24hr = "$max24hr_DAY[$n-1] $data[$n]{'00'} "; } if($min24hr_VAL[$n-1] <= $lo_max24hr){ $lo_max24hr = $min24hr_VAL[$n-1]; $day_lo_max24hr = "$min24hr_DAY[$n-1] $data[$n]{'00'}"; } } $hi_max24hr = sprintf("%3.1f", $hi_max24hr); $lo_max24hr = sprintf("%3.1f", $lo_max24hr); #print"HI : $hi_max24hr on $day_hi_max24hr
"; #print"LO : $lo_max24hr on $day_lo_max24hr
"; print"

"; for ($n = 1;$n <43;$n++){ print" " } print"
$cityName{$city}
MAXIMUM RAINFALL IN 24 HOURS (mm)
YEAR JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE TOT DATE
$data[$n]{'00'} $fonts[$n]{2}$data[$n]{'01'} $fonts[$n]{2}$data[$n]{'02'} $fonts[$n]{4}$data[$n]{'03'} $fonts[$n]{4}$data[$n]{'04'} $fonts[$n]{6}$data[$n]{'05'} $fonts[$n]{6}$data[$n]{'06'} $fonts[$n]{8}$data[$n]{'07'} $fonts[$n]{8}$data[$n]{'08'} $fonts[$n]{10}$data[$n]{'09'} $fonts[$n]{10}$data[$n]{'10'} $fonts[$n]{12}$data[$n]{'11'} $fonts[$n]{12}$data[$n]{'12'} $fonts[$n]{14}$data[$n]{'13'} $fonts[$n]{14}$data[$n]{'14'} $fonts[$n]{16}$data[$n]{'15'} $fonts[$n]{16}$data[$n]{'16'} $fonts[$n]{18}$data[$n]{'17'} $fonts[$n]{18}$data[$n]{'18'} $fonts[$n]{20}$data[$n]{'19'} $fonts[$n]{20}$data[$n]{'20'} $fonts[$n]{22}$data[$n]{'21'} $fonts[$n]{22}$data[$n]{'22'} $fonts[$n]{24}$data[$n]{'23'} $fonts[$n]{24}$data[$n]{'24'}
MAX $hi_max24hr{'01'} $hi_max24hr{'03'} $hi_max24hr{'05'} $hi_max24hr{'07'} $hi_max24hr{'09'} $hi_max24hr{'11'} $hi_max24hr{'13'} $hi_max24hr{'15'} $hi_max24hr{'17'} $hi_max24hr{'19'} $hi_max24hr{'21'} $hi_max24hr{'23'}
MIN $lo_max24hr{'01'} $lo_max24hr{'03'} $lo_max24hr{'05'} $lo_max24hr{'07'} $lo_max24hr{'09'} $lo_max24hr{'11'} $lo_max24hr{'13'} $lo_max24hr{'15'} $lo_max24hr{'17'} $lo_max24hr{'19'} $lo_max24hr{'21'} $lo_max24hr{'23'}

Values in RED indicate the highest $variable reached & BLUE, the lowest for each year!
0.0 represents a TRACE amount of precipitation, and NOT a day without rain
**** = missing or no data available!

"; print"

"; for ($n = 1;$n <43;$n++){ if($max24hr_VAL[$n-1] eq "0"){ $max24hr_VAL[$n-1] = "N/A"; } if($min24hr_VAL[$n-1] eq "500"){ $min24hr_VAL[$n-1] = "N/A"; } if($max24hr_DAY[$n-1] eq "99"){ $max24hr_DAY[$n-1] = "N/A"; } if($min24hr_DAY[$n-1] eq "99"){ $min24hr_DAY[$n-1] = "N/A"; } print" " } print"
$cityName{$city}
MAXIMUM RAINFALL IN 24 HOURS (mm)
YEAR MAX DATE MIN DATE
$data[$n]{'00'} $max24hr_VAL[$n-1] $max24hr_DAY[$n-1] $min24hr_VAL[$n-1] $min24hr_DAY[$n-1]
EVER $hi_max24hr $day_hi_max24hr $lo_max24hr $day_lo_max24hr

0.0 represents a TRACE amount of precipitation, and NOT a day without rain
N/A = missing or no data available!

"; } sub data_routine_rain2{ #print "

PRE-LOOP PROCESSED.... $data[$n]{'00'}
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20'} $data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'}
"; # JAN $lo_rain = 500; $hi_rain = 0; $day_lo_rain = 99; $day_hi_rain = 99; if(($data[$n]{'01'} ne "****")){ if($data[$n]{'01'} >= $hi_rain){ $hi_rain = $data[$n]{'01'}; $day_hi_rain = "$data[$n]{'02'} JAN"; $day_hi_rain_flag = 2; } if($data[$n]{'01'} <= $lo_rain){ $lo_rain = $data[$n]{'01'}; $day_lo_rain = "$data[$n]{'02'} JAN"; $day_lo_rain_flag = 2; } } # FEB if(($data[$n]{'03'} ne "****")){ if($data[$n]{'03'} >= $hi_rain){ $hi_rain = $data[$n]{'03'}; $day_hi_rain = "$data[$n]{'04'} FEB"; $day_hi_rain_flag = 4; } if($data[$n]{'03'} <= $lo_rain){ $lo_rain = $data[$n]{'03'}; $day_lo_rain = "$data[$n]{'04'} FEB"; $day_lo_rain_flag = 4; } } # MAR if(($data[$n]{'05'} ne "****")){ if($data[$n]{'05'} >= $hi_rain){ $hi_rain = $data[$n]{'05'}; $day_hi_rain = "$data[$n]{'06'} MAR"; $day_hi_rain_flag = 6; } if($data[$n]{'05'} <= $lo_rain){ $lo_rain = $data[$n]{'05'}; $day_lo_rain = "$data[$n]{'06'} MAR"; $day_lo_rain_flag = 6; } } # APR if(($data[$n]{'07'} ne "****")){ if($data[$n]{'07'} >= $hi_rain){ $hi_rain = $data[$n]{'07'}; $day_hi_rain = "$data[$n]{'08'} APR"; $day_hi_rain_flag = 8; } if($data[$n]{'07'} <= $lo_rain){ $lo_rain = $data[$n]{'07'}; $day_lo_rain = "$data[$n]{'08'} APR"; $day_lo_rain_flag = 8; } } # MAY if(($data[$n]{'09'} ne "****")){ if($data[$n]{'09'} >= $hi_rain){ $hi_rain = $data[$n]{'09'}; $day_hi_rain = "$data[$n]{'10'} MAY"; $day_hi_rain_flag = 10; } if($data[$n]{'09'} <= $lo_rain){ $lo_rain = $data[$n]{'09'}; $day_lo_rain = "$data[$n]{'10'} MAY"; $day_lo_rain_flag = 10; } } # JUN if(($data[$n]{'11'} ne "****")){ if($data[$n]{'11'} >= $hi_rain){ $hi_rain = $data[$n]{'11'}; $day_hi_rain = "$data[$n]{'12'} JUN"; $day_hi_rain_flag = 12; } if($data[$n]{'11'} <= $lo_rain){ $lo_rain = $data[$n]{'11'}; $day_lo_rain = "$data[$n]{'12'} JUN"; $day_lo_rain_flag = 12; } } # JUL if(($data[$n]{'13'} ne "****")){ if($data[$n]{'13'} >= $hi_rain){ $hi_rain = $data[$n]{'13'}; $day_hi_rain = "$data[$n]{'14'} JUL"; $day_hi_rain_flag = 14; } if($data[$n]{'13'} <= $lo_rain){ $lo_rain = $data[$n]{'13'}; $day_lo_rain = "$data[$n]{'14'} JUL"; $day_lo_rain_flag = 14; } } # AUG if(($data[$n]{'15'} ne "****")){ if($data[$n]{'15'} >= $hi_rain){ $hi_rain = $data[$n]{'15'}; $day_hi_rain = "$data[$n]{'16'} AUG"; $day_hi_rain_flag = 16; } if($data[$n]{'15'} <= $lo_rain){ $lo_rain = $data[$n]{'15'}; $day_lo_rain = "$data[$n]{'16'} AUG"; $day_lo_rain_flag = 16; } } # SEP if(($data[$n]{'17'} ne "****")){ if($data[$n]{'17'} >= $hi_rain){ $hi_rain = $data[$n]{'17'}; $day_hi_rain = "$data[$n]{'18'} SEP"; $day_hi_rain_flag = 18; } if($data[$n]{'17'} <= $lo_rain){ $lo_rain = $data[$n]{'17'}; $day_lo_rain = "$data[$n]{'18'} SEP"; $day_lo_rain_flag = 18; } } # OCT if(($data[$n]{'19'} ne "****")){ if($data[$n]{'19'} >= $hi_rain){ $hi_rain = $data[$n]{'19'}; $day_hi_rain = "$data[$n]{'20'} OCT"; $day_hi_rain_flag = 20; } if($data[$n]{'19'} <= $lo_rain){ $lo_rain = $data[$n]{'19'}; $day_lo_rain = "$data[$n]{'20'} OCT"; $day_lo_rain_flag = 20; } } # NOV if(($data[$n]{'21'} ne "****")){ if($data[$n]{'21'} >= $hi_rain){ $hi_rain = $data[$n]{'21'}; $day_hi_rain = "$data[$n]{'22'} NOV"; $day_hi_rain_flag = 22; } if($data[$n]{'21'} <= $lo_rain){ $lo_rain = $data[$n]{'21'}; $day_lo_rain = "$data[$n]{'22'} NOV"; $day_lo_rain_flag = 22; } } # DEC if($data[$n]{'23'} ne "****"){ if($data[$n]{'23'} >= $hi_rain){ $hi_rain = $data[$n]{'23'}; $day_hi_rain = "$data[$n]{'24'} DEC"; $day_hi_rain_flag = 24; } if($data[$n]{'23'} <= $lo_rain){ $lo_rain = $data[$n]{'23'}; $day_lo_rain = "$data[$n]{'24'} DEC"; $day_lo_rain_flag = 24; } } $fonts[$n]{$day_lo_rain_flag} = ""; $fonts[$n]{$day_hi_rain_flag} = ""; push(@max24hr_VAL,$hi_rain); push(@max24hr_DAY,$day_hi_rain); push(@min24hr_VAL,$lo_rain); push(@min24hr_DAY,$day_lo_rain); #print "

$data[$n]{'00'} POST LOOP - PROCESSED....
"; #print"N= $n : $data[$n]{'00'} $data[$n]{'01'} $data[$n]{'02'} $data[$n]{'03'} $data[$n]{'04'} $data[$n]{'05'} $data[$n]{'06'} $data[$n]{'07'} $data[$n]{'08'} $data[$n]{'09'} $data[$n]{'10'} $data[$n]{'11'} $data[$n]{'12'} $data[$n]{'13'} $data[$n]{'14'} $data[$n]{'15'} $data[$n]{'16'} $data[$n]{'17'} $data[$n]{'18'} $data[$n]{'19'} $data[$n]{'20'} $data[$n]{'21'} $data[$n]{'22'} $data[$n]{'23'} $data[$n]{'24'} #
year = $data[$n]{'00'} hirain = $hi_rain date = $day_hi_rain lorain= $lo_rain date = $day_lo_rain
# max24hr_VAL[$n] = $max24hr_VAL[$n-1]

"; return @max24hr_VAL, @min24hr_DAY, @min24hr_VAL, @min24hr_DAY, $fonts{$day_lo_rain_flag}, $fonts{$day_hi_rain_flag}, $hi_rain, $day_hi_rain, $lo_rain, $day_lo_rain, $data[$n]{'01'}, $data[$n]{'02'}, $data[$n]{'03'}, $data[$n]{'04'}, $data[$n]{'05'}, $data[$n]{'06'}, $data[$n]{'07'}, $data[$n]{'08'}, $data[$n]{'09'}, $data[$n]{'10'}, $data[$n]{'11'}, $data[$n]{'12'}, $data[$n]{'13'}, $data[$n]{'14'}, $data[$n]{'15'}, $data[$n]{'16'}, $data[$n]{'17'}, $data[$n]{'18'}, $data[$n]{'19'}, $data[$n]{'20'}, $data[$n]{'21'}, $data[$n]{'22'}, $data[$n]{'23'}, $data[$n]{'24'} ; } sub climate_days{ $day_40 = 0; # Zero the values at the end of each year once data has been printed! $day_35 = 0; $day_30 = 0; $day_more_25 = 0; $day_less_25 = 0; $day_more_20 = 0; $day_less_20 = 0; $day_more_15 = 0; $day_less_15 = 0; $day_less_10 = 0; $day_more_10 = 0; $day_5 = 0; $day_0 = 0; $day_m5 = 0; $month_count = 0; $tot_day_40 = 0; # Zero the values at the end of each year once data has been printed! $tot_day_35 = 0; $tot_day_30 = 0; $tot_day_more_25 = 0; $tot_day_less_25 = 0; $tot_day_more_20 = 0; $tot_day_less_20 = 0; $tot_day_more_15 = 0; $tot_day_less_15 = 0; $tot_day_less_10 = 0; $tot_day_more_10 = 0; $tot_day_5 = 0; $tot_day_0 = 0; $tot_day_m5 = 0; # Days between certain values or greater than or less than! if($variable eq "DAILY MAXIMUM TEMPERATURE"){ print"

"; } elsif($variable eq "DAILY MINIMUM TEMPERATURE"){ print"

$city  
$variable
No. of Days
DAYS >=40° >=35° >=30° >=25° >=20° >=15° <=10°
"; } elsif($variable eq "DAILY AVERAGE TEMPERATURE"){ print"

$city  
$variable
No. of Days
DAYS >=25° >=20° <=15° <=10° <=5° <=0° <=-5°
"; } for ($y = 1;$y <=$n; $y++){ #loop1 - each year, calculate climate days $month_count++; #we want to count yearly climate days, sets counter for ($x = 1;$x <32; $x++){ #loop2 - each month, calculate the climate days $x = sprintf("%02d",$x); $len = length($data[$y]{'29'}); if($len < 1 ){ $data[$y]{'29'} = "****"; } $len = length($data[$y]{'30'}); if($len < 1 ){ $data[$y]{'30'} = "****"; } $len = length($data[$y]{'31'}); if($len < 1 ){ $data[$y]{'31'} = "****"; } if($data[$y]{$x} ne "****"){ #loop3 - do not count N/A data if($data[$y]{$x} >= 40){ $day_40++; # print"DATA >40 : $data[$y]{$x} on $data[$y]{'00'} x = $x y = $y
"; } if($data[$y]{$x} >= 35){ $day_35++; } if($data[$y]{$x} >= 30){ $day_30++; } if($data[$y]{$x} >= 25){ $day_more_25++; } if($data[$y]{$x} < 25){ $day_less_25++; } if($data[$y]{$x} >= 20){ $day_more_20++; # print"DATA >2 0 : $data[$y]{$x} on $data[$y]{'00'} x = $x y = $y
"; } if($data[$y]{$x} < 20){ $day_less_20++; } if($data[$y]{$x} >= 15){ $day_more_15++; } if($data[$y]{$x} < 15){ $day_less_15++; } if($data[$y]{$x} >= 10){ $day_more_10++; } if($data[$y]{$x} <= 10){ $day_less_10++; # print"DATA < 10 : $data[$y]{$x} on $data[$y]{'00'} x = $x y = $y
"; } if($data[$y]{$x} < 5){ $day_5++; } if($data[$y]{$x} < 0){ $day_0++; # print"DATA < 0 : $data[$y]{$x} on $data[$y]{'00'} x = $x y = $y
"; } if($data[$y]{$x} < -5){ $day_m5++; } }#close loop3 } #close loop2 # Calculate the average number of days per climate statistic if($month_count == 12){ # loop4 - only print yearly value if($variable eq "DAILY MAXIMUM TEMPERATURE"){ $data_year[$y] = substr($data[$y]{'00'},0,4); print" "; $tot_day_40 = $tot_day_40 + $day_40; $tot_day_35 = $tot_day_35 + $day_35; $tot_day_30 = $tot_day_30 + $day_30; $tot_day_more_25 = $tot_day_more_25 + $day_more_25; $tot_day_less_25 = $tot_day_less_25 + $day_less_25; $tot_day_more_20 = $tot_day_more_20 + $day_more_20; $tot_day_less_20 = $tot_day_less_20 + $day_less_20; $tot_day_more_15 = $tot_day_more_15 + $day_more_15; $tot_day_less_15 = $tot_day_less_15 + $day_less_15; $tot_day_less_10 = $tot_day_less_10 + $day_less_10; $tot_day_more_10 = $tot_day_more_10 + $day_more_10; $tot_day_5 = $tot_day_5 + $day_5; $tot_day_0 = $tot_day_0 + $day_0; $tot_day_m5 = $tot_day_m5 + $day_m5; $day_40 = 0; # Zero the values at the end of each year once data has been printed! $day_35 = 0; $day_30 = 0; $day_more_25 = 0; $day_less_25 = 0; $day_more_20 = 0; $day_less_20 = 0; $day_more_15 = 0; $day_less_15 = 0; $day_less_10 = 0; $day_more_10 = 0; $day_5 = 0; $day_0 = 0; $day_m5 = 0; $month_count = 0; } elsif($variable eq "DAILY MINIMUM TEMPERATURE"){ $data_year[$y] = substr($data[$y]{'00'},0,4); print" "; $tot_day_40 = $tot_day_40 + $day_40; $tot_day_35 = $tot_day_35 + $day_35; $tot_day_30 = $tot_day_30 + $day_30; $tot_day_more_25 = $tot_day_more_25 + $day_more_25; $tot_day_less_25 = $tot_day_less_25 + $day_less_25; $tot_day_more_20 = $tot_day_more_20 + $day_more_20; $tot_day_less_20 = $tot_day_less_20 + $day_less_20; $tot_day_more_15 = $tot_day_more_15 + $day_more_15; $tot_day_less_15 = $tot_day_less_15 + $day_less_15; $tot_day_less_10 = $tot_day_less_10 + $day_less_10; $tot_day_more_10 = $tot_day_more_10 + $day_more_10; $tot_day_5 = $tot_day_5 + $day_5; $tot_day_0 = $tot_day_0 + $day_0; $tot_day_m5 = $tot_day_m5 + $day_m5; $day_40 = 0; # Zero the values at the end of each year once data has been printed! $day_35 = 0; $day_30 = 0; $day_more_25 = 0; $day_less_25 = 0; $day_more_20 = 0; $day_less_20 = 0; $day_more_15 = 0; $day_less_15 = 0; $day_less_10 = 0; $day_more_10 = 0; $day_5 = 0; $day_0 = 0; $day_m5 = 0; $month_count = 0; } elsif($variable eq "DAILY AVERAGE TEMPERATURE"){ $data_year[$y] = substr($data[$y]{'00'},0,4); print" "; $tot_day_40 = $tot_day_40 + $day_40; $tot_day_35 = $tot_day_35 + $day_35; $tot_day_30 = $tot_day_30 + $day_30; $tot_day_more_25 = $tot_day_more_25 + $day_more_25; $tot_day_less_25 = $tot_day_less_25 + $day_less_25; $tot_day_more_20 = $tot_day_more_20 + $day_more_20; $tot_day_less_20 = $tot_day_less_20 + $day_less_20; $tot_day_more_15 = $tot_day_more_15 + $day_more_15; $tot_day_less_15 = $tot_day_less_15 + $day_less_15; $tot_day_less_10 = $tot_day_less_10 + $day_less_10; $tot_day_more_10 = $tot_day_more_10 + $day_more_10; $tot_day_5 = $tot_day_5 + $day_5; $tot_day_0 = $tot_day_0 + $day_0; $tot_day_m5 = $tot_day_m5 + $day_m5; $day_40 = 0; # Zero the values at the end of each year once data has been printed! $day_35 = 0; $day_30 = 0; $day_more_25 = 0; $day_less_25 = 0; $day_more_20 = 0; $day_less_20 = 0; $day_more_15 = 0; $day_less_15 = 0; $day_less_10 = 0; $day_more_10 = 0; $day_5 = 0; $day_0 = 0; $day_m5 = 0; $month_count = 0; } } #close loop4 } # close loop1 $ave_day_40 = sprintf("%02.1f",$tot_day_40/($tot_months/12)); $ave_day_35 = sprintf("%02.1f",$tot_day_35/($tot_months/12)); $ave_day_30 = sprintf("%02.1f",$tot_day_30/($tot_months/12)); $ave_day_more_25 = sprintf("%02.1f",$tot_day_more_25/($tot_months/12)); $ave_day_less_25 = sprintf("%02.1f",$tot_day_less_25/($tot_months/12)); $ave_day_more_20 = sprintf("%02.1f",$tot_day_more_20/($tot_months/12)); $ave_day_less_20 = sprintf("%02.1f",$tot_day_less_20/($tot_months/12)); $ave_day_more_15 = sprintf("%02.1f",$tot_day_more_15/($tot_months/12)); $ave_day_less_15 = sprintf("%02.1f",$tot_day_less_15/($tot_months/12)); $ave_day_less_10 = sprintf("%02.1f",$tot_day_less_10/($tot_months/12)); $ave_day_more_10 = sprintf("%02.1f",$tot_day_more_10/($tot_months/12)); $ave_day_5 = sprintf("%02.1f",$tot_day_5/($tot_months/12)); $ave_day_0 = sprintf("%02.1f",$tot_day_0/($tot_months/12)); $ave_day_m5 = sprintf("%02.1f",$tot_day_m5/($tot_months/12)); if($variable eq "DAILY MAXIMUM TEMPERATURE"){ print"
$city  
$variable
No. of Days
DAYS >=30° >=25° >=20° >=15° >=10° <=10° <=0°
$data_year[$y] $day_40 $day_35 $day_30 $day_more_25 $day_more_20 $day_more_15 $day_less_10
$data_year[$y] $day_more_25 $day_more_20 $day_less_15 $day_less_10 $day_5 $day_0 $day_m5
$data_year[$y] $day_30 $day_more_25 $day_more_20 $day_more_15 $day_more_10 $day_less_10 $day_0
AVE $ave_day_40 $ave_day_35 $ave_day_30 $ave_day_more_25 $ave_day_more_20 $ave_day_more_15 $ave_day_less_10
"; } elsif($variable eq "DAILY MINIMUM TEMPERATURE"){ print" AVE $ave_day_more_25 $ave_day_more_20 $ave_day_less_15 $ave_day_less_10 $ave_day_5 $ave_day_0 $ave_day_m5 "; } elsif($variable eq "DAILY AVERAGE TEMPERATURE"){ print" AVE $ave_day_30 $ave_day_more_25 $ave_day_more_20 $ave_day_more_15 $ave_day_more_10 $ave_day_less_10 $ave_day_0 "; } return } # This subruotine is only used when new daily data is obtained and processed before using this routine to transpose the data. sub process_new_daily_rain{ $DATAFILE_RAIN3="$datadir/$citycode{$city}_daily_rainfall.txt"; $DATAFILE_RAIN4="$datadir/$citycode{$city}_daily_RR.txt"; open DATAFILE_RAIN3 or die "Can't open $DATAFILE_RAIN3 datafile : $!"; open(OUTPUT, "> $DATAFILE_RAIN4") || die "Can't open $DATAFILE_RAIN4: $!"; print "INPUT FILE : $DATAFILE_RAIN3
"; print "OUTPUT FILE : $DATAFILE_RAIN4

"; while () { chomp; @rain = split(/;/); # Split the line into the data fields. $n++; $data[$n]{'00'} = $rain[0]; # First field is the date YYYY or DD $data[$n]{'01'} = $rain[1]; # JAN $data[$n]{'02'} = $rain[2]; # FEB $data[$n]{'03'} = $rain[3]; # MAR $data[$n]{'04'} = $rain[4]; # APR $data[$n]{'05'} = $rain[5]; # MAY $data[$n]{'06'} = $rain[6]; # JUN $data[$n]{'07'} = $rain[7]; # JUL $data[$n]{'08'} = $rain[8]; #AUG $data[$n]{'09'} = $rain[9]; #SEP $data[$n]{'10'} = $rain[10]; # OCT $data[$n]{'11'} = $rain[11]; # NOV $data[$n]{'12'} = $rain[12]; # DEC } print "N = $n : [$data[1]{'12'}]

"; $y=$n; for ($n=1;$n <$y;$n++){ $len = length($data[$n]{'00'}); if($len < 3 ){ $data[$n]{'00'}= sprintf("%02d", $data[$n]{'00'}); } } for ($n=1;$n <$y;$n=$n+32){ print OUTPUT <"; $counter = 0; $z = 0; for ($x = 1;$x <52; $x++){ #$x = sprintf("%02d",$x); if($data[$x]{'13'} eq "####"){ $data[$x]{'13'} = $year_ave; #print "$data[$x]{'00'} $data[$x]{'13'}"; } #print"$data[$x]{'00'} $data[$x]{'13'}
"; } %year_total = ( "$data[1]{'13'}",$data[1]{'00'},"$data[2]{'13'}",$data[2]{'00'},"$data[3]{'13'}",$data[3]{'00'},"$data[4]{'13'}",$data[4]{'00'},"$data[5]{'13'}",$data[5]{'00'},"$data[6]{'13'}",$data[6]{'00'},"$data[7]{'13'}",$data[7]{'00'},"$data[8]{'13'}",$data[8]{'00'},"$data[9]{'13'}",$data[9]{'00'},"$data[10]{'13'}",$data[10]{'00'}, "$data[11]{'13'}",$data[11]{'00'},"$data[12]{'13'}",$data[12]{'00'},"$data[13]{'13'}",$data[13]{'00'},"$data[14]{'13'}",$data[14]{'00'},"$data[15]{'13'}",$data[15]{'00'},"$data[16]{'13'}",$data[16]{'00'},"$data[17]{'13'}",$data[17]{'00'},"$data[18]{'13'}",$data[18]{'00'},"$data[19]{'13'}",$data[19]{'00'},"$data[20]{'13'}",$data[20]{'00'}, "$data[21]{'13'}",$data[21]{'00'},"$data[22]{'13'}",$data[22]{'00'},"$data[23]{'13'}",$data[23]{'00'},"$data[24]{'13'}",$data[24]{'00'},"$data[25]{'13'}",$data[25]{'00'},"$data[26]{'13'}",$data[26]{'00'},"$data[27]{'13'}",$data[27]{'00'},"$data[28]{'13'}",$data[28]{'00'},"$data[29]{'13'}",$data[29]{'00'},"$data[30]{'13'}",$data[30]{'00'}, "$data[31]{'13'}",$data[31]{'00'},"$data[32]{'13'}",$data[32]{'00'},"$data[33]{'13'}",$data[33]{'00'},"$data[34]{'13'}",$data[34]{'00'},"$data[35]{'13'}",$data[35]{'00'},"$data[36]{'13'}",$data[36]{'00'},"$data[37]{'13'}",$data[37]{'00'},"$data[38]{'13'}",$data[38]{'00'},"$data[39]{'13'}",$data[39]{'00'},"$data[40]{'13'}",$data[40]{'00'}, "$data[41]{'13'}",$data[41]{'00'},"$data[42]{'13'}",$data[42]{'00'},"$data[43]{'13'}",$data[43]{'00'},"$data[44]{'13'}",$data[44]{'00'},"$data[45]{'13'}",$data[45]{'00'},"$data[46]{'13'}",$data[46]{'00'},"$data[47]{'13'}",$data[47]{'00'},"$data[48]{'13'}",$data[48]{'00'},"$data[49]{'13'}",$data[49]{'00'},"$data[50]{'13'}",$data[50]{'00'}, "$data[51]{'13'}",$data[51]{'00'}); #print %year_total, "
"; @ordered = sort { $a <=> $b; } (keys(%year_total)); @high_to_low = reverse(@ordered); #print @ordered, "\n
"; print"

The Ten driest years :

"; foreach $item (@ordered){ $z++; #print "ITEM(Z) YEAR = $item ($z) $year_total{$item}
"; if($item > 0){ $counter++; if($counter <= 10){ $percents = sprintf("%4.1f",(($item/$year_ave )*100)); $deficit = sprintf("%4.1f",$year_ave - $item); print "$counter: $item mm ($year_total{$item}) [$percents% or -$deficit mm]
\n"; } } } $z=0; $counter=0; print"

The Ten wettest years :

"; foreach $item (@high_to_low){ $z++; if($item > 0){ $counter++; if($counter <= 10){ $percents = sprintf("%4.1f",(($item/$year_ave )*100)); $surplus = sprintf("%4.1f",$item - $year_ave ); print "$counter: $item mm ($year_total{$item}) [$percents% = +$surplus mm]
\n"; } } } return } sub temp_graphs { $n= 0; &climate_info($DATAFILE_CA); # We either choose to graph individual months of a certain year and use the "monthly" routine, else we plot all the annual data using the "yearly" routine. if($variable eq "MONTHLY TEMPERATURE GRAPHS"){ #monthly routine $n = (($year - 1960)+1); $DATAFILE_TEMP5="$datadir1/$citycode{$city}_ctl_TX_$year.txt"; $DATAFILE_TEMP6="$datadir1/$citycode{$city}_graph_TX_$year.txt"; $DATAFILE_TEMP7="$datadir1/$citycode{$city}_graph_TN_$year.txt"; $DATAFILE_TEMP8="$datadir1/$citycode{$city}_graph_TM_$year.txt"; $DATAFILE_TEMP9="$datadir1/$citycode{$city}_graph_TEMP_$year.txt"; $ctl_file = "$citycode{$city}_ctl_TX_$year.txt"; $data_file1 = "$citycode{$city}_graph_TX_$year.txt"; $data_file2 = "$citycode{$city}_graph_TN_$year.txt"; $data_file3 = "$citycode{$city}_graph_TM_$year.txt"; $data_file4 = "$citycode{$city}_graph_TEMP_$year.txt"; open(OUTPUT1, "> $DATAFILE_TEMP5") || die "Can't open $DATAFILE_TEMP5: $!"; open(OUTPUT2, "> $DATAFILE_TEMP6") || die "Can't open $DATAFILE_TEMP6: $!"; open(OUTPUT3, "> $DATAFILE_TEMP7") || die "Can't open $DATAFILE_TEMP7: $!"; open(OUTPUT4, "> $DATAFILE_TEMP8") || die "Can't open $DATAFILE_TEMP8: $!"; open(OUTPUT5, "> $DATAFILE_TEMP9") || die "Can't open $DATAFILE_TEMP9: $!"; print OUTPUT1 < $cityName{$city}
$year
MONTHLY TEMPERATURE  Mean maximum temp: $datatx[$n]{'13'} °C ( AVE = $climate[1]{'13'} °C)
 Mean annual temp: $datatm[$n]{'13'} °C ( AVE = $climate[3]{'13'} °C)
 Mean minimum temp: $datatn[$n]{'13'} °C ( AVE = $climate[2]{'13'} °C)

Where :

"; } # End of monthly graphs else{ #YEARLY routine $DATAFILE_TEMP5="$datadir1/$citycode{$city}_ctl_TX.txt"; $DATAFILE_TEMP6="$datadir1/$citycode{$city}_annualgraph_TX.txt"; $DATAFILE_TEMP7="$datadir1/$citycode{$city}_annualgraph_TN.txt"; $DATAFILE_TEMP8="$datadir1/$citycode{$city}_annualgraph_TM.txt"; $DATAFILE_TEMP9="$datadir1/$citycode{$city}_annualgraph_TEMP.txt"; $ctl_file = "$citycode{$city}_ctl_TX.txt"; $data_file1 = "$citycode{$city}_annualgraph_TX.txt"; $data_file2 = "$citycode{$city}_annualgraph_TN.txt"; $data_file3 = "$citycode{$city}_annualgraph_TM.txt"; $data_file4 = "$citycode{$city}_annualgraph_TEMP.txt"; open(OUTPUT1, "> $DATAFILE_TEMP5") || die "Can't open $DATAFILE_TEMP5: $!"; open(OUTPUT2, "> $DATAFILE_TEMP6") || die "Can't open $DATAFILE_TEMP6: $!"; open(OUTPUT3, "> $DATAFILE_TEMP7") || die "Can't open $DATAFILE_TEMP7: $!"; open(OUTPUT4, "> $DATAFILE_TEMP8") || die "Can't open $DATAFILE_TEMP8: $!"; open(OUTPUT5, "> $DATAFILE_TEMP9") || die "Can't open $DATAFILE_TEMP9: $!"; print OUTPUT1 < $cityName{$city}
ANNUAL TEMPERATURE  Mean Maximum annual temp: $climate[1]{'13'} °C
 Mean annual temp: $climate[3]{'13'} °C
 Mean Minimum annual temp: $climate[2]{'13'} °C
"; } # end of yearly routine return } sub rain_graphs { &climate_info($DATAFILE_CA); $n = (($year - 1960)+1); $DATAFILE_RAIN5="$datadir1/$citycode{$city}_ctl_RR_$year.txt"; $DATAFILE_RAIN6="$datadir1/$citycode{$city}_graph_RR_$year.txt"; $ctl_file = "$citycode{$city}_ctl_RR_$year.txt"; $data_file = "$citycode{$city}_graph_RR_$year.txt"; open(OUTPUT1, "> $DATAFILE_RAIN5") || die "Can't open $DATAFILE_RAIN5: $!"; open(OUTPUT2, "> $DATAFILE_RAIN6") || die "Can't open $DATAFILE_RAIN6: $!"; print OUTPUT1 < $cityName{$city}
$year
MONTHLY RAINFALL # #  Total Rainfall : $datarr[$n]{'13'}mm (AVE = $MONTHLY_AVG_RR[12]mm)
"; return } sub climate_info{ open DATAFILE_CA or die "Can't open $DATAFILE_CA datafile : $!"; #print"DATAFILE = $DATAFILE_TEMP1

\n"; $a=0; while () { chomp; @temp = split(/;/); # Split the line into the data fields. $a++; $climate[$a]{'00'} = $temp[0]; # First field is the date YYYY/MM $climate[$a]{'01'} = $temp[1]; # JAN etc $climate[$a]{'02'} = $temp[2]; $climate[$a]{'03'} = $temp[3]; $climate[$a]{'04'} = $temp[4]; $climate[$a]{'05'} = $temp[5]; $climate[$a]{'06'} = $temp[6]; $climate[$a]{'07'} = $temp[7]; $climate[$a]{'08'} = $temp[8]; $climate[$a]{'09'} = $temp[9]; $climate[$a]{'10'} = $temp[10]; $climate[$a]{'11'} = $temp[11]; $climate[$a]{'12'} = $temp[12]; $climate[$a]{'13'} = $temp[13]; # year tot } push(@MONTHLY_AVG_TX,"$climate[1]{'01'}","$climate[1]{'02'}","$climate[1]{'03'}","$climate[1]{'04'}","$climate[1]{'05'}","$climate[1]{'06'}","$climate[1]{'07'}","$climate[1]{'08'}","$climate[1]{'09'}","$climate[1]{'10'}","$climate[1]{'11'}","$climate[1]{'12'}","$climate[1]{'13'}"); push(@MONTHLY_AVG_TN,"$climate[2]{'01'}","$climate[2]{'02'}","$climate[2]{'03'}","$climate[2]{'04'}","$climate[2]{'05'}","$climate[2]{'06'}","$climate[2]{'07'}","$climate[2]{'08'}","$climate[2]{'09'}","$climate[2]{'10'}","$climate[2]{'11'}","$climate[2]{'12'}","$climate[2]{'13'}"); push(@MONTHLY_AVG_TM,"$climate[3]{'01'}","$climate[3]{'02'}","$climate[3]{'03'}","$climate[3]{'04'}","$climate[3]{'05'}","$climate[3]{'06'}","$climate[3]{'07'}","$climate[3]{'08'}","$climate[3]{'09'}","$climate[3]{'10'}","$climate[3]{'11'}","$climate[3]{'12'}","$climate[3]{'13'}"); push(@MONTHLY_AVG_RR,"$climate[4]{'01'}","$climate[4]{'02'}","$climate[4]{'03'}","$climate[4]{'04'}","$climate[4]{'05'}","$climate[4]{'06'}","$climate[4]{'07'}","$climate[4]{'08'}","$climate[4]{'09'}","$climate[4]{'10'}","$climate[4]{'11'}","$climate[4]{'12'}","$climate[4]{'13'}"); return @MONTHLY_AVG_TX, @MONTHLY_AVG_TN, @MONTHLY_AVG_TM, @MONTHLY_AVG_RR; }