Skip to contents

Retrieves daily aggregated weather forecast data from the Norwegian Meteorological Institute (MET.NO) locationforecast API. This is a convenience function that wraps get_metno_forecast and aggregates the hourly forecast data into daily summaries.

Usage

get_metno_daily_forecast(
  latitude,
  longitude,
  days = 9,
  api_key,
  timeout = 30,
  max_retries = 3,
  retry_delay = 1
)

Arguments

latitude

Numeric. The latitude in decimal degrees for the forecast location. Must be within Australian limits (-44 to -10).

longitude

Numeric. The longitude in decimal degrees for the forecast location. Must be within Australian limits (112 to 154).

days

Numeric. The number of forecast days to return (1-9, default: 9).

api_key

Character. Your email address, required for the User-Agent header as per MET Weather API terms of service.

timeout

Numeric. Request timeout in seconds (default: 30).

max_retries

Numeric. Maximum number of retry attempts for failed requests (default: 3).

retry_delay

Numeric. Base delay between retries in seconds (default: 1.0).

Value

A data.table with daily aggregated weather forecasts, including: date, min_temperature, max_temperature, total_precipitation, avg_wind_speed, max_wind_speed, avg_relative_humidity, avg_pressure, avg_cloud_fraction, and dominant_weather_symbol.

Details

The latitude and longitude are truncated to 4 decimal places as per MET Weather API Terms of Service. The daily aggregation includes minimum and maximum temperatures, total precipitation, average and maximum wind speeds, average relative humidity, average air pressure, average cloud fraction, and a dominant weather symbol for the day.

Author

Rodrigo Pires, rodrigo.pires@dpird.wa.gov.au

Examples

if (FALSE) { # \dontrun{
# Example of how to use the function (replace with your actual email)
# daily_forecast <- get_metno_daily_forecast(
#   latitude = -27.5,
#   longitude = 153.0,
#   days = 7,
#   api_key = "your.email@example.com"
# )
# print(daily_forecast)
} # }