Login to AccuWeather.com Premium Login to AccuWeather.com Professional Login to AccuWeather.com RadarPlus AccuWeather.com

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Display Fahrenheit and Celsius from Weather Mon II
bill.steiner
post Jan 18 2009, 05:45 AM
Post #1




Rank: Whirlwind
*

Group: Member
Posts: 5
Joined: 17-January 09
Member No.: 16,951





I have a Davis Weather Monitor II that uses WeatherLink 5.8.2 to send data to a web page I set up to view the weather at my home in Brazil. I am not a knowledgeable builder of web pages or programmer so I am using the web design that was included with the WeatherLink software. I have friends in both North and South America that view the page and I would like to make it easy for them to monitor the information.
What I would like to do is display temperature readings in Fahrenheit and Celsius, Barometer in Inches of Hg (in) and Millimeters of Hg (mm), Wind Speed in Miles per Hour (mph) and Kilometers per Hour (km/hr), Rain in Inches (in) and Millimeters (mm).
Can someone point me to a “simple” program that I can use to accomplish what I would like to do?
Thanks in advance.
Go to the top of the page
 
+Quote Post
dalecoy
post Jan 20 2009, 04:04 PM
Post #2




Rank: Tornado
**

Group: Founding Member
Posts: 125
Joined: 20-March 06
From: Lee's Summit, MO
Member No.: 1,672





QUOTE(bill.steiner @ Jan 18 2009, 07:45 AM) *
I have a Davis Weather Monitor II that uses WeatherLink 5.8.2 to send data to a web page I set up to view the weather at my home in Brazil. I am not a knowledgeable builder of web pages or programmer so I am using the web design that was included with the WeatherLink software. I have friends in both North and South America that view the page and I would like to make it easy for them to monitor the information.
What I would like to do is display temperature readings in Fahrenheit and Celsius, Barometer in Inches of Hg (in) and Millimeters of Hg (mm), Wind Speed in Miles per Hour (mph) and Kilometers per Hour (km/hr), Rain in Inches (in) and Millimeters (mm).
Can someone point me to a “simple” program that I can use to accomplish what I would like to do?
Thanks in advance.


You asked that a couple of days ago, and haven't received a response yet. I didn't want you to think you are being ignored.

It's just that, as far as I know, there is no SIMPLE way to automatically do what you want to do.

You get the data from the WM in one set of units, and that's passed along by the posting software. Adding a different set of units would require additional programming.

It is POSSIBLE that there is other weather software out there (other than WeatherLink) that has the required capability, but I'm not aware of it.
Go to the top of the page
 
+Quote Post
lfinsr
post Jan 20 2009, 07:57 PM
Post #3




Rank: Whirlwind
*

Group: Founding Member
Posts: 14
Joined: 25-March 05
Member No.: 808





It only takes about 5 lines of javascript for each conversion to do this. I understand that you're looking for a "simple" way to do this, but Weatherlink does not have that ability. Without seeing the template you're using to generate the webpage it's impossible to give you any more advice but it's not very hard. If you post the address of your site someone can probably help.

I already have the code written that you need and am using it on my site. Feel free to steal it.

Larry

http://www.roanokewx.com
Go to the top of the page
 
+Quote Post
bill.steiner
post Jan 21 2009, 05:05 AM
Post #4




Rank: Whirlwind
*

Group: Member
Posts: 5
Joined: 17-January 09
Member No.: 16,951





Here is the link, and thanks for the reply.

http://home.roadrunner.com/~bsdaiwa/Current_Monitor.htm
Go to the top of the page
 
+Quote Post
dalecoy
post Jan 21 2009, 11:34 AM
Post #5




Rank: Tornado
**

Group: Founding Member
Posts: 125
Joined: 20-March 06
From: Lee's Summit, MO
Member No.: 1,672





QUOTE(lfinsr @ Jan 20 2009, 09:57 PM) *
It only takes about 5 lines of javascript for each conversion to do this.
..........

If you post the address of your site someone can probably help.


Agreed that it only takes a few lines of code for each conversion.

I predict that:
A. It won't be easy for someone to help Bill. In particular, because of the way WeatherLink does things.
B. After that, it won't be easy for Bill to maintain (or modify) the result.

However, I don't want to discourage Bill, nor to discourage anybody from helping. It's just not really simple.
Go to the top of the page
 
+Quote Post
lfinsr
post Jan 21 2009, 03:38 PM
Post #6




Rank: Whirlwind
*

Group: Founding Member
Posts: 14
Joined: 25-March 05
Member No.: 808





QUOTE(dalecoy @ Jan 21 2009, 11:34 AM) *
Agreed that it only takes a few lines of code for each conversion.

I predict that:
A. It won't be easy for someone to help Bill. In particular, because of the way WeatherLink does things.
B. After that, it won't be easy for Bill to maintain (or modify) the result.

However, I don't want to discourage Bill, nor to discourage anybody from helping. It's just not really simple.


You may be right but I'm gullible. I'll spend a little time trying to help. I don't have time to write code for others though, I struggle to keep mine up-to-date.

Larry
Go to the top of the page
 
+Quote Post
lfinsr
post Jan 21 2009, 07:34 PM
Post #7




Rank: Whirlwind
*

Group: Founding Member
Posts: 14
Joined: 25-March 05
Member No.: 808





This is going to be long... I'm not sure if the bulletin board is going to munge any of the code I post so it may take a couple of tries. You're probably going to need to look at a working example to see how it all fits together.

Disclaimer:
I am not a programmer.
I am not a webmaster.
I am not responsible for your mistakes.
I am not a writer but hopefully this will be close enough to understand.

Some prerequisites:
Firefox has a plugin called "Web Developer". I highly recommend using it.
Internet Explorer 8 Beta 2 also has a similar tool though I've not used it much.
Either will be of value down the road.

Also of value, more so than the previous 2 is a text editor that has syntax highlighting. It is invaluable for finding mistakes such as a missing parentheses or tag. A good recommendation is Crimson Editor. It s free and can be found at http://sourceforge.net/projects/emeraldeditor/

An understanding of the way Weatherlink (WL) works is a must. It uses a template that ends with a .htx. Each time it spits out a web page, it opens the template, parses thru it and when it encounters a tag it recognizes, it replaces it with a value from the weather station and writes the same file except with a .htm extension with the inserted values. I would advise working on one of the htm files and when you get everything correct you can then edit your template.

To the meat of things...
I'll help you with the conversion of the temperature. It will be up to you to take it any further and convert other values. Any conversion will work exactly the same. To convert a temp value you will need to create a javascript function. All javascript must be enclosed in a <script> tag and closed properly. You can place this function in the body of your page. To start off with you'll need to retrieve the current temperature from the station and assign it to a variable. You can do this by placing a WL tag within the script tags. It won't be seen by the browser when hiding there. The name is not important as long as it is unique. Below is a sample...

CODE
<script type="text/javascript">
var Temp = <!--outsideTemp-->
//convert Fahrenheit to Celcius
function FtoC(intF){
intCel = (intF - 32) * (5/9)
return (intCel)
}
</script>


We'll go thru this line by line.
-Opening tag.
-Creates a variable called Temp and WL replaces the tag with the current value.
-Comment - does nothing except remind me what it does.
-Creates the function and gives it a name.
-Performs the math to convert the value and assigns to the variable "intCel".
-Returns that value to the code that asked for it. In our case it will be "document.write".
-Closing tag.

Probably a good time to let you know that javascript is case sensitive. Temp does not equal temp.

So you've got the temperature assigned to the vavariable, all you need to do now it ask the function for the converted value. You do that using "document.write". On my site I prefer to round the temp as no one really cares if it's 50 or 50.2. It up to you if you want to do that at the same time or not. It would probably be simpler if you stuck with just the conversion.

The code to retrieve the converted value would be:
document.write(FtoC(Temp))
This must also be enclosed in a <script> tag, the same as the function above.

The above will only write the converted value. You'll want both values displayed on the same line. To do that the following is needed:
document.write(Temp + " / " + (FtoC(Temp)))
That will write the variable "Temp" then a / with spaces on either side and the "Temp" value converted to Celcius. Note that using document.write, if javascript "knows" the value of something such as a declared variable, no quotes are necessary. They are needed to insert the / as that is used for division. If you didn't have the + and the quoted / you would be dividing the "Temp" value by the converted "Temp" value.

If you wanted to round those values you could add "Math.round" to the mix. &deg; will print the degree symbol if you desire.

There you have it. Much harder to explain that to actually do but... this doesn't even begin to cover everything might encounter. For example, what is going to happen to the table when you add the second value? Will it wrap or just make the table wider? A little patience is all you need. Once in place there is no maintenance, it just works.

The line you'll be editing is 51 on my Current_Monitor template but it may differ on yours. I encourage you to look at a working page that does exactly what you're trying to do. The samples/code above are taken directly from my web page. If you're looking at the source code on my web pages, please don't fall out of your chair laughing. Another valuable resource is www.w3schools.com.

Good luck.
Larry
http://www.roanokewx.com

This post has been edited by lfinsr: Jan 21 2009, 07:54 PM
Go to the top of the page
 
+Quote Post
bill.steiner
post Jan 22 2009, 07:49 AM
Post #8




Rank: Whirlwind
*

Group: Member
Posts: 5
Joined: 17-January 09
Member No.: 16,951





lfinsr, thank you very much, I will work on this over the weekend and let you know how I do. Don't worry, I backup before I tinker, so I can always go back. I really appreciate people like yourself who give us less learned guidance.
Go to the top of the page
 
+Quote Post
dalecoy
post Feb 1 2009, 11:33 PM
Post #9




Rank: Tornado
**

Group: Founding Member
Posts: 125
Joined: 20-March 06
From: Lee's Summit, MO
Member No.: 1,672





Extremely comprehensive writeup, Larry. It will be useful to me in the future.

Dale
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version Time is now: 21st April 2014 - 09:39 AM