Reads one or more SWAT `.pcp` files containing daily precipitation data and associated metadata for precipitation gauges such as station IDs, subbasins, and their latitude, longitude, and elevation. These files use a fixed-width format: the first four lines store station IDs and metadata, and the remaining lines contain daily values (year, day of year, and precipitation for each station).
Value
A list with two tibbles:
gauges: Metadata for each gauge (subbasin, station ID, latitude, longitude, elevation).pcp: Daily precipitation (year, day of year, and values for each station).
See also
Other Output readers:
get_swat_vars(),
output_hru(),
output_rch(),
output_sub(),
read_tmp()
Examples
# Example with package data
tmpdir <- tempdir()
get_swat_example(tmpdir)
pcp_file <- file.path(tmpdir, "TxtInOut", "pcp1.pcp")
pcp_data <- read_pcp(pcp_file)
head(pcp_data$gauges)
head(pcp_data$pcp)
if (FALSE) { # \dontrun{
# Example with external files
pcp_files <- list.files("path/to/TxtInOut", pattern = "\\.pcp$", full.names=TRUE)
pcp_data <- read_pcp(pcp_files)
} # }