Weather Software > Station Software Development
Potential weather icons
saratogaWX:
The icon list posted by Steve is based on the NWS Forecast Icons set for weather conditions in a forecast, and we've co-opted them for use in the current conditions display (nice picture icons :) )
I've also used them as part of a METAR decode function to post current sky condition based on
the standard sky codes ( SKC, FEW, SCT, BKN, OVC ) corresponding to Clear, 'Sunny/Fair', Partly Cloudy, Mostly Cloudy, Overcast.
The numbers in the icon list are for Chance of Precipitation amounts in 10% increments .. not something you'd generally use for a condition report.
Some of the conditions listed in the icon set are kinda hard to suss-out from just the weather software (like Sleet, FreezingRain, Ice Pellets) as a rain gauge can report rate of rain so you can figure out LightRain, Rain, Heavy Rain and Stopped Raining based on rate and time since last bucket tip. Wind can be taken into account for WindyRain/Heavy Rain+Wind. But... Mist, Dust probably can't be detected without special sensors not on the average amateur station.
Here's the code snippet from my get-metar-conditions-inc.php routine included with the V3 AJAX/PHP website template set to map the Weather-Display iconnumbers to icons-to-use based on decoded METAR sky/weather conditions
--- Code: ---function mtr_load_iconDefs () {
global $Icons, $IconsText, $Conditions, $Debug;
// CURRENT CONDITIONS ICONS FOR clientraw.txt
// create array for icons. There are 35 possible values in clientraw.txt
// It would be simpler to do this with array() but to make it easier to
// modify each element is defined individually. Each index [#] corresponds
// to the value provided in clientraw.txt
$Icons[0] = "day_clear.gif"; // image sunny.visible
$Icons[1] = "night_clear.gif"; // image clearnight.visible
$Icons[2] = "day_partly_cloudy.gif"; // image cloudy.visible
$Icons[3] = "day_partly_cloudy.gif"; // image cloudy2.visible
$Icons[4] = "night_partly_cloudy.gif"; // image night cloudy.visible
$Icons[5] = "day_clear.gif"; // image dry.visible
$Icons[6] = "fog.gif"; // image fog.visible
$Icons[7] = "haze.gif"; // image haze.visible
$Icons[8] = "day_heavy_rain.gif"; // image heavyrain.visible
$Icons[9] = "day_mostly_sunny.gif"; // image mainlyfine.visible
$Icons[10] = "mist.gif"; // image mist.visible
$Icons[11] = "fog.gif"; // image night fog.visible
$Icons[12] = "night_heavy_rain.gif"; // image night heavyrain.visible
$Icons[13] = "night_cloudy.gif"; // image night overcast.visible
$Icons[14] = "night_rain.gif"; // image night rain.visible
$Icons[15] = "night_light_rain.gif"; // image night showers.visible
$Icons[16] = "night_snow.gif"; // image night snow.visible
$Icons[17] = "night_tstorm.gif"; // image night thunder.visible
$Icons[18] = "day_cloudy.gif"; // image overcast.visible
$Icons[19] = "day_partly_cloudy.gif"; // image partlycloudy.visible
$Icons[20] = "day_rain.gif"; // image rain.visible
$Icons[21] = "day_rain.gif"; // image rain2.visible
$Icons[22] = "day_light_rain.gif"; // image showers2.visible
$Icons[23] = "sleet.gif"; // image sleet.visible
$Icons[24] = "sleet.gif"; // image sleetshowers.visible
$Icons[25] = "day_snow.gif"; // image snow.visible
$Icons[26] = "day_snow.gif"; // image snowmelt.visible
$Icons[27] = "day_snow.gif"; // image snowshowers2.visible
$Icons[28] = "day_clear.gif"; // image sunny.visible
$Icons[29] = "day_tstorm.gif"; // image thundershowers.visible
$Icons[30] = "day_tstorm.gif"; // image thundershowers2.visible
$Icons[31] = "day_tstorm.gif"; // image thunderstorms.visible
$Icons[32] = "tornado.gif"; // image tornado.visible
$Icons[33] = "windy.gif"; // image windy.visible
$Icons[34] = "day_partly_cloudy.gif"; // stopped rainning
$Icons[35] = "windyrain.gif"; // wind + rain
$IconsText[0] = 'Sunny';
$IconsText[1] = 'Clear';
$IconsText[2] = 'Cloudy';
$IconsText[3] = 'Cloudy2';
$IconsText[4] = 'Partly Cloudy';
$IconsText[5] = 'Dry';
$IconsText[6] = 'Fog';
$IconsText[7] = 'Haze';
$IconsText[8] = 'Heavy Rain';
$IconsText[9] = 'Mainly Fine';
$IconsText[10] = 'Mist';
$IconsText[11] = 'Fog';
$IconsText[12] = 'Heavy Rain';
$IconsText[13] = 'Overcast';
$IconsText[14] = 'Rain';
$IconsText[15] = 'Showers';
$IconsText[16] = 'Snow';
$IconsText[17] = 'Thunder';
$IconsText[18] = 'Overcast';
$IconsText[19] = 'Partly Cloudy';
$IconsText[20] = 'Rain';
$IconsText[21] = 'Rain2';
$IconsText[22] = 'Showers2';
$IconsText[23] = 'Sleet';
$IconsText[24] = 'Sleet Showers';
$IconsText[25] = 'Snow';
$IconsText[26] = 'Snow Melt';
$IconsText[27] = 'Snow Showers2';
$IconsText[28] = 'Sunny';
$IconsText[29] = 'Thunder Showers';
$IconsText[30] = 'Thunder Showers2';
$IconsText[31] = 'Thunder Storms';
$IconsText[32] = 'Tornado';
$IconsText[33] = 'Windy';
$IconsText[34] = 'Stopped Raining';
$IconsText[35] = 'Wind/Rain';
/* the following is a lookup table for conditions text from the metar to return
the WD Icon number above. It is sorted such that the most severe conditions
are at the top of the list, with least severe at the bottom. This is done
so that significant weather icon will prevail when multiple conditions/sky cover
messages are emitted by the METAR station.
tornado/waterspout
thunder (in any form)
Ice / Snow/ Freezing / Sleet
Rain
Fog
Haze/Smoke/Dust/Volcano
cloud cover
*/
$Condstring = '
#
cond|tornado|32|32|Severe storm|
cond|thunder|31|17|Thunder storm|
cond|ice|23|23|Sleet|
cond|snow|25|16|Snow|
cond|freezing rain|23|23|FrzgRn|
cond|freezing drizzle|23|23|FrzgRn|
cond|freezing fog|6|11|FrzgFog|
cond|hail|23|23|Hail|
cond|heavy rain|8|12|Rain|
cond|light rain|22|15|Rain|
cond|showers|22|15|Showers|
cond|rain|20|14|Rain|
cond|fog|6|11|Fog|
cond|drizzle|22|15|Drizzle|
cond|mist|10|10|Mist|
cond|haze|7|7|Haze|
cond|dust|7|7|Dust(Haze icon)|
cond|smoke|7|7|Smoke(Haze icon)|
cond|volcanic|7|7|Volcanic Ash(Haze icon)|
cond|sand|7|7|Sand(Haze icon)|
cond|overcast|18|18|Overcast|
cond|mostly cloudy|2|4|Mostly Cloudy|
cond|partly cloudy|19|4|Partly Cloudy|
cond|few clouds|19|4|Few Clouds|
cond|clear|0|1|Clear|
cond|cloud|19|4|Variable Clouds|
#
';
$config = explode("\n",$Condstring);
foreach ($config as $key => $rec) { // load the parser condition strings
$recin = trim($rec);
if ($recin and substr($recin,0,1) <> '#') { // got a non comment record
list($type,$keyword,$dayicon,$nighticon,$condition) = explode('|',$recin . '|||||');
if (isset($type) and strtolower($type) == 'cond' and isset($condition)) {
$Conditions["$keyword"] = "$dayicon\t$nighticon\t$condition";
// $Debig .= "<!-- '$keyword'='$dayicon','$nighticon' '$condition' -->\n";
}
} // end if not comment or blank
} // end loading of loop over config recs
return;
}
--- End code ---
Best regards,
Ken
Navigation
[0] Message Index
[*] Previous page
Go to full version