HypeMultiVar: HypeMultiVar arrays

View source: R/class_HypeMultiVar.R

HypeMultiVarR Documentation

HypeMultiVar arrays

Description

Constructor function for arrays which hold equidistant time series of multiple HYPE variables for a single sub-basin and multiple model runs, typically imported HYPE basin output results.

Usage

HypeMultiVar(
  x,
  datetime,
  hype.var,
  hype.unit,
  subid = NULL,
  outregid = NULL,
  hype.comment = ""
)

Arguments

x

numeric array with three dimensions, which holds HYPE results for one sub-basin as (in order) [datetime, variable, 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".

hype.var, hype.unit

Character vectors of keywords to specify HYPE variable IDs, corresponding to second dimension (columns) in x. See list of HYPE variables

subid

Integer, HYPE sub-basin ID. Either this or outregid needs to be supplied.

outregid

Integer, HYPE output region ID, alternative to subid.

hype.comment

Character, first-row optional comment string of basin output file. Empty string, if non-existing.

Details

S3 class constructor function for array objects which can hold (multiple) HYPE basin output results.

Value

Returns a 3-dimensional array with [time, variable, iteration] dimensions and additional attributes:

datetime

A vector of date-times. Corresponds to 1st array dimension.

variable

A character vector of HYPE output variable IDs.

hypeunit

A character vector of HYPE output variable units.

subid

A single SUBID.

outregid

A single OUTREGID.

timestep

A character keyword for the time step.

comment

A comment string, currently used for class group outputs.

Examples

# import a basin output file
te1 <- ReadBasinOutput(filename = system.file("demo_model",
"results", "0003587.txt", package = "HYPEtools"))
# create a dummy array with two iterations from imported basin 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 HypeMultiVar array
HypeMultiVar(te2, datetime = te1$DATE, hype.var = variable(te1),
hype.unit = hypeunit(te1), subid = 3587)


HYPEtools documentation built on Sept. 11, 2024, 8:34 p.m.