HypeSingleVar: HypeSingleVar arrays

View source: R/class_HypeSingleVar.R

HypeSingleVarR 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 array with three dimensions, which holds HYPE results for one variable as (in order) [datetime, subid/outregid, iteration].

datetime

POSIXct date-time vector of the same length as time dimension of x with equidistant time steps (starting day for time steps from weekly to annual), or character string for full model period averages, e.g. "2000-2010".

subid

Integer vector with HYPE sub-basin IDs, of the same length as subid dimension of x. Either this or outregid must be supplied.

outregid

Integer vector with HYPE output region IDs, alternative to subid.

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))


rcapell/HYPEtools documentation built on Feb. 28, 2024, 2:29 p.m.