WXforum.net
May 19, 2013, 02:25:44 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
Members: 6609  •  Posts: 178223  •  Topics: 18100
Please welcome TargY, our newest member.
Welcome to the the new hosting for WXforum.net.
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Farenheit & Celcius  (Read 2928 times)
0 Members and 1 Guest are viewing this topic.
N2KI
Member
*
Offline Offline

Posts: 8



« on: January 31, 2009, 07:05:32 PM »

Is it possible to display both the Fahrenheit reading along with the Celsius reading?  I could not find a custom tag.

Thanks

Tony - N2KI
Logged
Curly
Forecaster
*****
Offline Offline

Posts: 476


WWW
« Reply #1 on: January 31, 2009, 07:36:42 PM »

Not generaly. What software do you use?
Logged
SLOweather
Administrator
Forecaster
*****
Offline Offline

Posts: 2342



WWW
« Reply #2 on: January 31, 2009, 07:51:09 PM »

Not generaly. What software do you use?

This is in the VWS area...
Logged
N2KI
Member
*
Offline Offline

Posts: 8



« Reply #3 on: January 31, 2009, 08:50:08 PM »

Yes I am using VWS.

Tony
Logged
WeatherBeacon
Chief
Forecaster
*****
Offline Offline

Posts: 1353



WWW
« Reply #4 on: January 31, 2009, 09:30:43 PM »

It should be easy with Javascript ... for someone who knows Javascript.

Okay, I don't know Javascript, but try putting this in your htx template file. Someone who knows Javascript should step in to fix this if it's wrong, please. This will convert Fahrenheit to Celsius (if it works). If it doesn't work, simply remove it.

Code:
<script language="JavaScript">
<!--
   var celsius=0.5555556*(^vxv007^-32);
   document.write(celsius.toFixed(1) + '^uni007^');
-->
</script>

This will convert Celsius to Fahrenheit (if it works):

Code:
<script language="JavaScript">
<!--
   var fahren=1.8*(^vxv007^)+32;
   document.write(fahren.toFixed(1) + '^uni007^');
-->
</script>

Regards,

Kevin...


EDIT:  Oops! I might have jumped the gun in a BIG way! For some dumb reason I assumed you were talking about displaying temp in F and C on a web page. So if the question is, "Can you display temp in both F and C in VWS itself?", then as Curly said, probably not.
« Last Edit: January 31, 2009, 10:26:29 PM by WeatherBeacon » Logged

Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3
Curly
Forecaster
*****
Offline Offline

Posts: 476


WWW
« Reply #5 on: January 31, 2009, 10:05:24 PM »

I'll rephrase it for you SLO

Since we know you use VWS Tony, do you use any other programs or software to display your weather information?
Javascript, ajax or php can be helpfull if we knew your limitation.
Logged
Carson Weather
Senior Member
**
Offline Offline

Posts: 98



WWW
« Reply #6 on: January 31, 2009, 10:37:54 PM »

For php websites, rounded to one decimal place:

<?=round(($vxv007-32)*5/9,1);?>&deg;C


***edit- fixed typo. Good eye, WB  d'oh!
« Last Edit: February 01, 2009, 08:35:13 AM by Carson Weather » Logged

WeatherBeacon
Chief
Forecaster
*****
Offline Offline

Posts: 1353



WWW
« Reply #7 on: January 31, 2009, 10:41:10 PM »



For php websites, rounded to one decimal place:

<?=round(($vxv007-32)*5/9,1);?>&degC

Hey, that's slick, Carson! Short and sweet!

Question: should it be &deg;C with a semicolon?

Kevin...
Logged

Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3
N2KI
Member
*
Offline Offline

Posts: 8



« Reply #8 on: February 01, 2009, 06:50:38 AM »

Sorry for the confusion.  Let me explain a bit clearer.

Currently I am only using VWS to display the weather information and using VWS to create the web page.

My aim here is to display the Celsius equivalent next to the displayed Fahrenheit temperatures that VWS is picking up from the machine and displaying on the web page.

I do not know anything about php(?) and am not currently using javascript.

Any help in those departments is greatly appreciated.

Tony - N2KI
Logged
N2KI
Member
*
Offline Offline

Posts: 8



« Reply #9 on: February 01, 2009, 07:53:44 AM »

I tried the Java script and that works. Thank you for the help.  I'm not very savvy in that department.  Thanks again.

Tony
Logged
WeatherBeacon
Chief
Forecaster
*****
Offline Offline

Posts: 1353



WWW
« Reply #10 on: February 01, 2009, 01:55:42 PM »

I tried the Java script and that works. Thank you for the help.  I'm not very savvy in that department.  Thanks again.

Tony

Glad to hear it! And you're very welcome!

Have fun!

Kevin...
Logged

Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3
N2KI
Member
*
Offline Offline

Posts: 8



« Reply #11 on: February 01, 2009, 05:15:43 PM »

Kevin,

Can you point me to a link that has sample java script stuff that I can use on the weather web page?  Thank you.

Tony
Logged
weather
Member
*
Offline Offline

Posts: 21



WWW
« Reply #12 on: May 15, 2009, 02:49:56 PM »

Hi all,

Just for the info :

var celsius=0.5555556*(^vxv007^-32);

Is NOT correct and gives an erroneous reading.

var celsius=(5/9)*(^vxv007^-32);

Is way more precise.

If you take a calculator => 5/9=0,55555555555555555555555555555556  NOT 0.5555556

By experience, I can tell that not using 5/9 returns an 0.5°C difference in the 15°C range, that's a lot... Wink

Hope it helps.

.
Logged


.................................... Updated each 30 minutes. ....................................
WeatherBeacon
Chief
Forecaster
*****
Offline Offline

Posts: 1353



WWW
« Reply #13 on: May 15, 2009, 09:46:44 PM »


Hi all,

Just for the info :

var celsius=0.5555556*(^vxv007^-32);

Is NOT correct and gives an erroneous reading.

var celsius=(5/9)*(^vxv007^-32);

Is way more precise.

If you take a calculator => 5/9=0,55555555555555555555555555555556  NOT 0.5555556

I understand that (math prof here Very Happy).


By experience, I can tell that not using 5/9 returns an 0.5°C difference in the 15°C range, that's a lot... Wink

I'd like to know why that might be if anyone knows. Using a factor of 0.5555556 instead of 5/9 will produce an error of 0.000008% regardless of the temp in Fahrenheit. That's only 8-millionths of one percent. For example:

      (5/9)*(59-32)  =  15oC  exactly

while

      0.5555556*(59-32)  =  15.0000012oC

which gives only a 0.000008% error. So why would you get an error of 0.5oC?
Logged

Mae govannen!
Kevin  (Member AMS) http://www.wxbeacon.com               Genesee County, Michigan
Hardware:  Davis Vantage Pro Wireless, Midland WR-300
Software: VWS 14.01p43, WeatherFlash, & GRLevel3
mackbig
Forecaster
*****
Offline Offline

Posts: 4072



WWW
« Reply #14 on: May 15, 2009, 10:47:30 PM »

I think he might be confusing 0.5555556 with a script that used .57

That script would casue a 0.39C conversion error at 15C

Andrew
Logged


Andrew - Davis VP2+ 6163, serial weatherlink, wireless anemometer, running Weather Display.  Boltek PCI Stormtracker, Astrogenic Nexstorm, Strikestar - UNI, CWOP CW8618, GrLevel3, (Station 2 OS WMR968, VWS 13.01p09), Windows 7-64
weather
Member
*
Offline Offline

Posts: 21



WWW
« Reply #15 on: May 18, 2009, 01:09:46 AM »

My appologies guys, you are correct. Embarassed

I was confusing with the script of an other Guru @ Saratoga-weather.org
who wrote in his great ajax "ajaxVWSwxf.js" script :

http://saratoga-weather.org/AJAX/VWS/ajaxVWSwxf.js

Quote
// utility functions to handle conversions from clientraw data to desired units-of-measure
function convertTemp ( rawtemp ) {
   var retval = 0;
   if (uomTempCnvt == 0) { // leave in F
      retval = rawtemp * 1.0 ;
   } else {  // convert to C
      retval = (rawtemp - 32) * 0.57;
   }
   return(retval.toFixed(1));
}
It took me hours before finding this definite mistake. I kindly did advise him
thru his mail form on his site and he did not find it necessary to respond.

I also like the :  retval = rawtemp * 1.0 ;   Wink

This is why I am getting carefull now. Besides that his script is really great.

Sorry again.
« Last Edit: May 18, 2009, 01:13:50 AM by weather » Logged


.................................... Updated each 30 minutes. ....................................
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.132 seconds with 20 queries.