Author Topic: Historic data files in simple Php!  (Read 11708 times)

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Historic data files in simple Php!
« on: June 15, 2013, 11:53:57 AM »
Dear visitors,

Cumulus done an important improvement in beta build 1062,
Weather data historic rewind engine, from 1 minute to 7 days.

I have enough work to try to follow "Official" release, I stay usually
a certain time to develop new things instead of allways try to change.
But since I "follow the game", I'm already playing with new builds
and want to share with ohters, a new way to consider historic files.

With these files, you could have data for sweet interactive gauges
and graphs, without having to use MySQL or other complicated things.

Weather data are:
Outside Temperature
Wind Speed
Wind Gust
Wind Latest. Note: Wind 'Speed', 'Gust' and 'Latest' have the usual Cumulus meanings
Wind Direction (instantaneous)
Wind Direction (average)
Wind Chill
Dew Point
Heat Index
Relative Humidity
Sea-level Pressure
Today's rain
Solar Radiation
UV Index

Interval files to use:
data_6h.php  - 10 minutes interval: 6h total
data_12h.php  - 30 minutes interval: 12h total
data_24h.php  - 1 hour interval: 24h total
data_7d.php  - 12 hours interval: 7days total
data_all.php  - All of the above in one file

Available in the download section.
Hope you'll have a lot of fun with it!  :D

Best Regards,
Jacques
« Last Edit: June 16, 2013, 06:00:50 AM by Mr.Meteo »
Please, consider supporting this site 

Offline uncle_bob

  • Full Member
  • ***
  • Posts: 61
    • Conder Weather, Canberra
Re: Historic data files in simple Php!
« Reply #1 on: June 15, 2013, 06:03:57 PM »
Hi Jacques,
Do you have this running on a demo page? I just wanted to take a look at it in action before screwing around with it  :)

Offline joew

  • Jr. Member
  • **
  • Posts: 36
    • TigerDenWX
Re: Historic data files in simple Php!
« Reply #2 on: June 17, 2013, 02:52:26 PM »
Hi Jacques,

Well, I thought I would take the leap  :) and give this a shot. However, when I tried to work with it I ran into a few problems, one of which I need a little assistance with.  ;)

First off I decided I would work with the file "data_allT.php".  After putting it in the web folder and adding it to the files to be processed and up loaded to my web server as "data_all.php" and trying to access it using
 http://www.tigerdenweb.com/tigerdenwx/data_all.php I received the following error message:
Quote
Parse error: syntax error, unexpected ';', expecting ')' in /homepages/44/d463897987/htdocs/TigerDenWX_WB_V2/data_all.php on line 71

I determined that this was a missing ')' at the end of line 71. After I added that when I went to have the file re-executed I then got the following error message:
Quote
Parse error: syntax error, unexpected ';', expecting ')' in /homepages/44/d463897987/htdocs/TigerDenWX_WB_V2/data_all.php on line 100
  Again a missing ')'

The next two errors were:
Quote
Parse error: syntax error, unexpected ')' in /homepages/44/d463897987/htdocs/TigerDenWX_WB_V2/data_all.php on line 104
Parse error: syntax error, unexpected ')' in /homepages/44/d463897987/htdocs/TigerDenWX_WB_V2/data_all.php on line 133
These two errors I determined were an extra ')' at the end of lines 104 and 133 which I removed.

This brings me to the current error message that I'm receiving for which I'm looking for your guidence with:
Quote
Fatal error: Call to undefined function str2num() in /homepages/44/d463897987/htdocs/TigerDenWX_WB_V2/data_all.php on line 15

I'm sure that what is being sought here is the function "str2num()" to be defined. I thought that this function would have been defined already.

I then using "empty.php" template calling it "dataAll.php" reachable by http://www.tigerdenweb.com/tigerdenwx/dataAll.php as a starting point included the file "data_all.php, but received the same error message.

My question is since it doesn't appear to be a builtin function for PHP and hasn't been defined anywhere within "WB V2", do you have any ideas to where I could get the function that you expect in "data_allT.php" or is there something else I'm missing here?

Thanks,

Joe

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Historic data files in simple Php!
« Reply #3 on: June 17, 2013, 06:21:19 PM »
Hi Joe,

You have probably be in the first few to have downloaded a bad version!
I've mixed files in first archive, so this version never supposed to exist.

Then, simply download again, file have 2013-06-16 date stamp.
Sorry for this one! :-[

Regards,
Jacques
Please, consider supporting this site 

Offline joew

  • Jr. Member
  • **
  • Posts: 36
    • TigerDenWX
Re: Historic data files in simple Php!
« Reply #4 on: June 17, 2013, 07:16:40 PM »
Hi Jacques,

Thanks, that took care of the problem!  ^-^  Now I can start playing with it! :)

Many thanks,

Joe

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Historic data files in simple Php!
« Reply #5 on: June 18, 2013, 11:19:37 AM »
Hi Joe,
Sometimes I'm rushing myself too much and errors happen! :o

Happy that this version solve the problem! In a few, I'll launch
a prototype of new "graphs engine", based on this files!
So, if you do something good with this file, let us know! 8)

Best regards,
Jacques
Please, consider supporting this site 

Offline PeterP

  • Jr. Member
  • **
  • Posts: 27
    • Coromandel Town weather
Re: Historic data files in simple Php!
« Reply #6 on: June 19, 2013, 06:12:08 AM »
Hi Joe/Jaques, those graphs look cool!

Once I have unzipped these files, where do I put them? I have guessed and put them in Weather Eden folder, and have not put them on the server.

I have created a new Weather Eden Tab, called "Graphs", which links to a file "historic.php" This is where I want to display the new charts.

http://coromandeltownweather.net/historic.php

As there are no instructions with this new function, I am guessing that :

1) I now need highcharts?, I have downloaded it just in case, but do I need it, and if so, where does it go?

and 2) for Cumulus to process one (or is it all ) of the new historic files and FTP the data somewhere, probably into historic.php?

 I have tried experimenting with the above guesses, but nothing has worked and I am totally lost now... 

Can someone help please?

Offline Mr.Meteo

  • Administrator
  • Hero Member
  • *****
  • Posts: 1120
    • http://www.meteostours.ca
Re: Historic data files in simple Php!
« Reply #7 on: June 22, 2013, 07:28:37 AM »
Hi Peter,

As you experienced, these files are only "juice" for others; that could be
periodic data in a table view, a gauge page or a chart with library like highchart.
You have more than 500 total readings, enough to feed any historic page!
(in only 21k processed file)

You just have to "link" these files to your chart script.
Also, you have to tell Cumulus to process the file(s) you want
(or All-in-one file: data_allT.php).

All the "Recent" webtags from Cumulus (1.9.4+) are used:
$RecentTS : Timestamp
$RecentOutsideTemp :  Outside Temperature
$RecentWindSpeed :  Wind Speed 
$RecentWindGust :  Wind Gust 
$RecentWindLatest :  Wind Latest. Note: Wind 'Speed', 'Gust' and 'Latest' have the usual Cumulus meanings 
$RecentWindDir :  Wind Direction (instantaneous) 
$RecentWindAvgDir :  Wind Direction (average) 
$RecentWindChill :  Wind Chill 
$RecentDewPoint :  Dew Point 
$RecentHeatIndex :  Heat Index 
$RecentHumidity :  Relative Humidity 
$RecentPressure :  Sea-level Pressure 
$RecentRainToday :  Today's rain 
$RecentSolarRad :  Solar Radiation 
$RecentUV :  UV Index

As we couldn't have all possible readings sent
at each site update, I've done 4 different interval
(planned for 4 buttons):

 - 36 Timestamp for 10 minutes interval (6h button)
ex: $RecentOutsideTemp_10m

 - 25 Timestamp for 30 minutes interval (12h button)
ex: $RecentWindGust_30m

 - 25 Timestamp for 60 minutes interval (24h button)
ex: $RecentDewPoint_1h

 - 15 Timestamp for 12 hours interval (7 days button)
ex: $RecentHumidity_12h

Each series have its corresponding timestamp,
so for 1st humidity reading, you will use:

Timestamp: $RecentTS_10m[0]
Humidity   : $RecentHumidity_10m[0]

Then, now its your turn to play with it!

Regards,
Jacques
Please, consider supporting this site