Skip to contents

This function generates a Plotly figure to compare weather data between two datasets based on user-defined parameters.

Usage

plot_weather_compare(
  meteo_lst1,
  meteo_lst2,
  par,
  period = "day",
  fn_summarize = "mean",
  name_set1 = "dataset 1",
  name_set2 = "dataset 2"
)

Arguments

meteo_lst1

First 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.

meteo_lst2

Second nested list with dataframes. Same structure as meteo_lst1.

par

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

period

(optional) Character, 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.

name_set1

(optional) Character, to name the first dataset. Default name_set1 = "dataset 1".

name_set2

(optional) Character, to name the second dataset. Default name_set2 = "dataset 2".

Value

Plotly figure object with displayed weather data for two datasets.

Examples

if (FALSE) {
##Loading data
temp_path1 <- system.file("extdata", "weather_data.xlsx", package = "SWATprepR")
met_lst1 <- load_template(temp_path1)
temp_path2 <- system.file("extdata", "weather_data_raw.xlsx", package = "SWATprepR")
met_lst2 <- load_template(temp_path2)
##Plotting
plot_weather_compare(met_lst1, met_lst2, "PCP", "month", "mean", "clean", "raw")
}