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.
get_metno_daily_forecast(
latitude,
longitude,
days = 9,
api_key,
timeout = 30,
max_retries = 3,
retry_delay = 1,
use_cache = TRUE,
cache_dir = NULL,
allow_stale_on_error = TRUE
)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.
Numeric. The latitude in decimal degrees for the forecast location. Must be within Australian limits (-44 to -10).
Numeric. The longitude in decimal degrees for the forecast location. Must be within Australian limits (112 to 154).
Numeric. The number of forecast days to return (1-9, default: 9).
Character. Your email address, required for the User-Agent header as per MET Weather API terms of service.
Numeric. Request timeout in seconds (default: 30).
Numeric. Maximum number of retry attempts for failed requests (default: 3).
Numeric. Base delay between retries in seconds (default: 1.0).
Logical. Use session-scoped cache and conditional
revalidation for MET.NO responses. Defaults to TRUE.
Character. Optional directory path for cache files. If
NULL (default), uses file.path(tempdir(), "metno_cache").
Logical. If TRUE (default), return stale cached
data when MET.NO returns HTTP 429 (rate limit exceeded) and stale cache is
available.
Rodrigo Pires, [email protected]
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.
Other METNO:
get_metno_forecast(),
metno_get_dominant_symbol(),
metno_resample_data_table(),
metno_timeseries_to_data_table()
Other data fetching:
get_coastal_forecast(),
get_data_drill(),
get_data_drill_apsim(),
get_dpird_apsim(),
get_dpird_extremes(),
get_dpird_minute(),
get_dpird_summaries(),
get_metno_forecast(),
get_patched_point(),
get_patched_point_apsim(),
get_precis_forecast(),
get_radar_imagery(),
get_satellite_imagery()
if (FALSE) {
# 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 = "[email protected]"
# )
# print(daily_forecast)
}
Run the code above in your browser using DataLab