Plotting figure to comparing two datasets with weather data
Source:R/plotting.R
plot_weather_compare.Rd
Plotting figure to comparing two datasets with weather data
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 of lists with dataframes. Nested structure meteo_lst -> data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER).
- meteo_lst2
second nested list of lists with dataframes. Nested structure meteo_lst -> data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER).
- par
character marking weather variable to extract (i.e. "PCP", "SLR", etc).
- period
character describing, which time interval to display (default is "day", other examples are "week", "month", etc).
- fn_summarize
function to recalculate to time interval (default is "mean", other examples are "median", "sum", etc).
- name_set1
character to name first dataset.
- name_set2
character to name second dataset.
Examples
temp_path <- system.file("extdata", "weather_data.xlsx", package = "svatools")
met_lst1 <- load_template(temp_path, 4326)
#> [1] "Loading data from template."
#> [1] "Reading station ID9 data."
#> [1] "Reading station ID3 data."
#> [1] "Reading station ID10 data."
#> [1] "Reading station ID11 data."
#> [1] "Reading station ID12 data."
#> [1] "Reading station ID13 data."
#> [1] "Reading station ID1 data."
#> [1] "Reading station ID8 data."
#> [1] "Reading station ID2 data."
#> [1] "Reading station ID4 data."
#> [1] "Reading station ID5 data."
#> [1] "Reading station ID6 data."
#> [1] "Reading station ID7 data."
#> [1] "Reading station ID14 data."
#> [1] "Loading of data is finished."
temp_path <- system.file("extdata", "weather_data_raw.xlsx", package = "svatools")
met_lst2 <- load_template(temp_path, 4326)
#> [1] "Loading data from template."
#> [1] "Reading station ID9 data."
#> Warning: RELHUM variable values at station ID9 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> Warning: PCP variable values at station ID9 should be between 0 and 1825 mm/d (maximum 1-day recorded rainfall). Please check, correct your input data and reload template!!!
#> [1] "Reading station ID3 data."
#> Warning: RELHUM variable values at station ID3 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> [1] "Reading station ID10 data."
#> Warning: RELHUM variable values at station ID10 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> [1] "Reading station ID11 data."
#> [1] "Reading station ID12 data."
#> Warning: RELHUM variable values at station ID12 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> [1] "Reading station ID13 data."
#> Warning: RELHUM variable values at station ID13 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> [1] "Reading station ID1 data."
#> Warning: RELHUM variable values at station ID1 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> [1] "Reading station ID8 data."
#> Warning: RELHUM variable values at station ID8 should be between 0 and 1. Please check, correct your input data and reload template!!!
#> Warning: WNDSPD variable values at station ID8 should be between 0 and 104 m/s (the highest recorded natural surface wind velocity). Please check, correct your input data and reload template!!!
#> [1] "Reading station ID2 data."
#> [1] "Reading station ID4 data."
#> [1] "Reading station ID5 data."
#> [1] "Reading station ID6 data."
#> [1] "Reading station ID7 data."
#> [1] "Loading of data is finished."
plot_weather_compare(met_lst1, met_lst2, "PCP", "month", "mean", "clean", "raw")
#> Warning: n too large, allowed maximum for palette Set2 is 8
#> Returning the palette you asked for with that many colors
#> Warning: n too large, allowed maximum for palette Set2 is 8
#> Returning the palette you asked for with that many colors
#> Warning: n too large, allowed maximum for palette Set2 is 8
#> Returning the palette you asked for with that many colors
#> Warning: n too large, allowed maximum for palette Set2 is 8
#> Returning the palette you asked for with that many colors