Page 1 of 2
include-NOAA-reports.php year rollover anomaly
Posted: Mon 31 Dec 2012 11:08 pm
by BCJKiwi
It is currently the 1st Jan 2013 here and we are in daylight saving time (summertime?) and are 13hrs AHEAD of UTC rather than the 'normal' 12 hrs.
Our website and data started in July 2012 so we still don't have a full year of data, and until tomorrow won't have any NOAA data for 2013.
So I was looking at our site to see if there were any anomalies and unfortunately found one with the NOAA style reports.
I have checked and the script we are running is unchanged from the original (ver 2.03 03-Dec-2011).
The latest month file (webserver time stamp - 1/01/2013 12:00:11 a.m.) is NOAAMO1212
The latest year file (webserver time stamp - 1/01/2013 12:00:11 a.m.) is NOAAYR2012
It seems to me (but what do I know in this area of programming?) that the problem may be to do with the special handling for Cumulus to determine the date range of the available NOAA reports. This appears to use the current date rather than determining the actual files available in the folder.
The following result occurs (and will probably only occur on the first day of each year) which results in this output.
If 2013 is clicked there is a message saying there is no data (ideally the 2013 row should not be there) and if you click the Jan button beside 2013 you get December 2012.
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 5:59 am
by saratogaWX
I think it is an error caused by supporting multiple weather software with one script. My original script supported only WeatherLink, which uploads a current-year and current-month file every upload cycle. VWS does likewise. Cumulus only uploads the month and year updated files just after midnight. Weather-Display does the same (update daily). This is likely a 1-day a year issue for Cumulus, but I'll look at what might be done to fix that issue.
Best regards,
Ken
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 10:13 am
by BCJKiwi
Thanks
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 11:15 am
by beteljuice
@Ken
Just checked a few Aus & NZ sites using the original code and their menus / display are correct.
ie. In 'classic' style The current year (2013) is all 'dead' and the (last) Dec 2012 report is displayed.
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 10:07 pm
by BCJKiwi
@ Beteljuice
I had some difficulty finding sites to comapre. Can you give me a couple of links please. Since it is now 2/Jan/2013 here I don't know if they will be much use to me but I would like to look.
Did you notice if they had data for Jan 2012 (which I don't)?
Of course, now that it is the 2 Jan, everything looks OK.
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 10:23 pm
by mcrossley
I *think* mine is pretty much stock...
http://weather.wilmslowastro.com/reports.php
Edit: Oops, sorry just noticed this thread is about Kens templates. Mine is the vanilla cu page
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 10:33 pm
by saratogaWX
I'm seeing the issue on my CU page now.. (it's still 1/1/2013 here) so I'm debugging it while I have this once-a-year chance

Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 10:51 pm
by beteljuice
@BCJKiwi
Here's a partial screen grab of an Aus site I viewed earlier.
Original script and in drop-down style.
Nav bar created for (New) year with no active links (because a Jan 2013 file has not been created yet) and last known report displayed.
NOAA_Reports.png
Re: include-NOAA-reports.php year rollover anomaly
Posted: Tue 01 Jan 2013 11:19 pm
by saratogaWX
I think I've got it worked out for the 4 software types (WL, Cumulus, VWS and wview) on my test site.
Yes, it does create a no-links 2013 row, but correctly displays the last monthly file available.
I'll make sure it works correctly tomorrow (2-Jan-2013) after the reports are available overnight.
The revised script is attached
Test on my site with:
Cumulus:
http://saratoga-weather.org/wxtemplates ... .php?wx=cu
WeatherLink:
http://saratoga-weather.org/wxtemplates ... .php?wx=wl
wview:
http://saratoga-weather.org/wxtemplates ... .php?wx=wv
VWS:
http://saratoga-weather.org/wxtemplates ... php?wx=vws
Best regards,
Ken
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 12:40 am
by BCJKiwi
@Beteljuice
I'm not sure about that site;
1. It has a different button array arrangement (^v selectable years) and presumably different code around the year/mo setup.
2. Does it get it's data from Cumulus?
@Ken
It is now 2 Jan in NZ (in the afternoon already!)
I see there was a ver 2.04 between the 2.03 I'm using and the new 2.05. Without great study I presume the changes in 2.04 were only for wview?
Have another issue now with the proposed fix. It shows Jan1 data when first opened but when you click on anything else or come back to Jan 2013 all I see is this;
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 1:02 am
by saratogaWX
Yes, the main difference between 2.03 and 2.04 was adding support for wview.
Do you have the page with the 2.05 version up on your site? I'd like to see it directly (not just a picture) to see what is happening.. there is additional debugging code built-in to 2.05. If you clone your current wxnoaaclimatereports.php page to a new name, and include the v2.05 include-noaa-reports.php (using a different name) that would help debug what's going on.
Best regards,
Ken
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 1:08 am
by BCJKiwi
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 1:19 am
by saratogaWX
Thanks... Try the attached.. I think I fixed the issue. .. replace your V2.05 with this one.
Best regards,
Ken
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 1:48 am
by BCJKiwi
Yes that seems to work OK.
It does display the 2013 row even when there is no 2013 data but we are in the 2013 year (renamed 2013 month and year NOAA files to exclude them for the test).
It does work properly for the 2nd Jan with 2013 mo and yr NOAA files in place, showing only the 1 Jan data (since the NOAA data for 2 Jan won't be available until 3 Jan).
Thanks V Much.
Re: include-NOAA-reports.php year rollover anomaly
Posted: Wed 02 Jan 2013 1:52 am
by saratogaWX
Thanks for spotting the issue and testing the fix(es).. I'll release the update on 2-Jan (Pacific time).
Best regards,
Ken