View source: R/class_HypeSingleVar.R
HypeSingleVar | R Documentation |
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.
HypeSingleVar(x, datetime, subid = NULL, outregid = NULL, hype.var)
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. |
S3 class constructor function for array objects which can hold (multiple) HYPE time or map output results.
Returns a 3-dimensional array with
[time, subid, iteration]
dimensions and additional attributes
:
A vector of date-times. Corresponds to 1st array dimension.
A vector of SUBIDs. Corresponds to 2nd array dimension (NA
, if it does not apply to data contents).
A vector of OUTREGIDs. Corresponds to 2nd array dimension (NA
, if it does not apply to data contents).
HYPE output variable ID.
A character keyword for the time step.
# 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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.