Skip to contents

This function generates a Plotly figure for weather data visualization based on user-defined parameters.

Usage

plot_weather(meteo_lst, par, period = "day", fn_summarize = "mean")

Arguments

meteo_lst

A nested list with dataframes. Nested structure: meteo_lst -> data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER), meteo_lst -> stations -> Dataframe (ID, Name, Elevation, Source, geometry, Long, Lat).

meteo_lst can be created using load_template function using 'xlsx' template file or it could to be created with load_swat_weather function loading information from SWAT+ model setup weather files.

par

Character, the weather variable to extract (e.g., "PCP", "SLR").

period

(optional) Character describing the time interval to display. Default period = "day", other examples are "week", "month", "year". See lubridate::floor_date for details.

fn_summarize

(optional) Function to recalculate to the specified time interval. Default fn_summarize ="mean", other examples are "median", "sum". See dplyr::summarise for details.

Value

Plotly figure object with displayed weather data.

Examples

if (FALSE) {
temp_path <- system.file("extdata", "weather_data.xlsx", package = "SWATprepR")
met_lst <- load_template(temp_path, 4326)
plot_weather(met_lst, "PCP", "month", "sum")
}