Web Weather > Weather Website PHP/AJAX scripting

Analysis tool for advforecast2.php V5.17 (JSON) API failures logs

(1/4) > >>

I'm still seeing the stale gridpoint forecasts (every day in the mornings) from api.weather.gov Akamai cache servers.

Since the V5.16 script included optional logging of failures to ./cache/advforecast-log-YYYY-MM-DD.[txt|csv] files, I've written a script set to display the combined logs by day with sortable columns and search capability.

Note this script ONLY works with the V5.16+ version.  It will not display anything for the V4.x version of the script.

My stats at https://saratoga-weather.org/NWS-analyze/

Script set at https://saratoga-weather.org/NWS-analyze/NWS-analyze.zip .. if you install, I suggest you unpack it in the ./NWS-analyze/ directory on your website for tidiness.

I've posted about it on the API Discussion and hopefully with get the API developers to follow up on the stale stuff.

This tool is marvelous and very detailed.  Ken shared it with me pre-production and Saturday, the 22nd, I sent the links (4 for each in all) for my site(s) with explanations regarding my difficulties over the past several months in getting a current point forecast from api.weather.gov.

The point forecast success rate improved later that day, and it has gotten even better since then.  Now, fingers-crossed, I rarely have advforecast2.php's output fall over to my area's zone forecast.

For me, it worked extremely well.  I just checked, and there have only been two failures today.  This is incredible considering there were up to a hundred a day when I first installed the analysis tool!

Thanks, Ken! =D> \:D/ =D> [tup]

One bug fix: the array_search call in gen-csv.php bombs out if there are no matching files in the cache because $dList isn't set. I just declared it right after the glob() call.  Did the same thing in index.php.

Will add to my production code and turn logging back on (and report in on the NWS board).

Thanks for this!!

Thanks for that, Jasiu!

I've updated the .zip with those changes to get-csv.php and index.php.  Also added an automatic link for a detail HTTP log display (in new page), and set a <meta> to have robots not index nor follow the links.  Re-download the NWS-analyze.zip for the updates.

Oh, and forgot to say that you'll only have logs to analyze if advforecast2.php V5.16+ has

--- Code: ---# V5.16 logging capability for curl accesses to api.weather.gov
$doLogging = true;       // =true to enable summary logging, =false for no summary log file
# log saved to $cacheFileDir/advforecast2-log-YYYY-MM-DD.csv  (tab-delimited CSV file)
$doLoggingDetail = true; // =true to eanable detail logging, =false for no detail file
# log saved to $cacheFileDir/advforecast2-log-YYYY-MM-DD.txt

--- End code ---
(which is the default).  Both the .txt and .csv logs are needed for get-csv.php to produce the display results.

Another weirdness I'm seeing in my sandbox, Ken.

I have failures for yesterday (25th) but none for today (because I haven't run the fetch many times). So I get a display for today (26th) that is empty and and pulldown/select shows the 25th. But there is no way to make it go to the 25th. If this isn't clear let me know. I'll leave the sandbox in its current state in case you need an example.



[0] Message Index

[#] Next page

Go to full version