Welcome to the Cumulus Support forum.
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
UK Extremes from the MetOffice
Moderator: daj
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
UK Extremes from the MetOffice
I'm playing around with a little PHP script that gets regional and UK wide extremes for a limited set of readings from the Met Office.
It is part of their DataPoint offering, you have to sign up to get an API code, but the sign up and data is free.
I am using this dataset: http://www.metoffice.gov.uk/datapoint/p ... servations
And I have it running on this page in the right-hand side bar: https://weather.wilmslowastro.com/today_yest.php
I need to sort out the text lengths somehow...
I can make the PHP class available if people are interested (once I have finalised the code).
As is often the case the data is supplied in a format that is convenient to generate, but no so convenient to use. If you want a specific value for a specific region, you have to walk the regions until you find the right one, then walk the extremes until you find the one you want.
So my code reformats the data so you can index directly in to specific regions and values.
It is part of their DataPoint offering, you have to sign up to get an API code, but the sign up and data is free.
I am using this dataset: http://www.metoffice.gov.uk/datapoint/p ... servations
And I have it running on this page in the right-hand side bar: https://weather.wilmslowastro.com/today_yest.php
I need to sort out the text lengths somehow...
I can make the PHP class available if people are interested (once I have finalised the code).
As is often the case the data is supplied in a format that is convenient to generate, but no so convenient to use. If you want a specific value for a specific region, you have to walk the regions until you find the right one, then walk the extremes until you find the one you want.
So my code reformats the data so you can index directly in to specific regions and values.
Last edited by mcrossley on Mon 17 Sep 2018 8:41 pm, edited 1 time in total.
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
Actually this is real test page - just a basic demo of the data: https://weather.wilmslowastro.com/test/ ... mes24h.php
Last edited by mcrossley on Mon 17 Sep 2018 8:42 pm, edited 1 time in total.
Re: UK Extremes from the MetOffice
I was only looking at the wealth of free data that they offer at the weekend.
I'm sure there will be a few of usmcrossley wrote: I can make the PHP class available if people are interested (once I have finalised the code).
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
Give this a whirl - I'm a bit busy at the mo so limited support. Version 0.2
Warning, there isn't much error checking in there yet!
EDIT: Updated the test file to add example cookie handling.
EDIT2: Updated the class file, if the cache file is stale, but there is no new data it now just performs a touch to reset the cache timer rather than rewriting the file. Ver 0.2
EDIT3: (17 Sept 18) updated sample PHP page to use a newer version of JQuery
Warning, there isn't much error checking in there yet!
EDIT: Updated the test file to add example cookie handling.
EDIT2: Updated the class file, if the cache file is stale, but there is no new data it now just performs a touch to reset the cache timer rather than rewriting the file. Ver 0.2
EDIT3: (17 Sept 18) updated sample PHP page to use a newer version of JQuery
You do not have the required permissions to view the files attached to this post.
Last edited by mcrossley on Mon 17 Sep 2018 8:47 pm, edited 3 times in total.
- jdc
- Posts: 142
- Joined: Tue 19 Jun 2012 8:51 pm
- Weather Station: Davis VP2 : Instromet
- Operating System: Win 10
- Location: Portsoy,.
- Contact:
Re: UK Extremes from the MetOffice
That is rather good!
I had a wee play with it this afternoon, simple setup and it's working fine. Neat.
I had a wee play with it this afternoon, simple setup and it's working fine. Neat.
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
Phew!
It will be interesting to see how you integrate the data into your web sites.
Now, what else is lurking in DataPoint....
It will be interesting to see how you integrate the data into your web sites.
Now, what else is lurking in DataPoint....
Re: UK Extremes from the MetOffice
Tomorrow nights taskmcrossley wrote: It will be interesting to see how you integrate the data into your web sites.
Mark, just a thought, is it possible to store the selected region in a cookie so a returning visitor automatically sees their last choice? Presumably in most cases this would be the region they live in.
- jdc
- Posts: 142
- Joined: Tue 19 Jun 2012 8:51 pm
- Weather Station: Davis VP2 : Instromet
- Operating System: Win 10
- Location: Portsoy,.
- Contact:
Re: UK Extremes from the MetOffice
http://lethamshank.co.uk/met/wx_extremes.phpmcrossley wrote:Phew!
It will be interesting to see how you integrate the data into your web sites.
Just some style then I will fit it somewhere! Unless you write something else to fill the page.
Knowing nil about js, how would I select only one region to create a snippet? (eg 'dg')
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
What, like this?: https://weather.wilmslowastro.com/test/ ... mes24h.phpduke wrote:Mark, just a thought, is it possible to store the selected region in a cookie so a returning visitor automatically sees their last choice? Presumably in most cases this would be the region they live in.
Last edited by mcrossley on Mon 17 Sep 2018 8:48 pm, edited 1 time in total.
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
John, just look a the test page, where it prints out the UK values...jdc wrote:http://lethamshank.co.uk/met/wx_extremes.phpmcrossley wrote:Phew!
It will be interesting to see how you integrate the data into your web sites.
Just some style then I will fit it somewhere! Unless you write something else to fill the page.
Knowing nil about js, how would I select only one region to create a snippet? (eg 'dg')
Code: Select all
echo 'UK Extremes for ' . $data->{'UkExtremes'}->{'extremeDate'} . '<br><br>' . PHP_EOL;
echo 'Region name: ' . $data->{'UkExtremes'}->{'Regions'}->{'uk'}->{'name'} . '<br>' . PHP_EOL;
// Just print out each extreme for the UK region as they are stored in the data blob
foreach ($data->{'UkExtremes'}->{'Regions'}->{'uk'}->{'Extremes'} as $extreme => $value) {
echo $conv[$extreme] . ' ' . $value->{'$'} . ' ' . $value->{'uom'} . ' ' . $value->{'locationName'} . '<br>' . PHP_EOL;
}
You can print individual values rather than using the 'blob' order so...
Code: Select all
$regVals = $data->{'UkExtremes'}->{'Regions'}->{'dg'}->{'Extremes'};
echo 'Max temp = ' . $regVals->{'HMAXT'}->{'$'} . ' ' . $regVasl->{'HMAXT'}->{'uom'} . ' at ' . $regVals->{'HMAXT'}->{'locationName'};
//..etc
- jdc
- Posts: 142
- Joined: Tue 19 Jun 2012 8:51 pm
- Weather Station: Davis VP2 : Instromet
- Operating System: Win 10
- Location: Portsoy,.
- Contact:
Re: UK Extremes from the MetOffice
Thank you again for that. I was looking at the wrong end of the script!
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
I have made a minor optimisation to the zip file above, if the cache file is stale, but there is no new data to just touches the file to reset the time rather than re-saving it.
- mcrossley
- Posts: 12951
- Joined: Thu 07 Jan 2010 9:44 pm
- Weather Station: Davis VP2/WLL
- Operating System: Bullseye Lite rPi
- Location: Wilmslow, Cheshire, UK
- Contact:
Re: UK Extremes from the MetOffice
I have the 5 day summary day/night data for a specified location working now - just need to figure out how to format it nicely like the Saratoga templates do!mcrossley wrote:Now, what else is lurking in DataPoint....
I was surprised Wilmslow was on the location list - there are 5000 entries.
Very basic data presentation as a test...
https://weather.wilmslowastro.com/test/ ... recast.php
Last edited by mcrossley on Mon 17 Sep 2018 8:48 pm, edited 1 time in total.