write_sef {dataresqc} | R Documentation |
Write data in Station Exchange Format version 1.0.0
Description
Write data in Station Exchange Format version 1.0.0
Usage
write_sef(
Data,
outpath,
variable,
cod,
nam = "",
lat = "",
lon = "",
alt = "",
sou = "",
link = "",
units,
stat,
metaHead = "",
meta = "",
period = "",
time_offset = 0,
note = "",
keep_na = FALSE,
outfile = NA
)
Arguments
Data |
A data frame with 6 variables in this order: year, month, day, hour, minute, value. |
outpath |
Character string giving the output path (note that the filename is generated from the source identifier, station code, start and end dates, and variable code). |
variable |
Variable code. This is a required field. |
cod |
Station code. This is a required field. |
nam |
Station name. |
lat |
Station latitude (degrees North in decimal). |
lon |
Station longitude (degreees East in decimal). |
alt |
Station altitude (metres). |
sou |
Character string giving the source identifier. |
link |
Character string giving an url for metadata (e.g., link to the C3S Data Rescue registry). |
units |
Character string giving the units. This is a required field. |
stat |
Character string giving the statistic code. This is a required field. |
metaHead |
Character string giving metadata entries for the header (pipe separated). |
meta |
Character vector with length equal to the number of rows
of |
period |
Observation time period code. Must be a character vector with
length equal to the number of rows of |
time_offset |
Numerical vector of offsets from UTC in hours. This value will be subtracted from the observation times to obtain UTC times, so for instance the offset of Central European Time is +1 hour. Recycled for all observations if only one value is given. |
note |
Character string to be added to the end of the standard output filename. It will be separated from the rest of the name by an underscore. Blanks will be also replaced by underscores. |
keep_na |
If FALSE (the default), lines where observations are NA are removed. |
outfile |
Output filename. If specified, ignores |
Note
Times in SEF files must be expressed in UTC.
If outfile
is not specified, the output filename is generated
automatically as sou
_cod
_startdate_enddate_variable
.tsv
Author(s)
Yuri Brugnara
Examples
# Create a basic SEF file for air temperature in Bern
# (assuming the observation times are in mean local solar time)
meta_bern <- Meta$ta[which(Meta$ta$id == "Bern"), ]
write_sef(Bern$ta[, 2:7], outpath = tempdir(), variable = "ta",
cod = meta_bern$id, nam = "Bern", lat = meta_bern$lat,
lon = meta_bern$lon, alt = meta_bern$alt,
units = meta_bern$units, stat = "point", period = "0",
time_offset = meta_bern$lon * 24 / 360)