24 Hour Extremes World Weather Script

This script will provide you will the last 24 hour extremes for your country or area using international
metar climate reports provided by ogimet.

To name a few, the extremes are based on multiple stations that submit metar information:
United States: 1345 stations
United Kingdom: 146 stations
Canada: 757 stations
(There are about 150 countries to choose)

The script will provide an output of the top 10 for each category (Max Temp., Min. Temp, and Precip.)

The script is 100% XHTML 1.0 Transitional.
Feel free to use and alter as you wish.

FULL VERSION:
The page can be seen in action at http://www.relayweather.com/wxworldextremes.php
The files are available at http://www.relayweather.com/downloads.php (Look for “World Weather 24 Hour Extremes Full Version”)

MENUBAR VERSION:
The page can be seen in action at http://www.relayweather.com/worldextremesGadget.php
The files are available at http://www.relayweather.com/downloads.php (Look for “World Weather 24 Hour Extremes Menubar Gadget”)

USE EXAMPLES:
World Extremes: http://www.relayweather.com/wxworldextremesWorld.php
North Hemisphere Extremes: http://www.relayweather.com/wxworldextremesNH.php
United States Extremes: http://www.relayweather.com/wxworldextremes.php

Enjoy! :slight_smile:

Michael
http://www.relayweather.com

Full Version History
(02-Dec-10) Version 0.5 – Added multi-area functionality (Thanks to Ray @ Tzouhalem-Maple Bay Weather www.tzweather.org !!)
(26-Nov-10) Version 0.4 – Improved ogimet server overloading handling function.
(25-Nov-10) Version 0.3 – Added ogimet server overload handling.
(24-Nov-10) Version 0.2 – Added Station Identification to tables and ID Lookup.
(23-Nov-10) Version 0.1 – Updated the script to change the temp or precip values font color to suite the cell background color. There were some instances of black font w/ very dark cell color which made it hard to read.

Menubar Version History
(28-Nov-10) Version 0.4 – Improved shortened location and station removal setup
(26-Nov-10) Version 0.3 – Script now outputs shortened location
(26-Nov-10) Version 0.2 – Improved ogimet server overloading handling function. Removed UTC timezone set (not needed)
(24-Nov-10) Version 0.1 – Add the ability to remove any unwanted stations from the output. Added ogimet server overload handling.

Hi Michael,

Excellent. :smiley:

Many thanks for the scripts :slight_smile:

Munro,

Thanks for the compliments! :slight_smile:

Let me know if you have any issues or problems…

Regards,
Michael

I had my test UK setup running very quickly… :slight_smile:

Can St Helena (in the south Atlantic) be excluded from the UK values as it will generally show the highest temperature (particularly at this time of year)? :frowning:

Cool Script. 8)
When using both the menu and full versions, are both cache files needed or can they share the same one?
http://www.cavecountryweather.com/extreme.php

drobbins,
For now, both are needed.
Michael

Munro,
Something can be done I’m sure…I just need a bit of time to look at it. Would telling the script to always grab the second value and treat as #1 be ok?

As it turned out I used the USA extreme in the menu and linked the world to the full page. So don’t worry about it. :wink: Thanks for the script.

Michael,

Another great script, thank you! Running here in Wisconsin. http://jcweather.us/extremes.php

  • Jim

I’ve updated the script to change the temp or precip values font color to suite the cell background color. There were some instances of black font w/ very dark cell color which made it hard to read.

To update, download again at the link above.

Cheers!
Michael

Great idea :thumbright:

Michael,

As the old Red Rose Tea commercial stated “Only in Canada, eh? Pity!”

I tried both scripts, the main script worked “out of the box” so to speak, the Gadget on the other hand, no amount of coaxing will get it to display anything but what shows in the attachment. #-o ](*,)

The values jive with the main script, just the locations are lost in the wind. :wink:

George


extreme.JPG

I’m pretty sure that would work for the main UK winter, but as St Helena is in the opposite hemisphere in the tropics (Latitude 16

Hi George!

Last night, I’ve made a correction the menubar version which should take care of that issue.

Find all instances of this:

<a href="./gsynres\?lang=en&ind=\d{5}&ano=\d{4}&mes=\d{2}&day=\d{2}&hora=\d{2}&min=\d{1}&ndays=\d{2}">(.*)</a></td>

and replace with this:

ys=\d{1,}">(.*)</a></td>

or…simply just redownload and install.
http://www.relayweather.com/downloads.php

Let me know if this works out as my PHP skills are still amatuer :slight_smile:

Michael

For the menubar version, I’ve added the ability to skip an undesired station or stations. For example, the United States will always show Guam, Pago Pago and Marshall Islands are the high temps this time of year as they are US Territories. It will also show Henry (Antarctica) as a possible highest cold location. You can skip stations.

How to accomplish:
Find the undesired location 5-digit station number by looking at the URL string (ind=XXXXX)

91765=Pago Pago
91375=Marshall Islands
91212=Guam
89108=Henry (Antarctica)

Within the code, you will see the following:

if (preg_match('/91765|91375|91212|89108/',$GadgetExtremes[1][0])) {
     	 $hiextremesLoc[1][0] = $hiextremesLoc[1][1];// Hi Temps-If first contains undesired location, skip to second
     	 $hiextremesValue[1][0] = $hiextremesValue[1][1];
     	 $loextremesLoc[1][0] = $loextremesLoc[1][1];// Lo Temps-If first contains undesired location, skip to second
     	 $loextremesValue[1][0] = $loextremesValue[1][1];
     	 }
     // If first does not contain undesirec location, display normal
     else { 
     	 $hiextremesLoc[1][0] = $hiextremesLoc[1][0];
     	 $hiextremesValue[1][0] = $hiextremesValue[1][0];
     	 $loextremesLoc[1][0] = $loextremesLoc[1][0];
     	 $loextremesValue[1][0] = $loextremesValue[1][0];
     	 }

Add, or delete the stations as needed and keep the syntax of the code intact separating with a pipe or “|”

Michael,

Went one better! added Rainer’s UoM switching span tags and now have the menubar switching between metric and imperial! :wink:

Thanks for the most useful script. =D>

George


Menubar.jpg

George,

This script should have this available? #-o

// Select Unit Type
$GadgetUseUnits = 'E';        // 'E'=USA(English) or 'M'=Metric 

Did you find that this doesn’t work?

Michael

Got it running here http://www.sunprairieweather.com/wx_world_weather_extremes.php
Thanks much and Happy Thanksgiving to everyone

Ya, but I have to be different! :lol: I have the UoM switching on the dashboard already, figured the menubar should do the same. :wink: :smiley:

Works like a charm after I figured out you can only have one switcher on the whole page layout without breaking the javascript!! Just wrapped the html for the menubar in an ajaxdashboard

then the dashboard switcher controls the tags in the menubar also. Kinda cool! :wink:

George

Cool script Michael. Thank you.