read.swat: Reads in a SWAT output file

Description Usage Arguments Value Author(s) See Also Examples

View source: R/read.swat.R

Description

Reads a SWAT output file of the *.rch (reach), *.sub, and *.hru formats. Currently, only the formats as documented in the SWAT 2012 handbook are supported.

Usage

1
2
read.swat(filename, filetype = substr(filename, nchar(filename) - 2,
  nchar(filename)), version = 2016, variables = NULL)

Arguments

filename

character: name of the SWAT file

filetype

character: official file extension of SWAT output file ('rch', 'sub', 'hru')

version

integer/numeric: SWAT output version, only 2012 and 2016 (equal) are implemented

variables

character array of variable names (==columns) to read in from the file; if == NULL [default], all variables are read

Value

list containing a data.frame (out$data), a character array (out$units), and two character variables (out$format and out$tstep). The first contains the actual data formatted as a data.frame. The second contains the units to the corresponding columns of the data.frame. The third contains the source/format of data (here: 'swat'; can also be 'mom'). The fourth contains information on the time step of the data (resp.: on which time interval they are averaged).

The data.frame out$data which contains the data from the file 'filename'; column names of as.data.frame should be equal to column names in the reach file; only variables/columns listed in 'variables' are returned;

Author(s)

Daniel Neumann, daniel.neumann@io-warnemuende.de

See Also

read.swat.data.rch.2012, read.river.mom

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  
  # read in a swat *.rch (reach) file
  data.swat <- read.swat('output.rch')
  
  # read in a swat *.sub file
  data.swat <- read.swat('output.sub')
  # NOTE: not implemented yet
  
  # read in a swat reach file with another file extension
  data.swat <- read.swat('output.txt', filetype = 'rch')
  
  # read in specific variables of a swat *.rch (reach) file
  data.swat <- read.swat('output.rch', variables = c('NO3_OUT', 'NH4_OUT'))
  # NOTE: not implemented yet
  

neumannd/riverdata documentation built on March 4, 2020, 4:22 a.m.