Author Topic: NOAA reports on New years day  (Read 243 times)

0 Members and 1 Guest are viewing this topic.

Offline BCJKiwi

  • Forecaster
  • *****
  • Posts: 302
    • Silver Acorn Weather - N.Z.
NOAA reports on New years day
« on: December 31, 2019, 06:09:59 PM »
Hi all.
Running Cumulus MX in New Zealand (we see issues early!)

Found that
wxnoaaclimatereports.php (Version 1.01) / include-NOAA-reports.php (V3.3)
generates an error
Notice: Undefined index: NOAAYR2020.txt in C:\wamp64\www\weather\include-NOAA-reports.php on line 294

This fix seems to work:-
   $nav_build = array(); // initialise, will become eg. $nav_build[2011][found_year, months[] ]
// Check if it is first day of the year. The reports are always for the previous day so for new years day reduce year by one.
   if ( date('z') === '0' ) { $now_year = $now_year - 1 ; }
   
for ($y = $now_year; $y >= $first_year; $y--) { // populate $nav_build array()

Add the two lines that are bold between line 285 and 286.


Actually better placed between lines 169 and 170

$now_year = $now['year'];
// Check if it is first day of the year. The reports are always for the previous day so for new years day reduce year by one.
   if ( date('z') === '0' ) { $now_year = $now_year - 1 ; }
   
$prior_month = $now['mon'] - 1;

You may notice these errors are on a local development server where most errors display. The error did not show on the public website as our hosting service suppresses most errors.
« Last Edit: December 31, 2019, 08:59:50 PM by BCJKiwi »

 

anything