# `weather.yr` Fetches a forecast from the Norwegian Meteorological Institute's [Locationforecast API](https://api.met.no/weatherapi/locationforecast/2.0/documentation) (yr.no). ```yaml sources: weather: source: weather.yr params: lat: 55.64277 lon: 13.20638 altitude: 17 ``` ## Params ```{eval-rst} .. autopydantic_model:: todays_paper_web.widgets.weather.yr.YrParams ``` ## Returns A `WeatherForecastModel`, with one method: - `.nextHour(timestamp, hour) -> WeatherForecast | None` — the forecast entry closest to `hour` on the day of `timestamp` (or the next day, if `hour` has already passed relative to `timestamp`), with its own `.timestamp` adjusted into `timestamp`'s timezone. Each `WeatherForecast` has: | Field | Type | Description | | --- | --- | --- | | `timestamp` | `datetime` | When this forecast entry is for. | | `icon` | `WeatherIcon` | The condition + time of day; `.id()` gives the string (e.g. `"01d"`) that {doc}`../widgets/image`'s `` expects. | | `airTemperature` | `float \| None` | Degrees Celsius. | | `windSpeed` | `float \| None` | Meters/second. | | `precipitation` | `float \| None` | Always `None` for `weather.yr` currently — the field exists on the model but this source doesn't populate it. | | `relativeHumidity`, `windGustSpeed` | `float \| None` | Same — present on the model, not populated by `weather.yr`. | Used together with `` in a template: ```xml+jinja {% set forecast = source('weather').nextHour(timestamp, 8) %} {{ forecast.timestamp.strftime('%H:%M') }} {{ forecast.airTemperature }}°C {{ forecast.windSpeed|round|int }} m/s ```