cloudy cloudy

Author Topic: WU-History now works with WU/TMC API...  (Read 446 times)

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Global Moderator
  • Posts: 5,939
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 67.0
    • Saratoga Weather
WU-History now works with WU/TMC API...
« on: May 23, 2019, 10:09:18 PM »
Whew.. I've written a shim script to replace the now-missing WXDailyHistory.asp page on the WU website with a WXDailyHistory.php script on your website that returns the same formatted CSV file for use with Jim McMurry's (jcweather.us) script set.  Only two files change if you have a working installation:

WU-History-inc.php  - V3.4d - 23-May-2019 and
WXDailyHistory.php  -  V1.00 - 23-May-2019  (added file .. initial release).

The WXDailyHistory.php file uses the WU/TWC API to api.weather.com to retrieve (and cache monthly data), then format to the CSV file expected by WU-History-inc.php.

Released on GitHub at https://github.com/ktrue/WU-History distribution .. please read the README.md for more info.

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline mldenison

  • Posts: 308
  • OS/Browser:
  • Win 7/Srvr 2008R2
  • Chrome 74.0.3729.169
    • York, Pennsylvania USA Weather
Re: WU-History now works with WU/TMC API...
« Reply #1 on: May 23, 2019, 11:09:27 PM »
Great job, Ken!  It works perfect right out of the gate.

Offline saratogaWX

  • Global Moderator
  • Posts: 5,939
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 68.0
    • Saratoga Weather
Re: WU-History now works with WU/TMC API...
« Reply #2 on: July 17, 2019, 11:28:20 PM »
I've just released WXDailyHistory.php V1.22 - 12-Jul-2019.  The WU API was returning bad obsTimeLocal values for any date from June, 2018 or before.  The epoch date was being returned in milliseconds (13 digits) instead of the expected 10-digit seconds.

https://github.com/ktrue/WU-History -- only WXDailyHistory.php (and the README.md) were changed.  No need to reload your cache files for June, 2018 and before.. the script handles the date by processing the epoch date (after pruning if need be) to generate the local date based on the tz entry in the returned JSON.

This may also fix some strange errors for Radomir's wugraphs in month and year mode.

My thanks to Holger of http://dl5ark.heliohost.org for spotting the issue leading to the fix.

Best regards,
Ken
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

Offline saratogaWX

  • Global Moderator
  • Posts: 5,939
  • Ken True
  • Saratoga, CA, USA 37:16:28N, 122:01:23W - Elev: 374ft.
  • OS/Browser:
  • Win NT 10.0
  • Firefox 68.0
    • Saratoga Weather
Re: WU-History now works with WU/TMC API...
« Reply #3 on: July 18, 2019, 10:32:12 PM »
Ahh.. one more major change to Version 1.30 - 18-Jul-2019.  This set of changes now fixes the display issues for Year and Month in Radomir's wxwugraphs.  Only WXDailyHistory.php (and the README.md) were changed.

If you're using Radomir's wxwugraphs scripts, you'll need to clean out your wxwugraphs/cache/ files to get good CSV files stored by WXDailyHistory.php returns.  See the README.md on the distribution for details.  Thanks again to Holger for testing this out.
Ken True
Saratoga Weather
CWOP: CW1792
WeatherUnderground: KCASARAT1
Free weather website PHP scripts and WD website AJAX templates

 

cumulus