WriteObs {HYPEtools} | R Documentation |
Write 'Pobs.txt', 'Tobs.txt', 'Qobs.txt', and other observation data files
Description
Export forcing data and discharge observation files from R.
Usage
WriteObs(
x,
filename,
dt.format = "%Y-%m-%d",
round = NULL,
signif = NULL,
obsid = NULL,
append = FALSE
)
WritePTQobs(
x,
filename,
dt.format = "%Y-%m-%d",
round = NULL,
signif = NULL,
obsid = NULL,
append = FALSE
)
Arguments
x |
The object to be written, a |
filename |
Path to and file name of the file to import. Windows users: Note that Paths are separated by '/', not '\'. |
dt.format |
Date-time |
round , signif |
Integer, number of decimal places and number of significant digits to export, respectively. See |
obsid |
Integer vector containing observation IDs/SUBIDs in same order as columns in |
append |
Logical, if |
Details
WriteObs
is a convenience wrapper function of fwrite
to export a HYPE-compliant observation file.
Headers are generated from attribute obsid
on export (see attr
on how to create and access it).
Observation IDs are SUBIDs or IDs connected to SUBIDs with a ForcKey.txt file.
If the first column in x
contains dates of class POSIXt
, then they will be formatted according to dt.format
before writing the output file.
If round
is specified, then WriteObs()
will use round
to round the observation values to a specified number of decimal places.
Alternatively, signif
can be used to round the observation values to a specified number of significant digits using signif
.
Finally, if both round
and signif
are specified, then the observation values will be first rounded to the number of decimal places specified
with round
and then rounded to the number of significant digits specified with signif
.
Value
No return value, called for export to text files.
See Also
Examples
te <- ReadObs(filename = system.file("demo_model", "Tobs.txt", package = "HYPEtools"))
WriteObs(x = te, filename = tempfile())