Up until October, I was running WeatherDisplay on a Windows PC. My website uses the template created by Ken at Saratoga Weather. When I switched to a Mac, I started running WeatherCat because I didn't like the Mac version of WD. The only down side of switching is I lost the ability to view some pages in Ken's template that use the dailynoaa and climatedataout files that WD creates, specifically the Detail (wx...detail.php), Summary (wx....summary.php) and Monthly Records (wxnoaarecords.php) pages.
While poking around my site, I discovered that Ken had written a script to parse the STMONTHLY ouptput and put it in a style similar to the NOAA report and had an idea. What if I took the script that Ken wrote and add to it to create a dailynoaareport and climatedataout.html file on a regular basis, both as the current month and with the month and year too. The attached stmonthlytoWDfiles.php file is the result of that thought.
I have a cron job run every hour at 5 minutes before the hour that runs the script. The top line of the file is required for the script to run on my hosting company. You can remove it if it's not needed. As written, the script need to be in the same directory that your reports will be in, if you want to have it somewhere else, just update the path in the file_put_contents line around line 308-312. You will also need to adjust the path to the settings and common file to point to the proper location.
After I had that script working, I needed to get the data from past months so there were no holes in my reports. I still had the files from when I was running WD, but was missing 2 months worth. I have WeatherCat upload the MySql so the data was available, I just needed to write a script to create the files. That's handled by the createclimate.php and createnoaa.php scripts.
You need to put your database information in the proper spots around line 36 in both files then upload them to the directory where you are storing your noaa files. When you run the, enter the year and month that you want to convert and hit enter. The resulting report will be printed on you screen and a matching file on your server. Just keep running the report for all the months and years you want to convert.
DISCLAIMER: I am self taught in programing. I'm sure there are better and more efficient ways to do what these scripts do, but they work and that's all I care about.
Feel free to modify and improve them.
I would not have been able to create these scripts without the work done by Ken, thank you Ken!
Steve