Retrieves hourly weather data from the Open-Meteo API
using the KNMI HARMONIE AROME weather model via the /v1/forecast endpoint.
The KNMI model provides high-resolution forecasts (2 km for the Netherlands,
5.5 km for Europe) updated hourly. The "knmi_seamless" model (default)
blends KNMI HARMONIE AROME with ECMWF IFS beyond the 2.5-day KNMI horizon.
get_weather_hourly(
latitude = 53.22,
longitude = 6.57,
metrics = "temperature_2m",
past_days = 30,
forecast_days = 0,
model = "knmi_seamless",
timezone = "Europe/Amsterdam",
api_url = "https://api.open-meteo.com/v1/forecast"
)
get_weather_daily(min_hour = 8, max_hour = 17, fun = base::mean, ...)Latitude in decimal degrees (WGS84). Default: 53.22 (Groningen). Use negative values for the Southern Hemisphere.
Longitude in decimal degrees (WGS84). Default: 6.57 (Groningen). Use negative values for locations west of Greenwich.
Character vector of one or more hourly weather metrics to retrieve (default: "temperature_2m"). Multiple metrics can be specified, e.g. c("temperature_2m", "wind_speed_10m"). Common metrics include:
"temperature_2m": air temperature at 2 m above ground (degrees Celsius)
"relative_humidity_2m": relative humidity at 2 m (%)
"precipitation": rain + snow total (mm)
"wind_speed_10m": wind speed at 10 m (km/h)
"cloud_cover": total cloud cover (%)
See the KNMI API documentation for the full list of available variables.
Integer number of past days to include (default: 30, range: 0–92).
Integer number of forecast days to include (default: 0, range: 0–16). The native KNMI model provides up to 2.5 days; beyond that, the seamless model falls back to ECMWF IFS.
Character string specifying the weather model. One of
"knmi_seamless" (default, KNMI + ECMWF blend),
"knmi_harmonie_arome_europe" (5.5 km, Central & Northern Europe), or
"knmi_harmonie_arome_netherlands" (2 km, Netherlands & Belgium).
Character string for the timezone of returned timestamps (default: "Europe/Amsterdam").
Base URL of the Open-Meteo API endpoint.
First hour of the day to include on a 0-23 scale. Default: 8.
Last hour of the day to include on a 0-23 scale. Default: 17.
Function to use for calculation, defaults to mean().
Arguments passed on to get_weather_hourly().
A data.frame with columns:
time: POSIXct timestamp in the requested timezone
One column per requested weather variable, named as given in metrics
if (FALSE) { # \dontrun{
# temperature in Groningen over the past 30 days
get_weather_hourly()
get_weather_daily() # default: between 08:00-17:59
assen <- geocode("Assen", as_coordinates = TRUE, crs = 4326)
latitude(assen)
longitude(assen)
get_weather_daily(latitude = latitude(assen),
longitude = longitude(assen))
# wind speed with 3-day forecast
get_weather_hourly(metrics = "wind_speed_10m", past_days = 7, forecast_days = 3)
# multiple variables at once
get_weather_hourly(metrics = c("temperature_2m", "relative_humidity_2m"))
# high-resolution Netherlands-only model
get_weather_hourly(model = "knmi_harmonie_arome_netherlands",
past_days = 0,
forecast_days = 2)
} # }