calculateAttributes: Calculates the attributes of the hydroclimate time series

View source: R/attributeCalculator.R

calculateAttributesR Documentation

Calculates the attributes of the hydroclimate time series

Description

calculateAttributes calculates the specified attributes of the input daily hydroclimate time series.

Usage

calculateAttributes(climateData, attSel, startYr = NULL, endYr = NULL)

Arguments

climateData

data.frame or list; daily climate data, the attributes of which are to be calculated.
If climateData is a data.frame, it must have columns named year, month, day, *variable_name1*, *variable_name2*. Note that the first three columns of the data.frame contain the year, month, and day of the data. The columns have to be named as specified. Data.frame format is applicable for single site data only.
If climateData is a list, it must have elements named year, month, day, *variable_name1*, *variable_name2*. List format is suitable for both single and multi-site data. For multi-site data, climate variables are specified as matrices, with columns for each site.
Use viewModels() to view the valid variable names. Please refer to data provided with the package that may be loaded using data(tankDat) and data(barossaDat) for examples of the expected format of single site and multi-site climateData.

attSel

a vector; specifying the names of the attributes to be calculated.

startYr

a number (default NULL); to specify the starting year to subset climateData if required. If NULL, startYr is starting year in the input climateData.

endYr

a number (default NULL); to specify the ending year to subset climateData if required. If NULL, endYr is last year in the input climateData.

Value

The function returns a vector of attributes with names of the attributes (attSel). For multi-site data, names are combinations of attribute and site names.

Examples

#----------------------------------------------------------------------
# Example 1: Single-site data.frame input
# load 'tank' example climate data available in the package
data("tankDat")
# specify rainfall and temperature attributes to calculate
attSel <- c("P_ann_tot_m", "P_ann_nWet_m", "P_ann_R10_m", "Temp_ann_rng_m", "Temp_ann_avg_m")
tank_obs_atts <- calculateAttributes(tank_obs, attSel = attSel)
#----------------------------------------------------------------------
# Example 2: Multi-site list input
# load 'Barossa' example climate data available in the package
data("barossaDat")
# specify rainfall attributes to calculate
attSel <- c("P_ann_tot_m", "P_ann_nWet_m", "P_ann_P99")
barossa_obs_atts <- calculateAttributes(tank_obs, attSel = attSel)

foreSIGHT documentation built on Oct. 19, 2023, 9:08 a.m.