Author Topic: Parse WD climatedatayearout.html  (Read 3977 times)

0 Members and 1 Guest are viewing this topic.

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Senior Contributor
  • ****
  • Posts: 193
  • Davis Vantage Pro2+ with full FARS
Parse WD climatedatayearout.html
« on: December 10, 2007, 11:35:17 PM »
A code snippet that parses the Weather-Display climatedatayearout.html file that is uploaded by WD to your webserver. The purpose of the script is to obtain the values from the html file so that you could use it in a graph, chart, whatever...

This is not a complete script in that it only gets the data, you have to know what to do with the data...

The following page has a sample output of what you could do with the data and includes the source code:

TNET Weather - Parse WD climatedatayearout.html Script

The script includes a method of extracting the data for download via CSV format.
All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 255
    • Branford Weather
Re: Parse WD climatedatayearout.html
« Reply #1 on: December 11, 2007, 06:17:07 PM »
Kevin,

Is the climatedatayearout snipet missing any code by chance? The txt file you posted seems to be missing code at the end.

Thanks for sharing these two files.

Jack

Offline carterlake

  • Senior Contributor
  • ****
  • Posts: 243
    • CarterLake.org
Re: Parse WD climatedatayearout.html
« Reply #2 on: December 11, 2007, 06:45:15 PM »
I didn't even know I had that file!  :oops:

Davis VP2 6153; Weather Display (LIVE w/ Ajax); Quickcam for Notebooks Pro; Boltek w/ Nexstorm; GRLevel3; live NOAA Radio

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Senior Contributor
  • ****
  • Posts: 193
  • Davis Vantage Pro2+ with full FARS
Re: Parse WD climatedatayearout.html
« Reply #3 on: December 11, 2007, 08:27:34 PM »
Kevin,

Is the climatedatayearout snipet missing any code by chance? The txt file you posted seems to be missing code at the end.

Thanks for sharing these two files.

Jack

Not that I'm aware of....  The script you see is what is being called by the Index.php file in that same directory that provides the info about the script.  What is not in the script is the CSS that is being used by it though...

You can run the code directly with the URL:

http://www.tnetweather.com/scripts/climate1/script.php

It will just output a plain table of the data. 

The formatting that I applied to it in the index page is below:

Code: [Select]
<style type="text/css" >
#sampscript {
font-family: 'Courier New', monospace;
font-size: 80%;
}

#sampscript table {
width: 99%;
font-color: #008000;
border: 1px solid #22464F;
border-right: 4px solid #22464F;
border-bottom: 4px solid #22464F;
border-collapse: collapse;
padding: 2px;
}

#sampscript th, td {
font-color: #008000;
font-size: 100%;
border: 1px solid #22464F;
background-color: white;
text-align:center;
}

#sampscript th {
font-size: 80%;
background-color: #CDDBCD;
}

#sampscript pre {
font-size: 80%;
color: black;
}

</style>

I just added a comment line and a closing ?> to the end of the file to show where it ends though.
All you need is Time, Aptitude and Desire ... and you can build just about anything...

Offline BfdWx

  • WxElement panel
  • Senior Contributor
  • *****
  • Posts: 255
    • Branford Weather
Re: Parse WD climatedatayearout.html
« Reply #4 on: December 11, 2007, 08:39:12 PM »
Kevin,

OK,  I'll try to see what I did wrong. I have the climatedataout script working but the climatedatayear script stops after "Show data as a table"

Jack

Offline TNETWeather

  • Kevin Reed (KrelvinAZ)
  • Senior Contributor
  • ****
  • Posts: 193
  • Davis Vantage Pro2+ with full FARS
Re: Parse WD climatedatayearout.html
« Reply #5 on: December 11, 2007, 08:49:34 PM »
Other than making sure the file is where you are looking for it, you might need to look at your error logs.

All you need is Time, Aptitude and Desire ... and you can build just about anything...