Skip to contents

Transforming list of sp dataframes to list of list

Usage

transform_to_list(list_sp, start_date, end_date)

Arguments

list_sp

a list of SpatialPointsDataFrames (for each weather variable) prepared with interpolate function.

start_date

time series starting date string. Example "1998-01-01".

end_date

time series ending date string. Example "2021-12-31".

Value

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

Examples

if (FALSE) {
###First step to get interpolation results
temp_path <- system.file("extdata", "weather_data.xlsx", package = "svatools")
DEM_path <- system.file("extdata", "GIS/DEM.tif", package = "svatools")
basin_path <- system.file("extdata", "GIS/basin.shp", package = "svatools")
met_lst <- load_template(temp_path, 3035)
result <- interpolate(met_lst, "./output/",  basin_path, DEM_path, 2000) 

###Second step converting interpolation results to list of list format.
start_date <- svatools:::get_dates(met_lst)$min_date
end_date <- svatools:::get_dates(met_lst)$max_date
int_met_lst <- transform_to_list(result, start_date, end_date)
}