Welcome to the new home of the Cumulus Support forum.

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3044 7 December 2018. See the Wiki for download

PHP Web 'viewer' for Cumulus NOAA Style reports

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

User avatar
kingqueen
Posts: 60
Joined: Tue 26 Feb 2013 6:52 pm
Weather Station: Maplin N96GY / Fine Offset 1081
Operating System: Windows 7 HP 64 bit
Location: Wetherby, UK
Contact:

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

Post by kingqueen » Sat 25 May 2013 7:35 pm

Beteljuice

Thank you for your script. It's great.

There's something wrong with the anglicised code though. I've tried multiple times, copying it precisely, and I always end up with the following error.

Code: Select all

Warning:  Division by zero in /home/wetherby/public_html/noaa-inc.php on line 433

Warning:  preg_replace() [function.preg-replace]: Empty regular expression in /home/wetherby/public_html/noaa-inc.php on line 433
I've commented out Line 433 for now and the result is at http://www.wetherbyweather.org.uk/climate.php . PHP attached

Thanks
You do not have the required permissions to view the files attached to this post.
Image

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Post by beteljuice » Sat 25 May 2013 10:29 pm

That's an old oops :oops: - corrected syntax was mentioned here: http://sandaysoft.com/forum/viewtopic.p ... 4&start=80

Your code should be:

Code: Select all

	 $rpt = preg_replace('/State: West Yorkshire/'i, 'County: West Yorkshire   Country: UK', $rpt, 1);
I have re-edited the original post - thank you for bringing it to my attention.
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
kingqueen
Posts: 60
Joined: Tue 26 Feb 2013 6:52 pm
Weather Station: Maplin N96GY / Fine Offset 1081
Operating System: Windows 7 HP 64 bit
Location: Wetherby, UK
Contact:

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

Post by kingqueen » Sun 26 May 2013 12:17 am

beteljuice wrote:

Code: Select all

	 $rpt = preg_replace('/State: West Yorkshire/'i, 'County: West Yorkshire   Country: UK', $rpt, 1);
Thanks! I hardly dare say it, as I know absolutey zilch about Javascript etc., but to get it to work actually I had to have the i before the ':

Code: Select all

$rpt = preg_replace('/State: West Yorkshire/i', 'County: West Yorkshire   Country: UK', $rpt, 1);
Cheers
Image

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Post by beteljuice » Sun 26 May 2013 1:14 am

kingqueen wrote: ..Thanks! I hardly dare say it, as I know absolutey zilch about Javascript etc., but to get it to work actually I had to have the i before the ': ...
Arrgh ... the beteljuice had a bad bald day then and now.

You are correct of course :clap:
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
pernaczy
Posts: 113
Joined: Thu 15 Nov 2012 5:42 pm
Weather Station: Fine Offset WH 2080, TFA Spring
Operating System: XP SP3
Location: Niesiolowice, Northern Poland
Contact:

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

Post by pernaczy » Wed 29 May 2013 10:08 am

steve wrote:That's impossible! I tested it and it works! :lol:

But actually, I only tested the 'manual' saving, I forgot that the automatic saving is separate code :oops:

I'll change the other code and upload a new build later today.
Hi Steve,
It's me again. :oops: Today I had to regenerate my 2012 annual NOAA report file. From Cumulus menu I ask to generate this file then to save it. From drop-down menu I chose an option UTF-8. When editing this newly saved file under Notepad++ it says the format is ANSI.
I did the same with monthly file and here all is OK.
So it looks like the manual saving of (annual only) NOAA reports in UTF-8 format doesn't work. I have not checked other formats.
An automatic saving in UTF-8 format works fine.

Best Regards,
Piotr
The day when I have learned anything is not the lost one.

Image

User avatar
steve
Cumulus Author
Posts: 26714
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

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

Post by steve » Wed 29 May 2013 12:56 pm

Yes, there's a typo in the code for manual saving of the annual report - fixed in the next build.
Steve

wetter-pocking
Posts: 4
Joined: Wed 04 Jan 2012 7:45 pm
Weather Station: Davis Monitor II
Operating System: Windows 7
Location: Pocking

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

Post by wetter-pocking » Sun 11 Aug 2013 3:46 pm

Does anybody know why the menu is invisible when current month is selected?
You can find my reports here: http://noaa.wetter-pocking.de/index.php
You do not have the required permissions to view the files attached to this post.

User avatar
mcrossley
Posts: 5234
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2
Operating System: Stretch Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

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

Post by mcrossley » Sun 11 Aug 2013 4:22 pm

I think we'd have to see the source PHP to figure that one out - I suspect the month offset, zero verses 1 for January is to blame somewhere.

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Post by beteljuice » Sun 11 Aug 2013 10:21 pm

I must admit to being a bit bemused .....

It seems to only happen for the current month.
You have set the 'system' to look for VWS type file formats, and the program seems to be finding them, but when I try to 'see' a named month or year file I get a 404 !

Could you please confirm your file formats please ?
Image
......................Imagine, what you will KNOW tomorrow !

wetter-pocking
Posts: 4
Joined: Wed 04 Jan 2012 7:45 pm
Weather Station: Davis Monitor II
Operating System: Windows 7
Location: Pocking

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

Post by wetter-pocking » Mon 12 Aug 2013 6:11 am

Attached you will find the file format and php code.

This is a sample link to the files directory: http://noaa.wetter-pocking.de/reports/noaamo.txt
You do not have the required permissions to view the files attached to this post.

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Post by beteljuice » Mon 12 Aug 2013 1:10 pm

Image
......................Imagine, what you will KNOW tomorrow !

wetter-pocking
Posts: 4
Joined: Wed 04 Jan 2012 7:45 pm
Weather Station: Davis Monitor II
Operating System: Windows 7
Location: Pocking

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

Post by wetter-pocking » Mon 12 Aug 2013 6:38 pm

There is no "2013_08.txt", because this is the current month and the data is written to "noaamo.txt".

And there is no "2013.txt"-file, data of 2013 is written to "noaayr.txt".

BigOkie
Posts: 213
Joined: Tue 28 May 2013 1:06 am
Weather Station: Davis VP2
Operating System: Raspian Jessie
Location: Tulsa, OK

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

Post by BigOkie » Mon 12 Aug 2013 8:24 pm

wetter-pocking wrote:Attached you will find the file format and php code.

This is a sample link to the files directory: http://noaa.wetter-pocking.de/reports/noaamo.txt
I'm not sure if this is relevant to your problem or not, but adding the mean baro and mean humidity columns takes this file format and invalidates it (NOAA format) as they do not include that data.

Just pointing that out. If you're using it for other things, then continue on.

:)

User avatar
beteljuice
Posts: 2516
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: XP SP3 - honest
Location: Dudley, West Midlands, UK

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

Post by beteljuice » Mon 12 Aug 2013 10:00 pm

There is no "2013_08.txt", because this is the current month and the data is written to "noaamo.txt".
True - however your screenshot shows one !
I'm not sure if this is relevant to your problem or not, but adding the mean baro and mean humidity columns takes this file format and invalidates it (NOAA format) as they do not include that data.
The content of the report is unimportant as far as this program is concerned as it merely displays it without any kind of processing.

ATM I can't understand why the 'dropdown' part of the menu is correctly populated but the 'current' isn't :?

The code is essentially the same as the original one by Ken True, it maybe that my Cumulus tweaks 'broke' the VWS functionality somehow - I will continue to investigate ....
Image
......................Imagine, what you will KNOW tomorrow !

User avatar
laulau
Posts: 521
Joined: Tue 13 Oct 2009 10:52 pm
Weather Station: WeatherDuino Pro2
Operating System: Win 7
Location: Meyenheim, Alsace, FR
Contact:

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

Post by laulau » Tue 13 Aug 2013 5:58 am

Laurent

Image

Post Reply