Description Usage Arguments Examples
Write out min-max temperature SWAT 2012 meteorology input file
1 2 3 | write_input_swat2012_tmp(file, data_min, data_max, stations, station_names,
col_time_name = "time_posix", col_station_name = "station_name",
col_lon = "lon", col_lat = "lat", col_elev = "elev")
|
file |
string: directory + file name of output file |
data_min |
data.frame: minimum temperature [deg C]; contains a column with time stamp and >=1 columns with data; time column needs to be of type POSIXct |
data_max |
data.frame: maximum temperature [deg C]; contains a column with time stamp and >=1 columns with data; time column needs to be of type POSIXct |
stations |
data.frame : contains station information in four columns: station name, lon coordinate, lat coordinate, and elevation |
station_names |
character-array: contains names of the stations to write out; have to be equal to column names of data |
col_time_name |
character, optional: name of the time stamp column in 'data', default = 'time_posix' |
col_station_name |
character, optional: name of the station names column in 'stations', default = 'station_name' |
col_lon |
character, optional: name of the longitude column in 'stations', default = 'lon' |
col_lat |
character, optional: name of the latitude column in 'stations', default = 'lat' |
col_elev |
character, optional: name of the elevation column in 'stations', default = 'elev' |
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(my_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 = '')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.