as.wateres: Water reservoir creation

View source: R/wateres.R

as.wateresR Documentation

Water reservoir creation

Description

Creates a wateres object from provided time series.

Usage

as.wateres(dframe, storage, area, eas = NULL, observed = FALSE,
  time_step = "month", id = NA, down_id = NA, title = NA)

Arguments

dframe

A name of file containing table with data (including header) or directly data frame or data table. The data need to consist of time series of flows in m3.s-1 (“Q” column) and dates (“DTM” column, required for monthly time step only). Optionally, time series of flows from intercatchment only can be given (“QI” column). These intercatchment flows will be used when calculating a system of reservoirs by the calc_system function. Alternatively, dframe can be a Bilan object (in daily or monthly time step) where the dates and modelled or observed runoffs are read from. In that case, catchment area needs to be specified within the Bilan object.

storage

Potential storage of the reservoir in m3.

area

Flooded area of the reservoir for the potential storage in m2.

eas

Elevation-area-storage relationship given as a data frame or data table with the three columns representing elevation (m.a.s.l.), area (m2) and storage (m3). If values of these three variables are not sorted and their orders differ or if they contain any NA value, this argument will be ignored.

observed

Only when Bilan object is used; whether to read observed runoffs from the object (otherwise modelled are read).

time_step

Time step length (optional, defaults to 1) and unit, entered as a unit name or a string joined by the hyphen (e.g. “7-day”). Currently “month”, “day” and “hour” values are supported. However, the length of monthly time step is allowed to be only 1.

id

An identifier of the reservoir used for calculation of systems.

down_id

The identifier of the nearest reservoir downstream (also used in systems).

title

A reservoir title.

Details

An error occurs if any of the required columns is missing or dframe is of another class than data.frame or data.table.

Value

A wateres object which is also of data.frame and data.table classes.

Examples

reser = data.frame(
    Q = c(0.078, 0.065, 0.168, 0.711, 0.154, 0.107, 0.068, 0.057, 0.07, 0.485, 0.252, 0.236,
          0.498, 0.248, 0.547, 0.197, 0.283, 0.191, 0.104, 0.067, 0.046, 0.161, 0.16, 0.094),
    DTM = seq(as.Date("2000-01-01"), by = "months", length.out = 24))
eas = data.frame(
    elevation = c(496, 502, 511, 520, 529), area = c(0, 58e3, 180e3, 424e3, 754e3),
    storage = c(0, 161e3, 1.864e6, 6.362e6, 14.400e6))
reser = as.wateres(reser, storage = 14.4e6, area = 754e3, eas = eas)

tgmwri/wateres documentation built on Feb. 13, 2024, 10:25 p.m.