Skip to contents

Update sqlite database with weather data

Usage

add_weather(db_path, meteo_lst, wgn_lst, fill_missing = TRUE)

Arguments

db_path

character to sqlite database (example "./output/project.sqlite")

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

wgn_lst

list of two dataframes: wgn_st - wgn station data, wgn_data - wgn data (prepared by prepare_wgn() function).

fill_missing

Boolean, TRUE - fill data for missing stations with data from closest stations with available data. FALSE - leave stations without data. Weather generator will be used to fill missing variables for a model. Optional (Default = TRUE).

Value

updated sqlite database with weather data

Examples

if (FALSE) {
##Getting meteo data from template
met_lst <- load_template(temp_path, 3035)
##Calculating wgn parameters
wgn <- prepare_wgn(met_lst, MAXHHR = met_lst$data$ID11$MAXHHR)
##Writing weather input into model database
db_path <- "./output/test/project.sqlite"
add_weather(db_path, met_lst, wgn)
}