Learn R Programming

worldmet (version 1.0.0)

write_met: Export a meteorological data frame in files, chunked by site and year

Description

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()
)

Value

write_met() returns path invisibly.

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().

See Also

Other Met writing functions: write_adms()

Examples

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

Run the code above in your browser using DataLab