Page 5 of 19

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 7:56 am
by Solorize
Hi,

I've just noticed that my NOAA report on my website has not moved on to November.
i.e. not showing any data nor giving me the (NOV) month button at the top to click on.

can someone confirm if Cumulus generates and uploads the new month automatically
or do I need to generate each new month myself?

If Cumulus does not automatically generate and upload, will this be added into a
future Cumulus update?

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 7:58 am
by captzero
Mine rolled over without any problems.

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 8:15 am
by nking
Solorize wrote:Can someone confirm if Cumulus generates and uploads the new month automatically
or do I need to generate each new month myself?

If Cumulus does not automatically generate and upload, will this be added into a
future Cumulus update?
It is a feature built into 1.9.2 (which I note you are using) and the parameters are under Configuration on the Cumulus control panel "NOAA Setup". I can confirm that mine is working automatically and generates the reports correctly.

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 8:16 am
by steve
Solorize wrote:I've just noticed that my NOAA report on my website has not moved on to November.
Perhaps you had an ftp problem on the first upload after midnight. Did the report get created in the reports folder on your PC?

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 8:23 am
by Solorize
hmm,

I have just looked in my C:\Cumulus\Reports folder and can see that there is a txt file.
NOAAM01111.txt <--- which is the November report file, so it is logging it ok.


NOAAM01111.txt;

Code: Select all

                  Monthly Climatological Summary for Nov 2011

Name: Wokingham Weather   City: Wokingham   State: Berkshire
Elevation: 45 m  Lat: N 51° 25' 37"   Lon: W 000° 51' 02"

                  Temperature (°C), Rain (mm), Wind Speed (mph)

                                      Heat  Cool        Avg
    Mean                              Deg   Deg         Wind                 Dom
Day Temp  High   Time   Low    Time   Days  Days  Rain  Speed High   Time    Dir
----------------------------------------------------------------------------------
 1  12.0  16.2   12:27   6.2   23:53   6.3   0.0   0.3   3.6  15.2   02:23    SW
----------------------------------------------------------------------------------
    12.0  16.2     1     6.2     1     6.3   0.0   0.3   3.6  15.2     1      SW

Max >=  27.0:  0
Max <=   0.0:  0
Min <=   0.0:  0
Min <= -18.0:  0
Max Rain: 0.3 on day 1
Days of Rain: 1 (> 0.2 mm)  0 (> 2.0 mm)  0 (> 20.0 mm)
Heat Base: 18.3  Cool Base: 18.3  Method: Integration
I have looked in my NOAAYR2011.txt and it has an entry for the 11th month;

Code: Select all

Name: Wokingham Weather   City: Wokingham   State: Berkshire
Elevation: 45 m  Lat: N 51° 25' 37"   Lon: W 000° 51' 02"

                  Temperature (°C), Heat Base: 18.3  Cool Base: 18.3
                          Dep.  Heat  Cool                       Max  Max  Min  Min
        Mean  Mean        From  Deg   Deg                        >=   <=   <=   <=
 YR MO  Max   Min   Mean  Norm  Days  Days  Hi  Date  Low  Date 27.0  0.0  0.0 -18.0
------------------------------------------------------------------------------------
 11  1
 11  2  10.0   3.5   6.7   0.0   197     0  16.0  24   0.0   12    0    0    1    0
 11  3  14.8   1.5   7.6   0.0   332     0  22.9  25  -5.6    8    0    0   12    0
 11  4  20.2   6.6  13.1   0.0   155     0  28.8  23   2.0   13    1    0    0    0
 11  5  19.9   7.7  13.7   0.0   141     0  25.7   6   0.1    4    0    0    0    0
 11  6  21.7   9.4  15.5   0.0    92     9  30.7  27   4.5   12    2    0    0    0
 11  7  22.6  11.1  16.8   0.0    59    14  26.9   5   6.6   25    0    0    0    0
 11  8  21.9  11.7  16.6   0.0    84    30  29.4   1   6.8   19    3    0    0    0
 11  9  21.1  10.4  15.4   0.0   103    18  26.5   2   4.7   15    0    0    0    0
 11 10  17.4   8.6  12.8   0.0   178     7  27.1   1  -0.4   20    1    0    1    0
 11 11  16.2   6.2  12.0   0.0     6     0  16.2   1   6.2    1    0    0    0    0
 11 12
------------------------------------------------------------------------------------
        18.6   7.7  13.0   0.0  1351    79  30.7 Jun  -5.6  Mar    7    0   14    0

                                Precipitation (mm)
It looks like the files didnt get copied onto my server?

Could someone confirm what settings I need to have selected to have this
done automatically, just so I can check I have it all set up OK.

The only thing I can think off why it is not on my server is perhaps my internet connection
was down, when Cumulus went to upload the files and therefore they did not get coppied?


These are my settings on Cumulus;

Image

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 8:32 am
by nking
Your settings look fine and if during October it was updating daily then you have them set right. Like Steve mentions, your FTP may have misfunctioned when the auto FTP was attempted.

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 1:25 pm
by Solorize
Yup I guess it must have been a problem with the FTP upload.

I have manually copied them over to my server so hopefully
it will work ok from now on.

Thanks

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 5:57 pm
by mcrossley
I just dropped the script on my web server, I had to comment out the setting of the TZ variable (line 159) as the server did not like that, but I get a couple of errors which seem to relate to the non-existent (yet) December 11 report...?

Notice: Undefined index: NOAAMO1211.txt in C:\xampp\htdocs\weather\NOAA-reports.php on line 301
Notice: Undefined offset: 13 in C:\xampp\htdocs\weather\NOAA-reports.php on line 325

http://weather.wilmslowastro.com/noaa-reports.php

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Wed 02 Nov 2011 11:17 pm
by beteljuice
I think it's because your error reporting is at twitch level (insisting variables are declared up front and not dynamically)

Try this please:
NOAA-reports.zip
I don't understand why your TZ failed - works on PHP 4.5 up :?

Edit: I see that you've edited out //putenv("TZ=$ourTZ");
Does it work if you use 'old' style declaration ?

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 9:09 am
by mcrossley
Hi beteljuice, just the same with that version :(
Notice that if you select a year, then an additional error is displayed
http://weather.wilmslowastro.com/noaa-r ... hp?yr=2011

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 9:34 am
by mcrossley
Changing line 302 to:

Code: Select all

if (array_key_exists($testfile, $filesfound)) {
fixes that problem, trying to figure out which index is going out of bounds at line 326...

Edit: Got it, in the month for loop $m is incremented before the range check, so when the loop exits $m=13
change line 326 to:

Code: Select all

if($y != $first_year) { $nav_build[$y]['months'][$m-1] .= "<br />\n";}
and that fixes it.

And finally changed 367-371 to:

Code: Select all

			if (array_key_exists($testfile, $filesfound)) {
				$advisory = "<br /><b>Report for $yr ";
				if ($mo) {$advisory .= $months[$mo];}
				$advisory .= "</b>\n";
				$rpt = implode("",file("$NOAAdir/$testfile"));

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 10:07 am
by mcrossley
Oh, and the putenv error? I run in Safe Mode, so
In Safe Mode, the user may only alter environment variables whose names begin with the prefixes supplied by this directive. By default, users will only be able to set environment variables that begin with PHP_
http://php.net/manual/en/function.putenv.php

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 1:07 pm
by beteljuice
Cheers Mark, I'll check that out and update later.

Never used array_key_exists, I'll have to look it up :?

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 2:03 pm
by mcrossley
I hadn't either, but looking up on how to trap 'does not exist' errors found it, you cannot pass the missing array member to any of the normal error checking routines because it doesn't exist so the act of passing it causes an error - doh!

Re: PHP Web 'viewer' for Cumulus NOAA Style reports

Posted: Thu 03 Nov 2011 2:33 pm
by beteljuice
mcrossley wrote: ...
And finally changed 367-371 to:

Code: Select all

			if (array_key_exists($testfile, $filesfound)) {
				$advisory = "<br /><b>Report for $yr ";
				if ($mo) {$advisory .= $months[$mo];}
				$advisory .= "</b>\n";
				$rpt = implode("",file("$NOAAdir/$testfile"));
I elected to go 'terse' - same but different ;)

Code: Select all

			if (array_key_exists($testfile, $filesfound)) {
				$advisory = "<br /><b>Report for $yr " .($mo ? $months[$mo] : ''). "</b>\n";
				$rpt = implode("",file("$NOAAdir/$testfile"));

			} else {