Changeset 9

Show
Ignore:
Timestamp:
02/18/09 17:36:59 (3 years ago)
Author:
apribyl
Message:

fix the windchill calculation (thanks to Magnus Nyberg), add printing of altitude

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • weatherstats/weatherstats

    r6 r9  
    99# WeatherStats 
    1010# 
    11 # version:      0.5 
     11# version:      0.6 
    1212# 
    1313# author:       Adam Pribyl, covex@lowlevel.cz 
     
    193193                                if ($atribute eq "direction") { 
    194194                                        $scale = ${$hasharray{$atribute}}[2]; 
    195                                         $arguments = $arguments."DEF:".$atribute."=".$rrdbp.$wname."_".$atribute.".rrd:".$atribute.":MAX "; 
     195                                        if ($gtime = "24h") { 
     196                                                $arguments = $arguments."DEF:".$atribute."=".$rrdbp.$wname."_".$atribute.".rrd:".$atribute.":AVERAGE "; 
     197                                        } else { 
     198                                                $arguments = $arguments."DEF:".$atribute."=".$rrdbp.$wname."_".$atribute.".rrd:".$atribute.":MAX "; 
     199                                        } 
    196200                                        $arguments = $arguments."CDEF:North=".$atribute.",0,GE,-4,* "; 
    197201                                        $arguments = $arguments."CDEF:NNE=".$atribute.",1,GE,-4,* "; 
     
    291295        $date = `date`; 
    292296        print INDEX "<p>Generated: ".$date."</p>\n"; 
     297        print INDEX "<p>Station altitude: <span class=\"wvalue\">".$altitude."</span><span class=\"wscale\">mnm</span></p>\n"; 
    293298} 
    294299 
     
    480485$value = ${$wind{'speed'}}[1]; 
    481486$tout = ${$temperature{'outdoor'}}[1]; 
    482 # windchill calculation is only valid for wind speed > 4.5km/h ~ 1.25m/s 
    483 if ($value > 1.25) {  
    484         $ws = $value**0.16; 
     487# windchill calculation is only valid for wind speed > 4.5km/h ~ 1.25m/s and $tout < 10C 
     488if ($value > 1.25 and $tout < 10) { 
     489        #Convert  $value=m/s  $ws=km/h 
     490        $ws=$value*3.6; 
     491        $ws = $ws**0.16; 
    485492        #Wind chill 
    486493        $twc = 13.12+(0.6215*$tout)-(11.37*($ws))+((0.3965*$tout)*($ws));