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

0 Members and 1 Guest are viewing this topic.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #150 on: September 09, 2019, 01:40:56 PM »
I think I've found the fix for 'today' daily data.  The problem is that there are two different queries to the API that result in 'today' data.

The general 'day' query of form:
Code: [Select]
https://api.weather.com/v2/pws/history/all?stationId='.$WUID.'&format=json&units='.$WCunits.'&date='.$lookFor.'&apiKey='.$WCAPIkey.'&numericPrecision=decimal and a 'rapid today' query using
Code: [Select]
https://api.weather.com/v2/pws/observations/all/1day?stationId='.$WUID.'&format=json&units='.$WCunits. '&apiKey='.$WCAPIkey.'&numericPrecision=decimal
The script used the former for ALL day queries.  Now it will use the latter for TODAY queries and that seems to have fixed the data current issue for today's data.

WXDailyHistory.php Version 1.32 - 09-Sep-2019 is now available at https://github.com/ktrue/WU-history
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #151 on: September 09, 2019, 05:24:28 PM »
Ken i have updated and todays data seems good. However i only have partial data for September 2nd, 3rd, 4th, 5th, and 8th. Is this data recoverable?
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #152 on: September 09, 2019, 05:34:24 PM »
Yes, you can reload the cache by adding ?force=1 to the URL like:

WXDailyHistory.php?graphspan=day&year=2019&month=09&day=02&force=1 (for the 2nd) .. etc.

It will use the daily history URL and should force fetch of that data again.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline dasman

  • Forecaster
  • *****
  • Posts: 491
    • Wx Peotone
Re: WU-History now works with WU/TMC API...
« Reply #153 on: September 09, 2019, 06:42:40 PM »
Thanks Ken that worked. After checking i found that over 40 days dating back to May 1st were missing data. I have forced them all. Oddly there are 6 days i cant force, July 5th thru 10th. Nothing shows when i try to force those dates.
Dave Sommerfed
Peotone Illinois USA
CW7762, KILPEOT1
NWS COOP, CoCoRaHS, Spotter Network

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #154 on: September 09, 2019, 07:35:58 PM »
Yep.. the July dates were a global issue.. the API didn't get data from the collectors then.  It's missing for me too.

My daily (and monthly) data for July, 2019 is missing for 1,3-6, and 8.  The query gets a return code of 204 (Data not available)
The rest of July is ok.
« Last Edit: September 09, 2019, 08:10:39 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline AWL

  • Forecaster
  • *****
  • Posts: 727
    • Ardmore Weather Live
Re: WU-History now works with WU/TMC API...
« Reply #155 on: September 10, 2019, 11:17:43 AM »
Everything working great now! Really want to thank you for all your hard work. Don't know what the personal weather website world would do without you  =D> =D>


Doug

Offline fredericowessel

  • Member
  • *
  • Posts: 40
    • Tempo em Teutônia
Re: WU-History now works with WU/TMC API...
« Reply #156 on: February 20, 2020, 09:17:53 AM »
I have installed the script to download CSV data from my station and then upload to Meteotemplate, I have some data missing there. I follow the instructions, preloaded cache with historical data manually for all years I have (Since 2013) without errors, but it's bein displayed only data from 01/01/2020 to today. What can I have missed?

Here the url: http://tempoemteutonia.com.br/linha-welp/WU-History-inc.php
----
Frederico Wessel
My weather site: www.tempoemteutonia.com.br
Brazilian PWSs: www.estacoesdobrasil.com.br

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #157 on: February 20, 2020, 11:36:23 AM »
I have installed the script to download CSV data from my station and then upload to Meteotemplate, I have some data missing there. I follow the instructions, preloaded cache with historical data manually for all years I have (Since 2013) without errors, but it's bein displayed only data from 01/01/2020 to today. What can I have missed?

Here the url: http://tempoemteutonia.com.br/linha-welp/WU-History-inc.php
The tabular data is there for January and February.. the graphs show empty because they are produced by WU using their old graphing service, and it hasn't seemed to be updated with the data from their collection service.
In WU-History-inc.php you have
Code: [Select]
$birthday   = "26-10-2013";                         // Stations first day of operation format dd-mm-yyyy.  This will determine years on the date selector.
$birthday   = "20-02-2020"; // all that's left in wu API data
and the second $birthday entry there means that only data from 2020 will be available on the dropdown list of years.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline fredericowessel

  • Member
  • *
  • Posts: 40
    • Tempo em Teutônia
Re: WU-History now works with WU/TMC API...
« Reply #158 on: February 20, 2020, 11:52:12 AM »
Ahh, great. I had not understood that second birthday. Now is right, thank you.
----
Frederico Wessel
My weather site: www.tempoemteutonia.com.br
Brazilian PWSs: www.estacoesdobrasil.com.br

Offline ed_heaton

  • Contributor
  • ***
  • Posts: 147
    • Atglen Borough Weather Observatory
Re: WU-History now works with WU/TMC API...
« Reply #159 on: April 02, 2020, 08:54:36 AM »
So I did get my WU History working again outside of the graphs...  Any suggestions?
https://www.atglenweather.com/wxwuhistory.php

Thanks!

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1986
    • My PWS at Leuven Belgium Europe
Re: WU-History now works with WU/TMC API...
« Reply #160 on: April 02, 2020, 09:02:48 AM »
So I did get my WU History working again outside of the graphs...  Any suggestions?
https://www.atglenweather.com/wxwuhistory.php

Thanks!

The data is now read from the new servers using the new API .  The data is then converted back to the old format.
But the graphs were generated on the old servers which are taken out of service. The graphs are not available anymore.

Wim
Wim

Offline ed_heaton

  • Contributor
  • ***
  • Posts: 147
    • Atglen Borough Weather Observatory
Re: WU-History now works with WU/TMC API...
« Reply #161 on: April 02, 2020, 09:24:40 AM »
Thank You!!!!

Offline Ian.

  • Forecaster
  • *****
  • Posts: 460
    • Chatteris Weather
Re: WU-History now works with WU/TMC API...
« Reply #162 on: April 18, 2020, 01:01:45 PM »
Thanks for all your hard work on this Ken, I've managed to get this working after following your notes.

Great job.

Lockdown has me focused on getting scripts back up and running, so I'm trawling forum posts for ideas.

Stay safe one and all

Ian
CWOP - DW3371
PWS - ICAMBRID16
https://www.chatteris.biz

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: WU-History now works with WU/TMC API...
« Reply #163 on: April 26, 2020, 04:58:26 PM »
Ken,

I and others have noticed that the Weekly Precipitation Summary is being calculated incorrectly.  The Daily, Monthly, and Yearly calculations seem to be correct.  Have you noticed this behavior?

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #164 on: April 26, 2020, 06:55:53 PM »
No, I'd not noticed that, and unfortunately, no rain here for a week, so I can't test it.
What is the URL to your site so I can take a  look?
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: WU-History now works with WU/TMC API...
« Reply #165 on: April 26, 2020, 07:12:10 PM »
https://mymishawakaweather.com/History.php  or  https://mymishawakaweather.com/WU-History-inc.php

Some other sites that use this script seem to have the same issue.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #166 on: April 26, 2020, 07:47:04 PM »
You're quite right.. the Weekly figures are very wonky.  I'll have to take a look at the logic in WU-History-inc.php for the weekly processing.

BTW.. the 'Custom' processing is not implemented anymore as they discontinued their CSV that honored that query.  My WXDailyHistory.php does not handle those queries.. sorry.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: WU-History now works with WU/TMC API...
« Reply #167 on: April 26, 2020, 07:54:34 PM »
I removed the "Custom" tab for that very reason.  Working with WU data has to be a remarkable headache so my hat is ooff to you!

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #168 on: April 27, 2020, 07:25:43 PM »
Ok, I've wandered through the code and think I've found the issue.. the weekly stats from WU have precip-total at that hour, and the routine that was totalizing the rain amount was expecting to just sum-up all the values (which works for the day, month, year).
I added a function to get just the end-of-day totals for each of the last 7 days and sum that up instead.

Try the attached version 3.4g of WU-History-inc.php and see if that fixes your issue. It also removes the Custom link (since that is not going to work either).
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline tmabell

  • Forecaster
  • *****
  • Posts: 394
    • Mishawaka Weather
Re: WU-History now works with WU/TMC API...
« Reply #169 on: April 27, 2020, 08:18:39 PM »
Yes, it sure did!  All working now.  Thank you for taking the time.

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #170 on: April 27, 2020, 08:20:52 PM »
You're very welcome.  The 'stay-at-home' order gives lots of time for nosing about in software.

I've updated the script in https://github.com/ktrue/WU-History repository.
« Last Edit: April 27, 2020, 08:26:56 PM by saratogaWX »
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline weerheerhugowaard

  • Member
  • *
  • Posts: 3
    • Weerheerhugowaard
Re: WU-History now works with WU/TMC API...
« Reply #171 on: May 11, 2020, 03:50:54 PM »
Hello Ken,

Thanks for the hard work.
Im using the stand alone version with your WXDailyHistory.php file.
It's al ok but the monthly and yearly rainfall in metric (mm) is not right.
Daily rain is ok, fot example  6mm daily is 60mm monthly on that day.

Regards
Ron Louwrink

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #172 on: May 11, 2020, 04:10:29 PM »
Hi Ron,
The images you show are from Radomir's wxwugraphs package, not my WU-History distribution (which is tabular only).

Radomir is no longer supporting his wxwugraphs package (AFAIK).  I've not dug into his scripts for issues other than to replace the WXDailyHistory.asp calls with WXDailyHistory.php calls using my script, sorry I can't be of further help about issues with his scripts.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline weerheerhugowaard

  • Member
  • *
  • Posts: 3
    • Weerheerhugowaard
Re: WU-History now works with WU/TMC API...
« Reply #173 on: May 12, 2020, 03:25:08 PM »
Hello Ken,

Im reading:
Version 1.30 Now fixes Radomir's wxwugraphs scripts for month and year displays.

The old version without your DailyHistory.php file the motley an yearly rain fall amound was ok.
Now 6.0 mm becomes 60 mm.
Is ther for a fix?

Thanks
Ron Louwrink

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 9288
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: WU-History now works with WU/TMC API...
« Reply #174 on: May 12, 2020, 06:23:33 PM »
It may be due to a difference in the month/year rain total for each data being miscast.

Try changing WUG-settings.php
Code: [Select]
// Rain units conversion (cm to mm)
$rainMultip = $metric ? 10 : 1 ;
to
Code: [Select]
// Rain units conversion (cm to mm)
$rainMultip = $metric ? 1 : 1 ;
to bypass the CM->MM conversion
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP