This function prepares text files for a SWAT+ model to represent point source data. It is designed for simple cases with yearly values, where point sources discharge to a single channel.
Usage
prepare_ps(
pt_lst,
project_path,
constant = FALSE,
write_path = NULL,
cha_shape_path = FALSE
)
Arguments
- pt_lst
Nested list with dataframes. Nested structure:
pt_lst -> data -> Dataframe (name, DATE, flo, ...)
,pt_lst -> st -> Dataframe (name, Lat, Long)
. Additional information on the input variables, which could be used in the template files can be found in the SWAT+ documentation: 'filename'.rec Point source data can be loaded withload_template
function using 'xlsx' template file.- project_path
Character, path to the SWAT+ project folder (example "my_model").
- constant
(optional) Logical, if TRUE, point source data will be constant in model. Default
constant = FALSE
.- write_path
(optional) Character, path to SWAT+ txtinout folder (example "my_model"). Default
write_path = NULL
, which is the same asproject_path
.- cha_shape_path
(optional) Character, path to SWAT+ channel shapefile. 'id' column should be present in attributes with numeric values representing channel ids corresponding to ids in 'chandeg.con' file. Default
cha_shape_path = FALSE
, which assigns point sources to nearest center point in 'chandeg.con'. To activate this parameter provide path to reach file, examplecha_shape_path = "my_path/my_channel_shape.shp"
, point sources will be assigned to nearest channel line.
Examples
if (FALSE) {
# Example usage:
temp_path <- system.file("extdata", "pnt_data.xls", package = "SWATprepR")
pnt_data <- load_template(temp_path)
prepare_pt_source(pnt_data, "my_model")
}