File Coverage

blib/lib/Temperature/Windchill.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 2 2 100.0
total 26 26 100.0


line stmt bran cond sub pod time code
1             package Temperature::Windchill;
2              
3 4     4   3932 use strict;
  4         10  
  4         160  
4 4     4   25 use warnings;
  4         8  
  4         138  
5 4     4   32 use base 'Exporter';
  4         8  
  4         531  
6 4     4   25 use vars qw( $VERSION @EXPORT_OK );
  4         8  
  4         900  
7              
8             $VERSION = '0.04';
9             @EXPORT_OK = qw( windchill_si windchill_us );
10              
11             =head1 NAME
12              
13             Temperature::Windchill - calculate effective temperature on exposed skin
14              
15             =head1 SYNOPSIS
16              
17             use Temperature::Windchill qw/ windchill_us windchill_si /;
18              
19             # calculate windchill in American units (Fahrenheit/MPH)
20             $wc_us = windchill_us($temp_in_F, $windspeed_in_MPH);
21              
22             # calculate windchill in International units (Celsius/KPH)
23             $wc_si = windchill_si($temp_in_C, $windspeed_in_KPH);
24              
25             =head1 DESCRIPTION
26              
27             This module implements the standard US National Weather Service windchill
28             temperature ("WCT") index formula, which replaced the 1945 Siple and Passel
29             WCT formula in 2001.
30              
31             From the US National Oceanic and Atmospheric Administration ("NOAA") website:
32              
33             =over 4
34              
35             I<< The windchill temperature is how cold people and animals feel when outside.
36             Windchill is based on the rate of heat loss from exposed skin caused by wind
37             and cold. As the wind increases, it draws heat from the body, driving down skin
38             temperature and eventually the internal body temperature. Therefore, the wind
39             makes it B much colder. If the temperature is 0 degrees Fahrenheit and
40             the wind is blowing at 15 mph, the windchill is -19 degrees Fahrenheit. At this
41             windchill temperature, exposed skin can freeze in 30 minutes. >>
42              
43             I<< ... The current formula uses advances in science, technology, and computer
44             modeling to provide a more accurate, understandable, and useful formula for
45             calculating the dangers from winter winds and freezing temperatures. Wind
46             Chill Temperature Comparison (Old vs. New) Clinical trials were conducted at
47             the Defence and Civil Institute of Environmental Medicine in Toronto, Canada,
48             and the trial results were used to improve the accuracy of the new formula and
49             determine frostbite threshold values. >>
50              
51             =back
52              
53             =head2 Limitations
54              
55             =over 4
56              
57             =item
58              
59             WCT is only defined for temperatures above -50 F (-45.5 C) and below 50 F (10 C).
60              
61             =item
62              
63             WCT is only defined for wind speeds above 3 MPH (4.8 KPH) and below 110 MPH (177 KPH).
64              
65             =item
66              
67             WCT applies to living tissue at the height of five feet (152 cm), the typical
68             height of an adult human face.
69              
70             =item
71              
72             Bright sunshine may increase the windchill temperature by 10 to 18 F (5 to 10 C).
73              
74             =back
75              
76             =head1 FUNCTIONS
77              
78             Neither function provided by this module attempts to verify that either the
79             temperature or the windspeed supplied by the user are within the valid input
80             range. I.
81              
82             =head2 windchill_us( $temperature, $windspeed )
83              
84             Calculates the windchill in United States ("US") units, i.e. temperature in
85             degrees Fahrenheit and windspeed in miles per hour.
86              
87             Example:
88              
89             # what's the windchill at 10 F and 15 MPH?
90             my $chill = windchill_us( 10, 15 );
91             print "the windchill is: $chill F";
92              
93             =cut
94              
95             sub windchill_us {
96 18     18 1 10597 my ($temp, $windspeed) = @_;
97 18         74 my $pow = $windspeed ** 0.16;
98 18         225 return 35.74 + (0.6215 * $temp) - (35.75 * $pow) + (0.4275 * $temp * $pow);
99             }
100              
101             =head2 windchill_si( $temperature, $windspeed )
102              
103             Calculates the windchill in International ("SI") units, i.e. temperature in
104             degrees Celsius and windspeed in kilometers per hour.
105              
106             Example:
107              
108             # what's the windchill at -5 C and 20 KPH?
109             my $chill = windchill_si( -5, 20 );
110             print "the windchill is: $chill C";
111              
112             =cut
113              
114             sub windchill_si {
115 18     18 1 10634 my ($temp, $windspeed) = @_;
116 18         76 my $pow = $windspeed ** 0.16;
117 18         225 return 13.12 + (0.6215 * $temp) - (11.37 * $pow) + (0.3965 * $temp * $pow);
118             }
119              
120             =head1 ADDITIONAL RESOURCES
121              
122             =over 4
123              
124             =item
125              
126             L
127              
128             =item
129              
130             L
131              
132             =back
133              
134             =head1 AUTHOR
135              
136             John Trammell, C<< >>
137              
138             =head1 BUGS
139              
140             Please report any bugs or feature requests to C
141             rt.cpan.org>, or through the web interface at
142             L. I
143             will be notified, and then you'll automatically be notified of progress on your
144             bug as I make changes.
145              
146             =head1 SUPPORT
147              
148             You can find documentation for this module with the perldoc command.
149              
150             perldoc Temperature::Windchill
151              
152             You can also look for information at:
153              
154             =over 4
155              
156             =item * RT: CPAN's request tracker
157              
158             L
159              
160             =item * AnnoCPAN: Annotated CPAN documentation
161              
162             L
163              
164             =item * CPAN Ratings
165              
166             L
167              
168             =item * Search CPAN
169              
170             L
171              
172             =back
173              
174             =head1 ACKNOWLEDGEMENTS
175              
176             I would like to thank all the attendees of the Frozen Perl 2008 conference, who
177             inspired me to write this module.
178              
179             =head1 COPYRIGHT & LICENSE
180              
181             Copyright 2008 John Trammell, all rights reserved.
182              
183             This program is free software; you can redistribute it and/or modify it
184             under the same terms as Perl itself.
185              
186             =cut
187              
188             1;
189