change to structured weather icon paths

This commit is contained in:
Matt Walsh
2025-05-14 16:16:20 -05:00
parent e2877aad77
commit 384693688c
294 changed files with 1182 additions and 67 deletions

View File

@@ -1,6 +1,6 @@
const hourlyIcon = (skyCover, weather, iceAccumulation, probabilityOfPrecipitation, snowfallAmount, windSpeed, isNight = false) => {
// internal function to add path to returned icon
const addPath = (icon) => `images/r/${icon}`;
const addPath = (icon) => `images/icons/regional-maps/${icon}`;
// possible phenomenon
let thunder = false;
@@ -22,17 +22,16 @@ const hourlyIcon = (skyCover, weather, iceAccumulation, probabilityOfPrecipitati
// first item in list is highest priority, units are metric where applicable
if (iceAccumulation > 0 || ice) return addPath('Freezing-Rain-1992.gif');
if (snowfallAmount > 10) {
if (windSpeed > 30 || wind) return addPath('Blowing Snow.gif');
if (windSpeed > 30 || wind) return addPath('Blowing-Snow.gif');
return addPath('Heavy-Snow-1994.gif');
}
if ((snowfallAmount > 0 || snow) && thunder) return addPath('ThunderSnow.gif');
if (snowfallAmount > 0 || snow) return addPath('Light-Snow.gif');
if (thunder) return (addPath('Thunderstorm.gif'));
if (probabilityOfPrecipitation > 70) return addPath('Rain-1992.gif');
if (probabilityOfPrecipitation > 50) return addPath('Shower.gif');
if (probabilityOfPrecipitation > 30) {
if (!isNight) return addPath('Scattered-Showers-1994.gif');
return addPath('Scattered-Showers-Night.gif');
return addPath('Scattered-Showers-Night-1994.gif');
}
if (fog) return addPath('Fog.gif');
if (skyCover > 70) return addPath('Cloudy.gif');
@@ -42,7 +41,7 @@ const hourlyIcon = (skyCover, weather, iceAccumulation, probabilityOfPrecipitati
}
if (skyCover > 30) {
if (!isNight) return addPath('Partly-Cloudy.gif');
return addPath('Mostly-Clear.gif');
return addPath('Partly-Cloudy-Night.gif');
}
if (isNight) return addPath('Clear-1992.gif');
return addPath('Sunny.gif');