Skip to content

Instantly share code, notes, and snippets.

@voodoojello
Last active August 29, 2015 14:21
Show Gist options
  • Save voodoojello/59d3a7a8fa3aa7ef6984 to your computer and use it in GitHub Desktop.
Save voodoojello/59d3a7a8fa3aa7ef6984 to your computer and use it in GitHub Desktop.
Perl Heat Index Calculation
#!/usr/bin/perl
#
use strict;
use warnings;
my $tf = $ARGV[0]; # Temperature in degrees Fahrenheit
my $rh = $ARGV[1]; # Abs. Relative Humidity
my $hi = -42.379 + 2.04901523 * $tf
+ 10.14333127 * $rh
- 0.22475541 * $tf * $rh
- (6.83783 * 10**(-3)) * ($tf**(2))
- (5.481717 * 10**(-2)) * ($rh**(2))
+ (1.22874 * 10**(-3)) * ($tf**(2)) * $rh
+ (8.5282 * 10**(-4)) * $tf * ($rh**(2))
- (1.99 * 10**(-6)) * ($tf**(2)) * ($rh**(2));
print $hi . "\n";
exit;
__END__
http://en.wikipedia.org/wiki/Heat_index
http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment