ReadMapOutput {HYPEtools} | R Documentation |
Read a Map Output File
Description
This is a convenience wrapper function to import a map output file ('map<HYPE_output_variable>.txt') into R.
Usage
ReadMapOutput(
filename,
dt.format = NULL,
hype.var = NULL,
type = c("df", "dt", "hsv"),
warn.nan = FALSE,
col.prefix = "X"
)
Arguments
filename |
Path to and file name of the map output file to import. Windows users: Note that Paths are separated by '/', not '\'. |
dt.format |
Date-time |
hype.var |
Character string, a four-letter keyword to specify HYPE variable ID of file contents. See
list of HYPE variables.
If |
type |
Character, keyword for data type to return. |
warn.nan |
Logical, check if imported results contain any |
col.prefix |
String, prefix added to mapoutput column names. Default is |
Details
ReadMapOutput
is a convenience wrapper function of fread
from package
data.table
,
with conversion of date-time strings to POSIX time representations. Monthly and annual time steps are returned as first day
of the time step period.
Value
ReadMapOutput
returns a data.frame
, data.table
, or a HypeSingleVar
array.
Data frames and data tables contain additional attributes
: variable
, giving the HYPE variable ID,
date
, a vector of date-times (corresponding to columns from column 2), timestep
with a time step attribute,
and comment
with the first line of the imported file as text string. An additional attribute subid.nan
might be
returned, see argument warn.nan
.
Note
HYPE results are printed to files using a user-specified accuracy. This accuracy is specified in 'info.txt' as a number of
decimals to print. If large numbers are printed, this can result in a total number of digits which is too large to print.
Results will then contain values of '****************'. ReadMapOutput
will convert those cases to 'NA' entries.
Current versions of HYPE allow for defining significant instead of fixed number of digits, which should prevent this issue from arising.
Examples
te <- ReadMapOutput(filename = system.file("demo_model",
"results", "mapEVAP.txt", package = "HYPEtools"), dt.format = NULL)
te