External scripts which use WeatherUnderground .CSV data

Thanks, Wim - again :slight_smile:

In the next release I will try, if time permits, to add an update program for past data in the master-cache

And would it enable to edit for good some failed records presented on WU reports?


I am very impressed with all the work put into these scripts and what is possible for a non-expert with competent guidance from Wim. Thank you very much.

About WU history:
I think many of us have “gaps” in our data at WU. Days where our station has been “down” for some reason.
If you choose one of these days in WU history, you get the message:
“scripts failed, check html for problems” and the script stops.
With me, for example, on May 10, 2015
Would it be possible to change the script so that in these cases it reports something like “No data for the selected day” - without the script stopping?

Mogens

The text is changed to “'No valid data for the period found” and a link to restart the script.

===

When you take the month or year view, you can click on the “blue” day number link and it will go directly to that day without using the menu.
There was a small error in the handling of that link, that took most of today.

But attached a new version of WU-History4.php to test with,

Wim


WU-History4.php.zip (12.1 KB)

Now it works really well - and exactly as described.
Thank you - again :smiley:

bump

Hi Wim,

I’ve added these two scripts to my site. They seem to be functioning fine. Thanks!

http://relayweather.net/pwsWD/index.php?frame=History_at_WU
http://relayweather.net/pwsWD/index.php?frame=Reports_at_WU

Michael

Hi Wim,

I’ve got a couple of questions concerning the History at WU script output.

– I’ve noticed that the word Calm (English) is spelled Kalm in the script. How do I go about making a change to display the correct language?
– The average wind always displays Direction (North) then #XX/XXX. I’m not sure what the # is for and what this data is stating.
– I don’t use solar with my station and the solar column states “NAN #0/186”. Is there anyway to stop this output? Could it display a “-” or delete the column all together?

See the attached image for examples

As always, your time is much appreciated

Regards,
Michael
relayweather.net


There is a language translation file, ./wuhistory/wulanguage-??.txt
The English one has a translation error for the word Calm on line 70

langlookup|Calm|Kalm|

change to

langlookup|Calm|Calm|
-- The average wind always displays Direction (North) then #XX/XXX. I'm not sure what the # is for and what this data is stating.

It displays North as the zero value is used for both “no winddirection” as “North” in the .CSV

As this is a script to analyse your history, it gives a count for the prevailing (average and high) winddirection
#XX/XXX such as #12/68 means 12 times this direction was reported of the 68 reported measurements

– I don’t use solar with my station and the solar column states “NAN #0/186”. Is there anyway to stop this output? Could it display a “-” or delete the column all together?

The settings are in the main script WU-History4.php lines 40 - 56
Solar is at line 48, set it to false

$showSolar      = false; // if available

Succes, Wim

Wim,

Thanks for the explanation and the fix.

I’ve noticed another problem. This is happening with both the WU Reports and WU History. It seems that WU History and WU Reports is not returning the data in certain cases. I checked WU directly and it seems that all of my data is available back to my WU data birth year (FEB-2008)

Example in WU History:
If I choose to look at daily data for a date in January 2019, it returns data that appears to be correct.
If I choose to look at monthly data for January 2019, it returns an error “Scripts failed, check html for problems”.
If I choose to look at yearly data for 2019, it returns data that doesn’t return January at all.

Example in WU Reports:
If I choose to look at daily detail for a date in January 2019, it returns data that is missing January 1 through Feb 14.
If I choose to look at monthly summary for January 2019, this script appears to hang

Another independent issue:
WU History goes back to February 2008, which is my data start timeframe, but WU Reports only goes back to 2011.

No hurry with these issues. I just wanted to start a discussion to potentially identify the error as they’re most likely WU problems.

Thanks Wim!

Maybe you trust computers or WU to much? This is my sons station

The station exists less then a year
WU seems to fill missing periods from surrounding stations /airports.
or it display todays data, or . .

But it can also be a hickup when loading the data for the first time by my scripts.

So if you really do not trust 2019 just rename that year files from ./wudata/
./wudata/WUID-metric-2019.arr
./wudata/2019

They will be recreated by the scripts, maybe the files will be better.
If the renamed ones were better just delete the new ones and rename the old ones back.

Wim


Hi Wim,

I deleted and had the script download both files again, and the same result. After checking these two files, it appears as if the data exists within both of them, but the script seems to skip this data.
It’s really not that important to dig into, I just wanted to let you know the status of my issue.

Regards,
Michael


KMDRELAY1-month-201901.txt (2.45 KB)

KMDRELAY1-english-2019.arr.txt (32.2 KB)

OK it seems this is a slightly older version of script.
It also caches the old yearly data, which is not necessary as there is a master cache in the .arr files.

Remove pwsWD/wureports/wuData/KMDRELAY1-year-2019.txt and the file will be recreated as the .arr is correct and the history script displays the data from Jan 1 2019 and onwards.

Wim

Wim

Hello WIM

Data is not retrieved from WU is it the new WU KEY API identifiction causing problem
I don’t know how to validate it in these files:

startWUhistory.php
and
startReports.php

Thank you in advance for your helpful help
Greetings


There are only a few lines to modify, f.i. lines 11 - 13 in startWUhistory.php

#-----------------------------------------------
#             HERE YOU NEED TO MAKE SOME CHANGES 
#-----------------------------------------------
$SITE['wuStart']        = '31-05-2029';	  // Important the format is:   dd-mm-YYYY  for your first day of uploading data to WU.      !
$SITE['wuID']	        = 'XXXXXXX'; 	  // your WU station name
$WUdatastr              = 'http://_replace_yourwebsite_/_replace folder_/PWS_DailyHistory.php';

You should change them to your weatherstation / website

$SITE['wuStart']        = '01-12-2019';	  // Important the format is:   dd-mm-YYYY  for your first day of uploading data to WU.      !
$SITE['wuID']	        = 'IFLEUR4'; 	  // your WU station name
$WUdatastr              = 'http://fleurie-meteolive.ovh/wuhistory/PWS_DailyHistory.php folder_/PWS_DailyHistory.php';

You made a typing error in the third line it should read

$WUdatastr              = 'http://fleurie-meteolive.ovh/wuhistory/PWS_DailyHistory.php';

The same error in the other script, the line

$WUdatastr      = 'http://fleurie-meteolive.ovh/wureports/startReports.php folder_/PWS_DailyHistory.php';

should be

$WUdatastr      = 'http://fleurie-meteolive.ovh/wureports/startReports.php'

Wim

Good evening WIM

Thank you for your information now both files are working
For Reports in the days of freezing the French translation was not made for that I modify the language file
I attach the two modified F language files

On the other hand, in the data complete days are missing and I cannot insert a missing date with your program with the file: WU-History4.php
is there a solution to add a missing date?
(Image attached)

http://fleurie-meteolive.ovh/index.php?frame=Reports_at_WU

Thank you in advance for your help

Kind regards


Language history-fr.zip (1.6 KB)

language reports-fr.zip (1.48 KB)

@ALL: Please post all language files in the special topic for language files.
My native language is Dutch (Netherlands). So there is not much I can do with dozens of language files I do not understand and therefor can not check.

. . . in the data complete days are missing and I cannot insert a missing date with your program with the file: WU-History4.php is there a solution to add a missing date?

I wrote a script to update those data arrays as they are used by all WU scripts used in the dashboard
All information is found here=> WU data arrays Update Script ** Closed **

Give it a try. If you run into problems post your remarks in that topic “WU data arrays Update Script”.

Succes, Wim

Thank you with your information all my problems are over
I put the lange files in the subject topic language files

Thank you again for helping me improve my site

http://fleurie-meteolive.ovh/index.php?frame=Reports_at_WU

cordially

Hi Wim,

I’ve setup the scrips and they’re grabbing the data from Wunderground and are displaying them.

The barometer is being shown as a whole number (no decimal) when units are set to English. This makes the month column to mostly contain the same value. I believe the “weReports1part.php” setting indicates rounding the result to 2 decimal digits on line 303 & 304. The result however is not what I think should display. Is there another variable that needs to be changed?

Thanks!

Hi Wim,

I noticed another anomaly when I ran the “wuhistory/startWUhistory.php” the first time. It seems the script uses a time calculation that is not based on local time. I.e. when I ran it a couple of hours before midnight my time (US Pacific, Los Angeles @ 22:30 2020-11-02), it produced the following request:

https://armon.com/pwsWD/PWS_DailyHistory.php?ID=KORCANNO14&day=03&month=11&year=2020&format=1&graphspan=day

Note the day was already the next day, which generated an error. When I ran the script after midnight it worked fine.

Thank you for all your work!