Skip to contents

write_weather takes an input data.frame containing weather data and writes a '*.wth' CENTURY file on disk.

Usage

write_weather(
  df,
  pathname = pathname,
  filename = filename,
  overwrite = FALSE,
  sep = "      ",
  ndigits = 6
)

Arguments

df

data.frame containing weather data (precipitation, maximum and minimum temperature).

overwrite

logical indicating whether to overwrite 'fileout' if it already exists on disk. Default is 'TRUE'.

sep

character string to separate columns by in 'fileout'. Default is an empty character string of length 7.

ndigits

numeric indicating the number of decimal digits in output file. Default is 3.

fileout

character string with the name (without extension) of the weather file to be created.

wd

character string with the name of a valid directory to save the weather file. Default is the local folder.

verbose

logical indicating whether to print out informative messages. Default is 'TRUE'.

Value

NULL is returned and fileout is written on disk.

Details

The input data.frame is pivoted from long to wide format to fit CENTURY requirements.

Examples

df<- data.frame(month = rep(1:12, 2),
  year = rep(c(2020, 2021), each = 12),
  prec = runif(24)*500 + 100,
  tmin = rnorm(24, mean = 5),
  tmax = rnorm(24, mean = 15))
century_weather(df, "nothing")
#> Error in century_weather(df, "nothing"): could not find function "century_weather"