This repo generates the below widget from weather data. This type of widget is called a meteogram.
- Every hour
python refresh.pyfetches a forecast from SMHI Open Data and a Copernicus-based UV forecast from Strålsäkerhetsmyndigheten. The result is saved toweather/weather.json. - When the static
index.htmlfile is loaded, it makes a request using fetch toweather.json - The JSON file is passed through
transform_datatowards a format that can be used in a template - A mustache template converts the transformed data to HTML
- The index.html file reloads itself every hour to reflect the newly loaded
weather.json
- index.html is a static file (easier to cache and deploy)
- Forecast data is fetched at most once per hour.
- UV data is fetched for
Sverige (Stockholm)by default. SetUV_LOCATIONandUV_TIMEZONEtogether to use another location offered by SSM.
Run python refresh.py --force to fetch new data even when the existing
forecast is less than one hour old.
