#stnpress.cgi by Tim Brice NWS El Paso
#Change pressure to millibars and height to meters
if ($stn{press} =~ /(\d+)\.?(\d+)|^\d+?/) {
if ($stn{inormb} =~ millibars) {
$press = $stn{press};
} else {
$press = $stn{press} * 33.8639;
}
} else {
print "An illegal character was entered.\n";
die
}
if ($stn{height} =~ /(\d+)\.?(\d+)|^\d+$/) {
if ($stn{ftorm} =~ meters) {
$height = $stn{height};
} else {
$height = $stn{height} * .3048;
}
} else {
print "An illegal character was entered.\n";
die
}
#Do some math
$n2 = 0.190284;
$p22 = $press**$n2;
$p23 = 8.42288e-05 * $height;
$p24 = 1/$n2;
$p2 = ($p22 - $p23)**$p24 + 0.3;
#Make some pretty output
$p21 = $p2 * 0.0295300;
$~ = AT1;
write;
format AT1 =
With an altimeter setting of @###.## @<<<<<<<<<<<<<<<<< and a station
$stn{press} $stn{inormb}
elevation of @####.# @<<<<<<:
$stn{height} $stn{ftorm}
You get an actual station pressure of @#.## inches of Mercury $p21 or@###.# Millibars. $p2 . print "
Please note, if you are pilot, you should not use the Weather Calculator for any kind of flight planning. The Weather Calculator is for general information and entertainment purposes only.";