Created
October 31, 2015 00:41
-
-
Save boxmein/87cfdc5351926a10f8aa to your computer and use it in GitHub Desktop.
Map Yahoo! / YQL weather condition codes to FreeDesktop icon names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def condition_code_to_icon(code): | |
if 0 <= code <= 2: return 'weather-severe-alert' | |
elif 3 <= code <= 4: return 'weather-storm' | |
elif 5 <= code <= 8 or 13 <= code <= 18 or code == 35 or 41 <= code <= 43 or code == 46: return 'weather-snow' | |
elif 9 <= code <= 12 or code == 40 or code == 45 or code == 47: return 'weather-showers' | |
elif 19 <= code <= 22: return 'weather-fog' | |
elif 23 <= code <= 25: return 'weather-overcast' | |
elif code == 27 or code == 29: return 'weather-few-clouds-night' | |
elif code == 28 or code == 30: return 'weather-few-clouds' | |
elif code == 31 or code == 33: return 'weather-clear-night' | |
elif code == 32 or code == 34 or code == 36: return 'weather-clear' | |
elif 37 <= code <= 39 or code == 44: return 'weather-few-clouds' | |
else: return 'weather-clear' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment