Author Topic: WU Icon Names  (Read 1186 times)

0 Members and 1 Guest are viewing this topic.

Offline dnavarrojr

  • Member
  • *
  • Posts: 43
    • Weather Center
WU Icon Names
« on: November 07, 2013, 02:38:16 PM »
This is mostly for me since I don't have access to email to send these to myself and someone else might find them useful... but these are the names of all the Weather Underground Icons:

chanceflurries.png
chancerain.png
chancesleet.png
chancesnow.png
changetstorms.png
clear.png
cloudy.png
flurries.png
hazy.png
mostlycloudy.png
mostlysunny.png
rain.png
sleet.png
snow.png
sunny.png
tstorms.png

nt_chanceflurries.png
nt_chancerain.png
nt_chancesleet.png
nt_chancesnow.png
nt_changetstorms.png
nt_clear.png
nt_cloudy.png
nt_flurries.png
nt_hazy.png
nt_mostlycloudy.png
nt_mostlysunny.png
nt_rain.png
nt_sleet.png
nt_snow.png
nt_sunny.png
nt_tstorms.png
« Last Edit: November 07, 2013, 03:28:36 PM by dnavarrojr »
Dave Navarro, Jr. - The Weather Center
https://weathercenter.us

Offline dnavarrojr

  • Member
  • *
  • Posts: 43
    • Weather Center
Re: WU Icon Names
« Reply #1 on: November 07, 2013, 03:24:32 PM »
If you're accessing the NWS XML data, the following PHP function will convert NWS icon names to Weather Underground icon names:

Code: [Select]
/* Convert NWS icon names to WU */

function nws2wu( $nws_icon ) {

  $icons = [
             'skc.png'     => 'clear.png',
             'few.png'     => 'partlycloudy.png',
             'bkn.png'     => 'mostlycloudy.png',
             'sct.png'     => 'cloudy.png',
             'ovc.png'     => 'mostlycloudy.png',
             'fg.png'      => 'hazy.png',
             'shra.png'    => 'rain.png',
             'tsra.png'    => 'tstorms.png',
             'sn.png'      => 'snow.png',
             'fzrara.png'  => 'sleet.png',
             'mist.png'    => 'haze.png',
             'ra.png'      => 'rain.png',
             'nskc.png'    => 'nt_clear.png',
             'nfew.png'    => 'nt_partlycloudy.png',
             'nbkn.png'    => 'nt_mostlycloudy.png',
             'nsct.png'    => 'nt_cloudy.png',
             'novc.png'    => 'nt_mostlycloudy.png',
             'nfg.png'     => 'nt_hazy.png',
             'nshra.png'   => 'nt_rain.png',
             'ntsra.png'   => 'nt_tstorms.png',
             'nsn.png'     => 'nt_snow.png',
             'nfzrara.png' => 'nt_sleet.png',
             'nmist.png'   => 'nt_haze.png',
             'nra.png'     => 'nt_rain.png',
  ];
 

  $wu_icon = $icons[ $nws_icon ];
   
  if ( strlen( $wu_icon ) ) {
    return $wu_icon;
  } else {
    return $nws_icon;
  }

}
Dave Navarro, Jr. - The Weather Center
https://weathercenter.us

 

anything