Skip to contents

Reads one or more SWAT `.tmp` files containing daily maximum and minimum temperature data and associated metadata for temperature 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 maximum and minimum temperatures for each station).

Usage

read_tmp(tmp)

Arguments

tmp

Character vector with paths to one or more `.tmp` files in SWAT format.

Value

A list with three tibbles:

  • gauges: Metadata for each gauge (subbasin, station ID, latitude, longitude, elevation).

  • tmax: Daily maximum temperature (year, day of year, values for each station).

  • tmin: Daily minimum temperature (year, day of year, values for each station).

See also

Other Output readers: get_swat_vars(), output_hru(), output_rch(), output_sub(), read_pcp()

Examples

# Example with package data
tmpdir <- tempdir()
get_swat_example(tmpdir)
tmp_file <- file.path(tmpdir, "TxtInOut", "tmp1.tmp")
tmp_data <- read_tmp(tmp_file)
head(tmp_data$gauges)
head(tmp_data$tmax)
head(tmp_data$tmin)

if (FALSE) { # \dontrun{
# Example with external files
tmp_files <- list.files("path/to/TxtInOut", pattern = "\\.tmp$", full.names=TRUE)
tmp_data <- read_tmp(tmp_files)
} # }