telkel / rrdweather

Automatically exported from code.google.com/p/rrdweather
0 stars 0 forks source link

Displaying correct English temperature and pressure units #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?
Graphs display "C" units for temperature and "hPa" for pressure regardless of 
setting "m" or "e" for my $system in weather.cgi.

What version of the product are you using? On what operating system?
Version 0.42 on Unbuntu linux

Please provide any additional information below.
These changes to weather.cgi display correct units for temperature and pressure 
based on "my $system" setting.

--- oldweather.cgi  2010-09-06 09:05:34.344806062 -0500
+++ weather.cgi 2010-09-06 09:24:08.901797394 -0500
@@ -81,11 +81,15 @@

 if($system eq "m") {
    $speed = 'kph';     
+   $temp = 'C';        
+   $pressure = 'hPa';  
    $pressurelowlimit = '980';  
    $pressureuplimit = '1100';
 }
 elsif($system eq "e") {
    $speed = 'mph';
+   $temp = 'F';        
+   $pressure = 'in';   
    $pressurelowlimit = '20';   
    $pressureuplimit = '40';
 }
@@ -119,15 +123,15 @@
        "DEF:felt_c=$db_felt:felt:AVERAGE",
        "DEF:dew_c=$db_dew:dew:AVERAGE",
        "COMMENT:           Min       Max       Ave       Last\\n",
-       'LINE2:real_c#DD3F4A:Real', 'GPRINT:real_c:MIN: %5.2lf C',
-       'GPRINT:real_c:MAX: %5.2lf C', 'GPRINT:real_c:AVERAGE: %5.2lf C',
-       'GPRINT:real_c:LAST: %5.2lf C\\n',
-       'LINE1:felt_c#3F4ADD:Felt', , 'GPRINT:felt_c:MIN: %5.2lf C',
-       'GPRINT:felt_c:MAX: %5.2lf C', 'GPRINT:felt_c:AVERAGE: %5.2lf C',
-       'GPRINT:felt_c:LAST: %5.2lf C\\n',  
-       'LINE1:dew_c#4ADD3F:Dew ', , 'GPRINT:dew_c:MIN: %5.2lf C',
-       'GPRINT:dew_c:MAX: %5.2lf C', 'GPRINT:dew_c:AVERAGE: %5.2lf C',
-       'GPRINT:dew_c:LAST: %5.2lf C\\n',
+       'LINE2:real_c#DD3F4A:Real', "GPRINT:real_c:MIN: %5.2lf $temp",
+       "GPRINT:real_c:MAX: %5.2lf $temp", "GPRINT:real_c:AVERAGE: %5.2lf $temp",
+       "GPRINT:real_c:LAST: %5.2lf $temp\\n",
+       'LINE1:felt_c#3F4ADD:Felt', , "GPRINT:felt_c:MIN: %5.2lf $temp",
+       "GPRINT:felt_c:MAX: %5.2lf $temp", "GPRINT:felt_c:AVERAGE: %5.2lf $temp",
+       "GPRINT:felt_c:LAST: %5.2lf $temp\\n",  
+       'LINE1:dew_c#4ADD3F:Dew ', , "GPRINT:dew_c:MIN: %5.2lf $temp",
+       "GPRINT:dew_c:MAX: %5.2lf $temp", "GPRINT:dew_c:AVERAGE: %5.2lf $temp",
+       "GPRINT:dew_c:LAST: %5.2lf $temp\\n",
        "COMMENT: \\n",
        "COMMENT:RRDWeather $VERSION - $date",
    );
@@ -224,9 +228,9 @@

            "DEF:pressure_hpa=$db_pressure:pressure:AVERAGE",
                 'COMMENT:        ', "COMMENT:        Min           Max           Last\\n",
-                'LINE1:pressure_hpa#DD3F4A:Pressure', 
'GPRINT:pressure_hpa:MIN: %5.2lf hPa',
-                'GPRINT:pressure_hpa:MAX: %5.2lf hPa', 
-                'GPRINT:pressure_hpa:LAST: %5.2lf hPa\\n',
+                'LINE1:pressure_hpa#DD3F4A:Pressure', 
"GPRINT:pressure_hpa:MIN: %5.2lf $pressure",
+                "GPRINT:pressure_hpa:MAX: %5.2lf $pressure", 
+                "GPRINT:pressure_hpa:LAST: %5.2lf $pressure\\n",
        "COMMENT: \\n",
        "COMMENT:RRDWeather $VERSION - $date",
    );

Original issue reported on code.google.com by jheid...@gmail.com on 7 Sep 2010 at 1:47