This function generates weather generator (WGN) data for a SWAT+ model based on meteorological data.
Usage
prepare_wgn(
meteo_lst,
TMP_MAX = NULL,
TMP_MIN = NULL,
PCP = NULL,
RELHUM = NULL,
WNDSPD = NULL,
MAXHHR = NULL,
SLR = NULL
)
Arguments
- meteo_lst
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 usingload_template
function using 'xlsx' template file or it could to be created withload_swat_weather
function loading information from SWAT+ model setup weather files.- TMP_MAX
(optional) Dataframe with two columns: DATE : POSIXct, TMP_MAX : num. This parameter refers to data, which should be used instead if TMP_MAX variable is missing for a station. Default
TMP_MAX = NULL
, data of the closest station with data will be used. Units: Celsius.- TMP_MIN
(optional) Dataframe with two columns: DATE : POSIXct, TMP_MIN : num. This parameter refers to data, which should be used instead if TMP_MIN variable is missing for a station. Default
TMP_MIN = NULL
, indicating that data of the closest station with data will be used. Units: Celsius.- PCP
(optional) Dataframe with two columns: DATE : POSIXct, PCP : num. This parameter refers to data, which should be used instead if PCP variable is missing for a station. Default
PCP = NULL
, indicating that data of the closest station with data will be used. Units: mm/day.- RELHUM
(optional) Dataframe with two columns: DATE : POSIXct, RELHUM : num. This parameter refers to data, which should be used instead if RELHUM variable is missing for a station. Default
RELHUM = NULL
, indicating that data of the closest station with data will be used. Units: ratio 0-1.- WNDSPD
(optional) Dataframe with two columns: DATE : POSIXct, WNDSPD : num. This parameter refers to data, which should be used instead if WNDSPD variable is missing for a station. Default
WNDSPD = NULL
, indicating that data of the closest station with data will be used. Units: m/s.- MAXHHR
(optional) Dataframe with two columns: DATE : POSIXct, MAXHHR : num. This parameter refers to data, which should be used instead if MAXHHR variable is missing for a station. Default
MAXHHR = NULL
, indicating that data of the closest station with data will be used. Units: mm.- SLR
(optional) Dataframe with two columns: DATE : POSIXct, SLR : num. This parameter refers to data, which should be used instead if SLR variable is missing for a station. Default
SLR = NULL
, indicating that data of the closest station with data will be used. Units: MJ/m2.
Examples
if (FALSE) {
# Example usage:
temp_path <- system.file("extdata", "weather_data.xlsx", package = "SWATprepR")
met_lst <- load_template(temp_path, 3035)
# Generate WGN data
wgn <- prepare_wgn(met_lst,
TMP_MAX = met_lst$data$ID10$TMP_MAX,
TMP_MIN = met_lst$data$ID10$TMP_MIN,
PCP = met_lst$data$ID9$PCP,
RELHUM = met_lst$data$ID9$RELHUM,
WNDSPD = met_lst$data$ID10$WNDSPD,
MAXHHR = met_lst$data$ID11$MAXHHR,
SLR = met_lst$data$ID9$SLR)
}