HypeSingleVar {HYPEtools} | R Documentation |
HypeSingleVar arrays
Description
Constructor function for arrays which hold equidistant time series of a single HYPE variable for multiple sub-basins and multiple model runs, typically imported time and map output results.
Usage
HypeSingleVar(x, datetime, subid = NULL, outregid = NULL, hype.var)
Arguments
x |
numeric |
datetime |
|
subid |
Integer vector with HYPE sub-basin IDs, of the same length as |
outregid |
Integer vector with HYPE output region IDs, alternative to |
hype.var |
Character string, keyword to specify HYPE variable ID, see list of HYPE variable. Not case-sensitive. |
Details
S3 class constructor function for array objects which can hold (multiple) HYPE time or map output results.
Value
Returns a 3-dimensional array with
[time, subid, iteration]
dimensions and additional attributes
:
- datetime
A vector of date-times. Corresponds to 1st array dimension.
- subid
A vector of SUBIDs. Corresponds to 2nd array dimension (
NA
, if it does not apply to data contents).- outregid
A vector of OUTREGIDs. Corresponds to 2nd array dimension (
NA
, if it does not apply to data contents).- variable
HYPE output variable ID.
- timestep
A character keyword for the time step.
Examples
# Import a time output file
te1 <- ReadTimeOutput(filename = system.file("demo_model", "results",
"timeCOUT.txt", package = "HYPEtools"), dt.format = "%Y-%m")
# Create a dummy array with two iterations from imported time file
te2 <- array(data = c(unlist(te1[, -1]), unlist(te1[, -1])),
dim = c(nrow(te1), ncol(te1) - 1, 2),
dimnames = list(rownames(te1), colnames(te1)[-1]))
# Construct HypeSingleVar array
HypeSingleVar(x = te2, datetime = te1$DATE,
subid = subid(te1), hype.var = variable(te1))