Skip to contents

Download point-level historical weather (ERA5) using open-meteo API

Usage

get_historical_weather(
  latitude,
  longitude,
  site_id = NULL,
  start_date,
  end_date,
  variables = c("relative_humidity_2m", "precipitation", "wind_speed_10m", "cloud_cover",
    "temperature_2m", "shortwave_radiation")
)

Arguments

latitude

latitude degree north

longitude

longitude degree east

site_id

name of site location (optional, default = NULL)

start_date

earliest date requested. Must be on or after 1950-01-01

end_date

latest date requested

variables

vector of name of variable(s) https://open-meteo.com/en/docs/ensemble-api

Value

data frame with the results from the call to the open-meteo API. The data frame is in a long format and has the following columns: "datetime", "site_id", "model_id", "variable", "prediction","unit".

Examples

if (FALSE) { # interactive()
get_historical_weather(
latitude = 37.30,
longitude = -79.83,
start_date = "2023-01-01",
end_date = Sys.Date(),
variables = c("temperature_2m"))
}