write_input_swat2012_other: Write out default SWAT 2012 meteorology input file

Description Usage Arguments Examples

Description

Write out default SWAT 2012 meteorology input file

Usage

1
2
write_input_swat2012_other(file, data, station_names, type,
  col_time_name = "time_posix")

Arguments

file

string: directory + file name of output file

data

data.frame: contains a column with time stamp and >=1 columns with data; time column needs to be of type POSIXct

station_names

character-array: contains names of the stations to write out; have to be equal to column names of data

type

character: file type ('wnd', 'slr', 'hmd'); only used in the header row

col_time_name

character, optional: name of the time stamp column, default = 'time_posix'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# see example in README

explanation of the following command:
  - make time column:
      format(data[[time_name]],"%Y%m%d")
  - format the individual values of the data column:
      formatC(as.matrix(data[station_names]), format='f', width=8, digits=3, flag='0')
     We need 'as.matrix' because my_data is a data frame. formatC cannot be applied to a 2d data frame.
  - append all formatted data values in one row:
      apply(formatC(...), 1, paste0, collapse = '')

neumannd/eurocordex2swatTools documentation built on May 14, 2019, 2:17 p.m.