Skip to contents

Interpolating and writing results into model input files

Usage

interpolate(
  meteo_lst,
  catchment_boundary_path,
  dem_data_path,
  grid_spacing,
  p_vector = c("PCP", "SLR", "RELHUM", "WNDSPD", "TMP_MAX", "TMP_MIN"),
  idw_exponent = 2
)

Arguments

meteo_lst

nested list of lists with dataframes. Nested structure meteo_lst -> data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER).

catchment_boundary_path

path to basin boundary shape file.

dem_data_path

path to DEM raster data in same projection as weather station.

grid_spacing

numeric value for distance in grid. Units of coordinate system should be used.

p_vector

character vector representing weather variables to interpolate (optional, default all variables selected c("PCP", "SLR", "RELHUM", "WNDSPD", "TMP_MAX", "TMP_MIN" ).

idw_exponent

numeric value for exponent parameter to be used in interpolation (optional, default value is 2).

Value

nested list of lists with dataframes for interpolation results. Nested structure lst -> data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER). Function also writes all SWAT weather text input files from the interpolation results.

Examples

if (FALSE) {
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)
interpolate(met_lst, basin_path, DEM_path, 2000) 
}