Page 2 of 6
Re: Extreme Weather script(s)
Posted: Wed 26 Aug 2015 2:20 pm
by beteljuice
Any ideas, I have changed the time zone to Australia, would that have anything to do with it??
That has everything to do with it !
WMO METAR, TAF, SYNOPS etc. are alway Zulu time (UTC) - how else could you compare ?
Re: Extreme Weather script(s)
Posted: Wed 26 Aug 2015 2:40 pm
by gluepack
Well, the source site could have done a conversion I suppose but (viz. my update to my last post), looking at the code for the source site (ogimet), there is no parameter for timezone so you are stuck with specifying UTC.
Re: Extreme Weather script(s)
Posted: Wed 26 Aug 2015 3:27 pm
by ace2
gluepack wrote:Well, the source site could have done a conversion I suppose but (viz. my update to my last post), looking at the code for the source site (ogimet), there is no parameter for timezone so you are stuck with specifying UTC.
At first it was working fine, But i suppose after a few hours it went up the sh**....
I'll change it back.....

Re: Extreme Weather script(s)
Posted: Wed 26 Aug 2015 11:34 pm
by GraemeT
Good find Gluepack, even better that it needs very little config.
http://weather.gktnet.com/world_extremes.php
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 5:35 am
by ace2
gluepack wrote:Well, the source site could have done a conversion I suppose but (viz. my update to my last post), looking at the code for the source site (ogimet), there is no parameter for timezone so you are stuck with specifying UTC.
Instead of changing the offset that effects the source grab, i created another offset to be only used on heading
Code: Select all
<?php
date_default_timezone_set('Australia/Adelaide');
$years = date("Y");
$months = date("m");
$monthnames = date("F");
$days = date("d");
$daynumbers = date("jS");
$hours = date("H");
?>
Then just change the heading I wanted changed to
Code: Select all
<?php echo $days."/".$months."/".$years; ?> at <?php echo $hours ?>
(added a s to the end....)
So I don't think this will effect anything...I hope........
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 12:02 pm
by beteljuice
It is important to stress that this is additional code (might be better to prefix var names with $title_ )
Also, in your modified 'title' you are not stating what TZ you are using. International visitors may be confused.
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 1:36 pm
by gluepack
...not to mention that it doesn't work with 1/2 hour time zones
I've attached my version (which corrects that) where I have made the following changes...
// VerJ.1 27-Aug-15 -- Increased arrays to include all countries and regions
// Added headings for country/region list
// Made output lines variable based on number of data items, if less than number of stations requested
// Added ability to choose alternate display time to UTC as additional line or replacement
Anyone is welcome to use it and, if you spot any problems, let me know.
Examples (not great

) of heading change...
Adding line with alternate time zone
alttz.jpg
Adding line with alternate time zone with alternative name
altloc.JPG
Replacing UTC with alternate time zone
altrep.JPG
Demonstrating 1/2 hour time zone works
alttz.jpg
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 3:06 pm
by gluepack
And the date changes too
altausmid.JPG
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 3:31 pm
by ace2
gluepack wrote:And the date changes too

That's perfect, thanks for that..
I was happy to leave what ever hour with 00 minutes, But this is so much better...
**I did need to edit the date to d/m/y(all done of course)**
**just an Australian thing**
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 3:48 pm
by gluepack
Yes, I think I should put in a date format option.
Not too keen on the headings generally but too lazy to think of something else.
btw, your site needs a parameter to switch the damn crickets off, I keep thinking there is one in the house

Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 4:11 pm
by PaulMy
Thanks Jeremy, you've done good work with this. I have it at
http://www.komokaweather.ca/wxWorldExtremes.php
One difficulty I have is that I cannot get it to show my correct local time and not sure if it is my error understanding the settings or if it is a UTC minus issue. I have:
$where = 'Europe/London'; // Long timezone name e.g. 'Europe/Sofia' or 'UTC' if no alternate
$where_alt = 1; // 0 = use timezone name, 1 = use alternate name
$where_utc = 0; // 0 = use as well as UTC, 1 = use in place of UTC in display
$where_alternate = 'Komoka, ON Canada'; // Any text or null if using timezone name
// To open location links into another tab/window
// $newtab = 'target="_self"'; // opens link in same tab/window
$newtab = 'target="_blank"'; // opens link in a new tab/window
/////////////////////////////////////////////////////////////////////////////
//END SETTINGS///////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Setup UTC date/time for heading and add/replace location date/time for specified alternate time zone
$utc_date = $month."/".$day."/".$year." at ".$hour.":00 UTC";
$where_date = null;
if ($where !== 'UTC')
{
$where_date = $month."/".$day."/".$year." ".$hour.":00";
$new_date = DateTime::createFromFormat( 'm/d/Y G:i', $where_date, new DateTimeZone('America/Toronto') );
in my settings and it shows UTC time plus Komoka, ON Canada as alternate but at URC plus 5 hours. Other time settings I've tried are all at UTC plus rather than UTC minus.
Any suggestions?
Paul
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 4:15 pm
by ace2
gluepack wrote:btw, your site needs a parameter to switch the damn crickets off, I keep thinking there is one in the house

There is actual 2 switches as such...
1. Large speaker below top heading
2. down the bottom speaker with the words
'Turns background audio OFF/ON. **On IOS & Android, this turns audio ON/OFF**'
See...

Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 4:44 pm
by gluepack
PaulMy...
Your $where should be 'America/Toronto'
There is a full list at
https://en.wikipedia.org/wiki/List_of_t ... time_zones
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 5:21 pm
by PaulMy
Thanks, got it now.
The first time I selected on a country/region other than ones I had opened before it gave a warning about "No such file ..." for lines 226-229 of the script but then a reload and all is good. After a few minutes and going back to the page now any country selected display correctly, so likely just a pause in creating the extremeCache_ file. All is good now.
Paul
Re: Extreme Weather script(s)
Posted: Thu 27 Aug 2015 6:02 pm
by gluepack
It might be my fault. I created a folder below cache and used explicit references to it.
Next update I will use the system cache folder and provide for an alternative sub-folder.
I notice that your 'World' works.
Also next update I will add ability to change date format, dmy or mdy.