Standalone Weather Graphs - LamiaWeather.com

Good evening people,

well I have decided to release my very first weather script. For too many years I was depending on others to do those neat weather graphs, using data from WU station or local files. I was in the process of updating my website last December, so I was looking around for stand-alone versions to display weather graphs but I couldn’t come up with a solution.

Since I was running my very own custom template, I didn’t mean to rip someone’s else work off, so I spent a good amount of time to enhance my javascript skills and here is the result.

You can see a live demo, so I don’t have to fill this thread with large screenshots here, just choose the graphs option from the navigation menu.

The script is located on GitHub, and it comes with a wiki page, which i recommend to read before use it.

The .csv files are auto-uploaded using a very old version of FL FTP client, which was free back then.I am not quite sure if it is against the forum rules to post a link to that file, the moderators should let me know, because I have it on my dropbox. In any case, it’s up to you to figure out how to get those .csv files on your server.

Some general guidelines

Like I said before, this is a standalone version. You can use it with any of the already existing templates or with your custom built website. Refer to the wiki page for the details about setting it up.
Do not forget to setup your WD to create the appropriate files.

I will update this script from time to time and I will try to help you out guys with any problems that you come across, but be patient :slight_smile:

Things to be done

First of all the rain chart is missing. I am working on some ideas about it, I have it taken off my personal website as well because of that. Don’t worry, it is coming within April.
Secondly I need to make the config universal rather than for every individual page. I am sorry about that, but I had this probably stupid idea that each graph should be configured individually.
And thirdly, just shoot ideas and I will let you know if it can be done.

The project is completely open sourced, feel free to play with it as much as you wish. Criticism, ideas, suggestions are all much appreciated. Many thanks to the guy who created that php month selector.

Hi
looks great :slight_smile:
what WD data are you using for the graphs?

Thanks for posting this :smiley: Very interesting.

Brian: WD CSV Logfiles option acc. to the wiki.

that will be a big file to upload…how often is that uploaded?

The files are autouploaded when the FTP thing detects a file changed in the logfiles folder.
That means that the 10 mins file is uploaded per 10 minutes and the 1 minute file, per minute.

By the way I have noticed a weird behavior with WD. It doesn’t save the selection of the 10/30 minutes csv file each time the program shuts down. You have to re-set it every time you start it.
I am glad you liked the script :slight_smile:

Also let me know if I am allowed to post that link to the old version of the FTP program I am using to upload those files.

I have tested that csv logfile setting and that is being remembered OK here with the latest version
which version of WD?
also you could use the general FTP in WD to upload those csv logfiles

have you thought about using mysql instead on the server?

Well mysql was not an option for me since the server is a very very old machine and I don’t want to push it too much.
As far as it concerns the script, it can be adjusted if there is demand, yet I don’t believe that the csv files are that big to be uploaded on a frequent basis. I mean the biggest possible file is ~3MB size, it is not big actually, unless of course the internet connection is very slow or there is a cap bandwidth problem. Plus the 3MB filesize will occur during the last days of the month.

Regarding the option not being saved, machine is running the 10.37R build, it is quite possible that it is a machine problem rather than the software :wink:

which version/build of WD are you using?

Very nice!

If I could recommend one thing, I would use ajax to refresh the graph, so that you don’t need to refresh and reload the whole page when switching for example from temperature to humidity. But good job!

Here you go Brian.

Noted, definitely something to look into for future versions :wink:

Hi
that is a relatively old version
you should be OK to use the latest version :wink:

Upgrade it, problem fixed :wink:

v 1.1 uploaded on GitHub.

Changes:

  • Added the rain graph. Dual axis chart with both daily and monthly precipitation data points.
  • Temperature graph is re-designed. Added temperature band zones on the y-axis and the plot line color changes, based on which temperature band it belongs to.

Check the live demo page for better results.

version 1.3

  • Solar graph added
  • Bugs fixed

Github wiki page was re-written, hopefully the new instructions are better.

Refer to post #1 , for download link and live demo.

Looks great! I’ve tested and works like a charm!

Just one question. How can I create .csv files for previous months/years?

Thanos

Thanks!

You can do it manually, importing the xxxlg.txt files into excel and save them as .csv. I don’t know if WD has any build-in feature to do that, maybe Brian can assist.

I haven’t looked at the whole script, and I’m no js expert, but since you are using

var items = line.split(',');

to parse the lines, would it work with standard logfiles if that is changed to something like

var items = line.split(/ +/); ?

I’ve noticed that, when I place the mouse cursor over a data point of a graph, the time that appears in the info box, is three hours behind the one that was created! It has probably something to do with the time zone or so.

As of the manual creation of .csv files for the past months/years, most of the main log files have different column format compared to those produced
by WD. Is there(or will be), a way to export .csv files directly from WD? Brian? :roll:

Anyway, I’ll try to do the conversion from excel.

Here’s my test page: http://www.meteothes.gr/weathergraphs/graph.php

Thanos

I’ve got an answer in my mind regarding standard logfiles, but I want to try it first. I believe the code to be used, should be more like

var items = line.split(' ');

but I need to check if parsing .txt files doesn’t add the comma separator. Your code accepts any character as separator, I am not so sure that it will work (I am not a JS expert in no way, so I might be talking crap).

Check the new build on Github, I’ve changed the UTC thing so Time should be localized again. Thanks for pointing this out, I’ve completely forgotten about it. Seems to be working properly on my page :wink:

That will split on a single space, but you may find that WD’s logfiles have multiple spaces between some values which will upset the parsing. That’s why I suggested splitting with that regex code that should correctly handle any number of spaces.