Title: | Wrappers for 'Open-Meteo' API |
---|---|
Description: | Wrappers for the Application Programming Interface from the <https://open-meteo.com> project along with helper functions. The <https://open-meteo.com> project streamlines access to a range of publicly historical and forecast meteorology data from agencies across the world. |
Authors: | Quinn Thomas [aut, cre, cph] |
Maintainer: | Quinn Thomas <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1 |
Built: | 2024-11-02 05:30:33 UTC |
Source: | https://github.com/flare-forecast/ropenmeteo |
Add longwave to ensemble forecast dataframe using Idso and Jackson (1969). Requires cloud cover and temperature variables in input data frame.
add_longwave(df)
add_longwave(df)
df |
data frame output from one of the functions that gets a data frame from the API (e.g., |
data frame with the same columns as the input df
but with longwave_radiation
added as a variable
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave()
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave()
Output units:
air_temperature: K
relative_humidity: proportion
surface_downwelling_longwave_flux_in_air: W m-2
surface_downwelling_shortwave_flux_in_air: W m-2
precipitation_flux: kg m-2 s-1
wind_speed: m s-1
air_pressure: Pa
cloud_cover: proportion
convert_to_efi_standard(df)
convert_to_efi_standard(df)
df |
data frame output by get_ensemble_forecast |
data frame
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave() |> convert_to_efi_standard()
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave() |> convert_to_efi_standard()
Convert daily climate projections to hourly time-step
daily_to_hourly(df, latitude, longitude)
daily_to_hourly(df, latitude, longitude)
df |
data frame output by |
latitude |
latitude degree north |
longitude |
longitude degree east |
data frame with an hourly time step
get_climate_projections( latitude = 37.30, longitude = -79.83, start_date = Sys.Date(), end_date = Sys.Date() + lubridate::years(1), model = "EC_Earth3P_HR", variables = glm_variables(product = "climate_projection", time_step = "daily")) |> daily_to_hourly(latitude = 37.30, longitude = -79.83)
get_climate_projections( latitude = 37.30, longitude = -79.83, start_date = Sys.Date(), end_date = Sys.Date() + lubridate::years(1), model = "EC_Earth3P_HR", variables = glm_variables(product = "climate_projection", time_step = "daily")) |> daily_to_hourly(latitude = 37.30, longitude = -79.83)
Download point-level climate projections using open-meteo API
get_climate_projections( latitude, longitude, site_id = NULL, start_date, end_date, model = "EC_Earth3P_HR", variables = c("temperature_2m_mean") )
get_climate_projections( latitude, longitude, site_id = NULL, start_date, end_date, model = "EC_Earth3P_HR", variables = c("temperature_2m_mean") )
latitude |
latitude degree north |
longitude |
longitude degree east |
site_id |
name of site location (optional, default = NULL) |
start_date |
Number of days in the future for forecast (starts at current day) |
end_date |
Number of days in the past to include in the data |
model |
id of forest model https://open-meteo.com/en/docs/climate-api |
variables |
vector of name of variable(s) https://open-meteo.com/en/docs/climate-api |
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", "reference_datetime", "site_id", "model_id", "ensemble", "variable", "prediction","unit".
get_climate_projections( latitude = 37.30, longitude = -79.83, start_date = Sys.Date(), end_date = Sys.Date() + lubridate::years(1), model = "EC_Earth3P_HR", variables = c("temperature_2m_mean"))
get_climate_projections( latitude = 37.30, longitude = -79.83, start_date = Sys.Date(), end_date = Sys.Date() + lubridate::years(1), model = "EC_Earth3P_HR", variables = c("temperature_2m_mean"))
Download point-level ensemble weather forecasting using open-meteo API
get_ensemble_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "gfs_seamless", variables = c("relative_humidity_2m", "precipitation", "wind_speed_10m", "cloud_cover", "temperature_2m", "shortwave_radiation") )
get_ensemble_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "gfs_seamless", variables = c("relative_humidity_2m", "precipitation", "wind_speed_10m", "cloud_cover", "temperature_2m", "shortwave_radiation") )
latitude |
latitude degree north |
longitude |
longitude degree east |
site_id |
name of site location (optional, default = NULL) |
forecast_days |
Number of days in the future for forecast (starts at current day) |
past_days |
Number of days in the past to include in the data |
model |
id of forest model https://open-meteo.com/en/docs/ensemble-api |
variables |
vector of name of variable(s) https://open-meteo.com/en/docs/ensemble-api |
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", "reference_datetime", "site_id", "model_id", "ensemble", "variable", "prediction","unit".
get_ensemble_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 7, past_days = 2, model = "gfs_seamless", variables = c("temperature_2m"))
get_ensemble_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 7, past_days = 2, model = "gfs_seamless", variables = c("temperature_2m"))
Download point-level ensemble weather forecasting using open-meteo API
get_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "generic", variables = c("temperature_2m") )
get_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "generic", variables = c("temperature_2m") )
latitude |
latitude degree north |
longitude |
longitude degree east |
site_id |
name of site location (optional, default = NULL) |
forecast_days |
Number of days in the future for forecast (starts at current day) |
past_days |
Number of days in the past to include in the data |
model |
id of forest model https://open-meteo.com/en/docs/climate-api. Default = "generic" |
variables |
vector of name of variable(s) https://open-meteo.com/en/docs/ensemble-api. |
data frame (in long format)
get_forecast(latitude = 37.30, longitude = -79.83, forecast_days = 7, past_days = 2, model = "generic", variables = c("temperature_2m"))
get_forecast(latitude = 37.30, longitude = -79.83, forecast_days = 7, past_days = 2, model = "generic", variables = c("temperature_2m"))
Download point-level historical weather (ERA5) using open-meteo API
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") )
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") )
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 |
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".
get_historical_weather( latitude = 37.30, longitude = -79.83, start_date = "2023-01-01", end_date = Sys.Date(), variables = c("temperature_2m"))
get_historical_weather( latitude = 37.30, longitude = -79.83, start_date = "2023-01-01", end_date = Sys.Date(), variables = c("temperature_2m"))
Download point-level seasonal weather forecast using open-meteo API
get_seasonal_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "cfs", variables = c("temperature_2m") )
get_seasonal_forecast( latitude, longitude, site_id = NULL, forecast_days, past_days, model = "cfs", variables = c("temperature_2m") )
latitude |
latitude degree north |
longitude |
longitude degree east |
site_id |
name of site location (optional, default = NULL) |
forecast_days |
Number of days in the future for forecast (starts at current day) |
past_days |
Number of days in the past to include in the data |
model |
id of forest model https://open-meteo.com/en/docs/ensemble-api |
variables |
vector of name of variable(s) https://open-meteo.com/en/docs/ensemble-api |
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", "reference_datetime", "site_id", "model_id", "ensemble", "variable", "prediction","unit".
get_seasonal_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 30, past_days = 5, variables = glm_variables(product = "seasonal_forecast", time_step = "6hourly"))
get_seasonal_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 30, past_days = 5, variables = glm_variables(product = "seasonal_forecast", time_step = "6hourly"))
Get set of variables required for the GLM model
glm_variables(product, time_step)
glm_variables(product, time_step)
product |
api type: climate, forecast, ensemble_forecast, historical, seasonal_forecast |
time_step |
model and time-step: hourly, 6hour, daily |
a vector of variables requires by the GLM model; the vector can be used in the variables
argument in the API function calls (e.g., get_ensemble_forecast
).
glm_variables(product = "ensemble_forecast", time_step = "hourly")
glm_variables(product = "ensemble_forecast", time_step = "hourly")
Convert 6 hour seasonal forecast to hourly time-step
six_hourly_to_hourly(df, latitude, longitude, use_solar_geom = TRUE)
six_hourly_to_hourly(df, latitude, longitude, use_solar_geom = TRUE)
df |
data frame with 6-hour time step |
latitude |
latitude degree north |
longitude |
long longitude degree east |
use_solar_geom |
use solar geometry to determine hourly solar radiation |
data frame with an hourly time step
get_seasonal_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 30, past_days = 5, variables = glm_variables(product = "seasonal_forecast", time_step = "6hourly")) |> six_hourly_to_hourly( latitude = 37.30, longitude = -79.83, use_solar_geom = TRUE)
get_seasonal_forecast( latitude = 37.30, longitude = -79.83, forecast_days = 30, past_days = 5, variables = glm_variables(product = "seasonal_forecast", time_step = "6hourly")) |> six_hourly_to_hourly( latitude = 37.30, longitude = -79.83, use_solar_geom = TRUE)
Write ensemble forecast dataframe to General Lake Model formatted csv files
write_glm_format(df, path)
write_glm_format(df, path)
df |
data frame output by |
path |
directory where csv files will be written |
No return value, called to generate csv files in the GLM required format
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave() |> write_glm_format(path = path)
file <- system.file("extdata", "test-data.csv", package="ropenmeteo") df <- readr::read_csv(file, show_col_types = FALSE) df |> add_longwave() |> write_glm_format(path = path)