Skip to contents

Writes a text file in the ADMS format to a location of the user's choosing, with optional interpolation of missing values. At present this function only works with data from import_isd_hourly(); it will later be expanded to work with import_ghcn_hourly() also.

Usage

write_met(
  x,
  path = ".",
  ext = c("rds", "delim", "parquet"),
  delim = ",",
  suffix = "",
  progress = rlang::is_interactive()
)

Arguments

x

A data frame imported by import_isd_hourly(), import_ghcn_hourly(), or import_ghcn_daily().

path

The path to a directory to save each file. By default, this is the working directory.

ext

The file type to use when saving the data. Can be "rds", "delim" or "parquet". Note that "parquet" requires the arrow package.

delim

Delimiter used to separate values when ext = "delim". Must be a single character. Defaults to being comma-delimited (",").

suffix

An additional suffix to append to file names. Useful examples could be "_ISD", "_hourly", "_lite", and so on.

progress

Show a progress bar when writing many stations/years? Defaults to TRUE in interactive R sessions. Passed to .progress in purrr::walk().

Value

write_met() returns path invisibly.

See also

Other Met writing functions: write_adms()

Examples

if (FALSE) { # \dontrun{
# import some data then export it
dat <- import_isd_hourly(year = 2012)
write_met(dat)
} # }