Skip to contents

Function to generate wgn data for the model

Usage

prepare_wgn(
  meteo_lst,
  TMP_MAX = NULL,
  TMP_MIN = NULL,
  PCP = NULL,
  RELHUM = NULL,
  WNDSPD = NULL,
  MAXHHR = NULL,
  SLR = NULL
)

Arguments

meteo_lst

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

TMP_MAX

dataframe with two columns: DATE : POSIXct, TMP_MAX : num. Optional (default NULL). This parameter refers to data, which should be used instead, if TMP_MAX variable is missing for a station.

TMP_MIN

dataframe with two columns: DATE : POSIXct, TMP_MIN : num. Optional (default NULL). This parameter refers to data, which should be used instead, if TMP_MIN is missing for a station.

PCP

dataframe with two columns: DATE : POSIXct, PCP : num. Optional (default NULL). This parameter refers to data, which should be used instead, if PCP is missing for a station.

RELHUM

dataframe with two columns: DATE : POSIXct, RELHUM : num. Optional (default NULL). This parameter refers to data, which should be used instead, if RELHUM is missing for a station.

WNDSPD

dataframe with two columns: DATE : POSIXct, WNDSPD : num. Optional (default NULL). This parameter refers to data, which should be used instead, if WNDSPD is missing for a station.

MAXHHR

dataframe with two columns: DATE : POSIXct, MAXHHR : num. Optional (default NULL). This parameter refers to data, which should be used instead, if MAXHHR is missing for a station.

SLR

dataframe with two columns: DATE : POSIXct, SLR : num. Optional (default NULL). This parameter refers to data, which should be used instead, if SLR is missing for a station.

Value

list of two dataframes: wgn_st - wgn station data, wgn_data - wgn data

Examples

if (FALSE) {
temp_path <- system.file("extdata", "weather_data.xlsx", package = "svatools")
met_lst <- load_template(temp_path, 3035)
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$ID12$WNDSPD
MAXHHR <- met_lst$data$ID11$MAXHHR
SLR <- met_lst$data$ID9$SLR
##Does the thing
wgn <- prepare_wgn(met_lst, TMP_MAX, TMP_MIN, PCP, RELHUM, WNDSPD, MAXHHR, SLR)
}