Function to prepare user soil table for SWAT model
Arguments
- csv_path
character path to csv file (example "usersoil_lrew.csv"). File should be comma separated with minimum columns of SNAM, NLAYERS and SOL_Z, CLAY, SILT, SAND, SOL_CBN for each available soil layer (minimum 1).
- hsg
Boolean, TRUE - prepare soil hydrological groups, FALSE - no soil hydrological group preparation will be done. Optional (
Default = FALSE
). Ifhsg = TRUE
three additional columns should be in an input table: Impervious (allowed values are "<50cm", "50-100cm", ">100cm"), Depth (allowed values are "<60cm", "60-100cm", ">100cm") and Drained (allowed values are "Y" for drained areas, "N" for areas without working tile drains). More information can be found in the SWAT+ modeling protocol Table 3.3.- keep_values
Boolean or character vector, TRUE - keep old values (new values only will be left where 0 or NA values are present in an input table), FALSE - keep only new values. Character vector also could be used to keep only specified columns. For instance, c("HYDGRP", "ROCK1") would keep values of soil hydro groups and rock data for the first layer, while c("HYDGRP", "ROCK") would keep values in all rock data columns. Optional (
Default = FALSE
).- nb_lyr
integer, number of layers resulting user soil data should contain. Optional (
Default = NA
, which stands for the same number as in input data).
Examples
if (FALSE) {
usersoils <- get_usersoil_table("table.csv")
write.csv(usersoils, "usersoils.csv", row.names=FALSE, quote=FALSE)
}