meteolinger |
Subversion Repositories: |
Rev 1 | Rev 2 | |
---|---|---|
Line 156... | Line 156... | |
foreach $gtime (keys %gtimes) { |
foreach $gtime (keys %gtimes) { | |
$arguments = ""; |
$arguments = ""; | |
$coloridx = 0; |
$coloridx = 0; | |
$img = $wwwdir.$wname."_".$gtime.".gif"; |
$img = $wwwdir.$wname."_".$gtime.".gif"; | |
$cmd_arguments = $rrdtoolp." graph ".$img." --start -".$gtimes{$gtime}." --width 550 --height 150 --vertical-label \"".ucfirst($wname)."\" --watermark \"WeatherStats\" \\"; #jak udelat scale?? --vertical-label".$scale\" \\"; |
$cmd_arguments = $rrdtoolp." graph ".$img." --start -".$gtimes{$gtime}." --width 550 --height 150 --vertical-label \"".ucfirst($wname)."\" --watermark \"WeatherStats\" \\"; #jak udelat scale?? --vertical-label".$scale\" \\"; | |
$cmd_arguments = $rrdtoolp." graph ".$img." --start -".$gtimes{$gtime}." --width 550 --height 150 --vertical-label \"".ucfirst($wname)."\" \\"; #jak udelat scale?? --vertical-label".$scale\" \\"; | ||
|
| |
# compile the graphs arguments |
# compile the graphs arguments | |
if ($wname eq "temperature") { |
if ($wname eq "temperature") { | |
foreach $atribute (keys %hasharray) { |
foreach $atribute (keys %hasharray) { | |
if ($atribute =~ /out/) { |
if ($atribute =~ /out/) { | |
Line 286... | Line 287... | |
&create_graphs_for(\%pressure, "pressure"); |
&create_graphs_for(\%pressure, "pressure"); | |
} |
} | |
|
| |
sub print_header { |
sub print_header { | |
open (INDEX, ">$wwwdir"."index\.html.new") || die "ERROR: WeatherStats: Could not create $wwwdir index.html.new"; |
open (INDEX, ">$wwwdir"."index\.html.new") || die "ERROR: WeatherStats: Could not create $wwwdir index.html.new"; | |
print INDEX "<html>\n<head><title>Weather statistic from TOPCOM 265 NE</title> |
print INDEX "<html>\n<head><title>Weather statistic from WATSON W-8681</title> | |
<link rel=\"StyleSheet\" href=\"styles.css\" type=\"text/css\" media=\"screen\"> |
<link rel=\"StyleSheet\" href=\"styles.css\" type=\"text/css\" media=\"screen\"> | |
</head>\n<body>\n"; |
</head>\n<body>\n"; | |
print INDEX "<a href=p3211521.jpg><img src=p3211521_detail.jpg alt=\"WATSON W-8681\" title=\"WATSON W-8681\" align=\"right\" /></a>\n"; | ||
print INDEX "<h1>Weather statistic</h1>\n"; |
print INDEX "<h1>Weather statistic</h1>\n"; | |
$date = `date`; |
$date = `date`; | |
print INDEX "<p>Generated: ".$date."</p>\n"; |
print INDEX "<p>Generated: ".$date."</p>\n"; | |
print INDEX "<p>Station altitude: <span class=\"wvalue\">".$altitude."</span><span class=\"wscale\">mnm</span></p>\n"; |
print INDEX "<p>Station altitude: <span class=\"wvalue\">".$altitude."</span><span class=\"wscale\">mnm</span></p>\n"; | |
} |
} | |
Line 395... | Line 397... | |
|
| |
################# |
################# | |
##### MAIN ###### |
##### MAIN ###### | |
################# |
################# | |
|
| |
@wwsr = `./wwsr -y`; |
@wwsr = `/usr/local/bin/wwsr -y`; | |
#@wwsr = `cat wwsr6.out`; |
#@wwsr = `cat wwsr6.out`; | |
#@wwsr = `tail -14 /var/www/html/wwss/log`; |
#@wwsr = `tail -14 /var/www/html/wwss/log`; | |
|
| |
$wwwdir = "/var/www/html/wwss/"; |
$wwwdir = "/home/www/html/wwss/"; | |
#$wwwdir = "wwss/"; |
#$wwwdir = "wwss/"; | |
$en_dbg = 0; |
$en_dbg = 0; | |
$rrdtoolp = "/usr/bin/rrdtool"; |
$rrdtoolp = "/usr/bin/rrdtool"; | |
$rrdbp = "/var/www/html/wwss/"; |
$rrdbp = "/opt/meteolinger/rrd/"; | |
#$rrdbp = "wwss/"; |
#$rrdbp = "wwss/"; | |
|
| |
$graphs = 0; |
$graphs = 0; | |
|
| |
# What options are defined on command line? |
# What options are defined on command line? | |
Line 478... | Line 480... | |
# &print_body($rrdbn,$value,$aline[0],$scale); |
# &print_body($rrdbn,$value,$aline[0],$scale); | |
} |
} | |
}; |
}; | |
|
| |
# additional calculate values |
# additional calculate values | |
$rrdbnt = "temperature_feel-out"; |
$rrdbnt = "temperature_feelout"; | |
$wname = "Feels like temperature"; |
$wname = "Feels like temperature"; | |
$value = ${$wind{'speed'}}[1]; |
$value = ${$wind{'speed'}}[1]; | |
$tout = ${$temperature{'outdoor'}}[1]; |
$tout = ${$temperature{'outdoor'}}[1]; | |
# windchill calculation is only valid for wind speed > 4.5km/h ~ 1.25m/s and $tout < 10C |
# windchill calculation is only valid for wind speed > 4.5km/h ~ 1.25m/s and $tout < 10C | |
if ($value > 1.25 and $tout < 10) { |
if ($value > 1.25 and $tout < 10) { | |
Line 494... | Line 496... | |
} else { |
} else { | |
$twc = $tout; |
$twc = $tout; | |
} |
} | |
&insertdb($rrdbnt,$twc,"C",$wname); |
&insertdb($rrdbnt,$twc,"C",$wname); | |
|
| |
$rrdbnt = "pressure_air-sea"; |
$rrdbnt = "pressure_airsea"; | |
$wname = "Air pressure sea"; |
$wname = "Air pressure sea"; | |
$value = ${$pressure{'air'}}[1]; |
$value = ${$pressure{'air'}}[1]; | |
$scale = ${$pressure{'air'}}[2]; |
$scale = ${$pressure{'air'}}[2]; | |
# aaMADIS calculation |
# aaMADIS calculation | |
$k1 = 0.190284; # discrepency with calculated k1 probably because Smithsonian used less precise gas constant and gravity values |
$k1 = 0.190284; # discrepency with calculated k1 probably because Smithsonian used less precise gas constant and gravity values | |
$k2 = 8.4184960528E-5; # (standardLapseRate / standardTempK) * (Power(standardSLP, k1) |
$k2 = 8.4184960528E-5; # (standardLapseRate / standardTempK) * (Power(standardSLP, k1) | |
$aps = ((($value-0.3)**$k1)+($k2*$altitude))**(1/$k1); # Power(Power(pressureHPa - 0.3, k1) + (k2 * elevationM), 1/k1); |
$aps = ((($value-0.3)**$k1)+($k2*$altitude))**(1/$k1); # Power(Power(pressureHPa - 0.3, k1) + (k2 * elevationM), 1/k1); | |
&insertdb($rrdbnt,$aps,$scale,$wname); |
&insertdb($rrdbnt,$aps,$scale,$wname); | |
|
| |
$rrdbnt = "temperature_dew-out"; |
$rrdbnt = "temperature_dewout"; | |
$wname = "Due point temperature"; |
$wname = "Due point temperature"; | |
$value = ${$humidity{'outdoor'}}[1]; |
$value = ${$humidity{'outdoor'}}[1]; | |
$tdp = $tout-((100-$value)/5); # aproximation |
$tdp = $tout-((100-$value)/5); # aproximation | |
&insertdb($rrdbnt,$tdp,"C",$wname); |
&insertdb($rrdbnt,$tdp,"C",$wname); | |
|
|