#!/usr/bin/perl # PROGRAMED MY JOSHUA PATTERSON # SPRING OF 2005. use CGI qw(param); use LWP::Simple; &init_vars; &decoder; sub decoder { $data = get("http://asp1.sbs.ohio-state.edu/text/tropical/atlantic/URNT12.KNHC") if($ENV{'REQUEST_METHOD'} eq "GET"); $data = param('data') if($ENV{'REQUEST_METHOD'} eq "POST"); @LINES = split("\n",$data); print "Content-Type: text/html\n\n"; print < Hurricane Data

Vortex Recon Decoder


HTML foreach(@LINES){ $line++; if(/^[A][.]/){ if(/\:/){$new = 1;} s/[A]. //; ($DATE,$TIME) = split("\/"); if(!$new){ @DIGITS = split(//, $TIME); $TIME = "$DIGITS[0]$DIGITS[1]:$DIGITS[2]$DIGITS[3]$DIGITS[4]"; } $TIME =~ s/[Z]/ Zulu/; $DECODE{'A'} = "Date/Time of Recon Report: $MONTHS[$mon] $DATE, $year $TIME"; } if(/^[B][.]/){ s/[B]. //; if($_ !~ /[w]/){$_ = "$_ $LINES[$line]";} tr/[A-Z]/[a-z]/; m/(\d+) deg (\d+) min (\D+) (\d+) deg (\d+) min (\D+)/; if(defined($1)){ $deg1 = $1; $min1 = $2; $deg2 = $4; $min2 = $5; $D1 = $3; $D2 = $6; $D1 =~ tr/[a-z]/[A-Z]/; $D2 =~ tr/[a-z]/[A-Z]/; $North = sprintf("%.2f",$deg1+$min1/60); $West = sprintf("%.2f",$deg2+$min2/60); } else {print "NA";} s/min/'/g; tr/[a-z]/[A-Z]/; s/DEG/°/g; $DECODE{'B'} = "Position Of The Center: $_ ($North° $D1  $West° $D2) "; } if(/^[C][.]/){ tr/[A-Z]/[a-z]/; s/[c]. //; s/ //g; m/(\D+)mb(\d+)m/; m/(\d+)mb(\d+)m/; @DATA = split(/\|/, $BARS{$1}); $level = $1; $normal = $DATA[1]; if($level eq "na"){$level = "N/A";$normal="N/A";} $DECODE{'C'} = "Minimum Height Measured At Standard Level Of $level Millibars: $2 Meters (Normal: $normal Meters)\n"; } if(/^[D][.]/){ s/[D]. //; tr/[A-Z]/[a-z]/; s/ //g; m/(\D+)kt/; m/(\d+)kt/; $speed = $1; if($speed eq "na"){$speed = 0;} $DECODE{'D'} = "Maximum Surface Winds Were Estimated At: $speed Knots (" .$speed*1.15." MPH)"; } if(/^[E][.]/){ s/[E]. //; s/ //g; tr/[A-Z]/[a-z]/; m/(\d+)deg(\d+)nm/; $est = $2; $est_miles = $est *1.15; if($est eq ""){$est = "N/A"; $est_miles = "N/A";} $DECODE{'E'} = "Estimated Surface Winds Were Measured At: $est Nautical Miles ($est_miles miles) From Center At Bearing $1°"; } if(/^[F][.]/){ s/[F]. //; s/ //g; tr/[A-Z]/[a-z]/; m/(\d+)deg(\d+)kt/; $DECODE{'F'} = "Maximum Flight Level Winds Near Center Were $2 Knots (".$2*1.15." MPH) From $1°"; } if(/^[G][.]/){ s/[G]. //; s/ //g; tr/[A-Z]/[a-z]/; m/(\d+)deg(\d+)nm/; $DECODE{'G'} = "Maximum Flight Level Winds Were Measured $2 Nautical Miles (".$2*1.15." Miles) From Center At Bearing $1°"; } if(/^[H][.]/){ s/[H]. //; tr/[A-Z]/[a-z]/; s/ //g; m/(\d+)mb/; m/(\D+)(\d+)mb/; if($2 eq ""){$MSG = "$1 Millibars";$pressure=$1;} if($2 ne ""){$MSG = "$1 $2 Millibars";$pressure=$2;} $inches = sprintf("%.3f",$pressure/33.8653); $DECODE{'H'} = "Minimum Pressure: $MSG ($inches Inches)"; } if(/^[I][.]/){ s/[I]. //; s/\///; tr/[A-Z]/[a-z]/; s/ //g; m/(\d+)c(\d+)m/; $far = $1 * 9 / 5 + 32; $DECODE{'I'} = "Maxium Flight Level Temperature / Pressure Altitude Outside The Eye: $1°C ($far°F) / $2 Meters"; } if(/^[J][.]/){ s/[J]. //; s/\///; tr/[A-Z]/[a-z]/; s/ //g; m/(\d+)c(\d+)m/; $far = $1 * 9 / 5 + 32; $DECODE{'J'} = "Maximum Flight Level Temperature / Pressure Altitude Inside The Eye: $1°C ($far°F) / $2 Meters"; } if(/^[K][.]/){ s/[K]. //; s/[C]//; @COND = split(/\//); $COND[0] =~ s/[ ]$//; $COND[1] =~ s/[ ]$//; $far = $COND[0] * 9 / 5 + 32; $f2 = $COND[1] * 9 / 5 + 32 if($COND[1] =~ m/[0-9]/); if($COND[1] !~ /[0-9]/){$COND[1] = "NA";$f2 = "NA";} $DECODE{'K'} = "Dewpoint Temperature / Sea Surface Temperature Inside The Eye: $COND[0]°C ($far°F) / $COND[1]°C ($f2°F)"; } if(/^[L][.]/){ s/[L]. //; s/\n//; $DECODE{'L'} = "Eye Wall Was Characterized As Being: $_"; } if(/^[M][.]/){ s/[M]. //; s/\n//; $DECODE{'M'} = "Eye Form Was Characterized As Being: $_" ; } if(/^[N][.]/){ s/[N]. //; ($OBV,$LEV) = split(/\//); @OBVS = split(//, $OBV); foreach $observ(@OBVS){ $OBVString = "$OBVString $OBSERVES[$observ]" if($observ ne ""); } @LEVES = split(/ /, $LEV); foreach $LEVE(@LEVES){ chomp($LEVE); $LEVString = "$LEVString $LEVELS[$LEVE]" if($LEVE ne ""); } $DECODE{'N'} = "Center Fix Established Using: $OBVString"; $DECODE{'N2'} = "Center Fix Established At Level(s): $LEVString"; } if(/^[O][.]/){ s/[O]. //; s/ //g; s/nm//; @ACCURATE = split(/\//); $NAV = $ACCURATE[0]; $METEO = $ACCURATE[1]; $METEO =~ s/[M-Nm-n]//g; $DECODE{'O'} = "Navigational Accuracy Measured At: $NAV Nautical Miles"; $DECODE{'O2'} = "Meteorological Accuracy Measured At: $METEO Nautical Miles"; } if(/^[P][.]/){ s/[P]. //; @sets = split(/ /); $sets[0] =~ m/(\D+)(\d+)/; $flight_info = "$1 \#$2"; $sets[1] =~ m/(\d+)(\d+)(\d+)(\d+)(\D+)/; $flights = "$1$2"; $storm = "$3$4"; $basin = $5; $DECODE{'P'} = "Storm $sets[2]: Observed by $flight_info"; $DECODE{'P2'} = "Storm \#$storm In $BASINS{$basin} Ocean"; $DECODE{'P3'} = "Total Flights For Storm \#$storm: $flights"; $comment = $line; }} $extLine = "

Other Information:"; for($comment...$#LINES){ $comment_count++; $extLine = "$extLine
$comment_count: $LINES[$_]" if($LINES[$_] =~ /[A-Za-z]/); } $extLine =~ s/MAX/Maximum/g; $extLine =~ s/FL/Flight Level/g; $extLine =~ s/WIND/Winds Were/; $extLine =~ s/QUAD/Quadrant at/; $extLine =~ s/TEMP/Temp/; $DECODE{'PILOT'} = $extLine; foreach $key(sort(keys(%DECODE))){ print "$DECODE{$ORDER{$key}}
\n"; } chomp($data); print <


Enter Your Own Data: (Vortex Recon)

END_OF_HTML } sub init_vars { %BARS = (); %LEVELS = (); %OBSERVES = (); %BASINS = (); %ORDER = (); %DECODE = (); @MONTHS = (); $new = 0; $comment = 0; @MONTHS = ('January','February','March','April','May','June','July','August','September','October','November','December'); ($s,$m,$h,$mday,$mon,$year,$wday,$yday,$isdst ) = localtime( time ); $year = $year + 1900; $/ = "\n"; $BARS{'925'} = "2500|762"; $BARS{'850'} = "4780|1457"; $BARS{'700'} = "9880|3011"; $LEVELS[0] = "Surface"; $LEVELS[1] = "1500 Feet"; $LEVELS[2] = "200 Millibars"; $LEVELS[3] = "300 Millibars"; $LEVELS[4] = "400 Millibars"; $LEVELS[5] = "500 Millibars"; $LEVELS[6] = "700 Millibars";#IGNORE $LEVELS[7] = "700 Millibars"; $LEVELS[8] = "850 Millibars"; $LEVELS[9] = "925 Millibars"; $OBSERVES[1] = "Penetration"; $OBSERVES[2] = "Radar"; $OBSERVES[3] = "Wind"; $OBSERVES[4] = "Pressure"; $OBSERVES[5] = "Temperature"; $BASINS{'A'} = "Atlantic"; $BASINS{'C'} = "Central Pacific"; $BASINS{'E'} = "Eastern Pacific"; $ORDER{'A'} = "P"; $ORDER{'B'} = "P2"; $ORDER{'C'} = "P3"; $ORDER{'D'} = "A"; $ORDER{'E'} = "B"; $ORDER{'F'} = "C"; $ORDER{'G'} = "D"; $ORDER{'H'} = "E"; $ORDER{'I'} = "F"; $ORDER{'J'} = "G"; $ORDER{'K'} = "H"; $ORDER{'L'} = "I"; $ORDER{'M'} = "J"; $ORDER{'N'} = "K"; $ORDER{'N2'} = "L"; $ORDER{'O'} = "M"; $ORDER{'O2'} = "N"; $ORDER{'P'} = "N2"; $ORDER{'P2'} = "O"; $ORDER{'P3'} = "O2"; $ORDER{'PILOT'} = "PILOT"; } # PROGRAMED MY JOSHUA PATTERSON # SPRING OF 2005.