Open-Meteo Forecast API
Purpose: Primary weather data source. Provides the live forecast variables used to compute the snow day probability score.
Provider: Open-Meteo — an open-source, free weather API that aggregates output from multiple global and regional numerical weather prediction models including GFS (NOAA), ECMWF, GEM (Environment Canada), and others. No API key is required; the service is free for non-commercial use.
Variables requested:
- snowfall — hourly snowfall accumulation (cm)
- temperature_2m — air temperature at 2 metres above ground (°C)
- apparent_temperature — feels-like / wind chill temperature (°C)
- precipitation_probability — probability of any precipitation occurring (%)
- precipitation — total precipitation (mm, all types)
- weathercode — WMO weather interpretation code
- windspeed_10m — wind speed at 10 metres (km/h)
Open-Meteo Geocoding API
Purpose: Converts typed city names and postal codes into latitude/longitude coordinates, which are then passed to the forecast API.
Provider: Open-Meteo Geocoding — an open-source geocoding service backed by GeoNames and OpenStreetMap data. Supports city search by name with country filtering.
Usage in this site: When you type a city or ZIP code and press Predict, the geocoding API is queried first to resolve coordinates. The first result is used if it matches a city, town, or populated place. If the input cannot be resolved, the user sees an error prompting them to try a different format.
BigDataCloud Reverse Geocoding API
Purpose: Used for the "Use My Location" feature. When a user grants GPS permission, the browser provides raw coordinates. BigDataCloud converts those coordinates back into a human-readable city name for display in the prediction result header.
Provider: BigDataCloud — provides a free client-side reverse geocoding endpoint that runs directly in the browser. No server-side proxy is needed; the request goes from the user's browser directly to the BigDataCloud API.
Open-Meteo Archive API
Purpose: Powers the "Historical Snowfall Trends" chart. Retrieves monthly snowfall totals for the past several years to provide historical context for the current prediction.
Provider: Open-Meteo Historical Weather API — provides weather observations going back to 1940 for most global locations, based on the ERA5 reanalysis dataset from ECMWF.
Usage: This API is called only when the user explicitly clicks "Load Historical Data." It is not called on every prediction to keep API usage low and page load fast. Historical data is loaded once per session and is not cached persistently.
Caching Strategy
Snow Day Calculation uses a two-layer caching approach to reduce unnecessary API calls, improve response speed, and stay within free-tier usage limits:
- Browser local storage (client-side) — weather forecast results are cached for ~10 minutes per location; geocoding results for ~60 minutes. Implemented in
weather.js. - Service worker (shell cache) — static assets (HTML, CSS, JS) are cached with a stale-while-revalidate strategy so the site loads instantly on repeat visits and works offline.
No server-side caching proxy is used. All API calls go directly from the user's browser to the respective API provider.
Reliability & Failure Handling
If an API request fails (network error, API outage, rate limit exceeded), Snow Day Calculation shows a clear error message to the user rather than silently returning incorrect data. The prediction will not display until a successful API response is received. The historical chart (archive API) is the only optional component — if it fails, the main prediction is unaffected.
Rate Limits & Fair Use
Open-Meteo's free tier allows up to 10,000 forecast API calls per day per IP address (subject to change — refer to Open-Meteo's terms for current limits). Client-side caching significantly reduces the number of actual API calls made per user session. Snow Day Calculation does not currently use a server-side proxy or a commercial API plan. If the site's usage grows to a level where free-tier limits become a constraint, we will upgrade to a paid plan or explore alternative data sources.