WXforum.net
Web Weather => Weather Website PHP/AJAX scripting => Topic started by: Mark / Ohio on August 08, 2017, 11:32:40 PM
-
One of my loyal website viewers reported to me today that my June report was actually the same as my May report. Turns out it also did the same for 2016. Years before that are ok though. I can bring up the correct report in WeatherLink but somehow the May report got loaded and filed as June the last two years.
Thoughts?
Click on June for both 2017 and 2016 and you'll see what I mean.
http://fairfieldcountyweather.com/NOAAarchive.php?yr=2017&mo=06
Actually your report for June 2017 is also showing the May report instead as well Ken but your 2016 report is OK.
http://saratoga-weather.org/scripts-NOAAtxt.php?yr=2017&mo=06
;) So it must not be something I done to break it for a change. :lol:
-
Oooh.. I'm embarrassed to have not caught that on my own site! It looks like I was running some old code that didn't change the timezone properly, so it did the copy of NOAAPRMO.TXT early (before the month ended) instead of later (8 hrs after the month starts, and same for the yearly copy).
It started in April on my site (when I moved to a new VPS), so Apr, May, Jun, Jul were all incorrect (each containing the prior month). Now it's all fixed (I hope).. that's the problem with debugging something that happens once per month or year.
What I changed in the script version was putenv("TZ=$ourTZ");
to if (!function_exists('date_default_timezone_set')) {
if (! ini_get('safe_mode') ) {
putenv("TZ=$ourTZ"); // set our timezone for 'as of' date on file
}
} else {
date_default_timezone_set($ourTZ);
}
so the timezone would be correctly set. It was only with WeatherLink that this was important, as the script copies NOAAPRMO.TXT (and NOAAPRYR.TXT) to be the prior month (and year) NOAA reports.. for VWS or Cumulus, the files are named and handled by the weather software.
Thanks for spotting the issue(s) Mark!
-
As always thanks for such a quick fix Ken! :grin:
I made the script changes and uploaded the correct pages for the prior months.
-
Hi,
In what file are these changes applied?
I'm confused when to use/include include-NOAA-reports.php vs NOAA-reports-test.php
Thanks,
Dennis
-
That fix was for the standalone version of the script (NOAA-reports-test.php) -- the one in the Saratoga template (include-NOAA-reports.php) already had the fix :)
-
Thanks for the clarification Ken.
Dennis
-
Yes thanks for the clarification Ken, appreciate it :-)