agg_hydroMet {hydroToolkit} | R Documentation |
Aggregate slot data
Description
This method provides common functions to aggregate the data inside a slot.
Usage
agg_hydroMet(
obj,
slot_name,
col_name,
fun,
period,
out_name = NULL,
start_month = NULL,
end_month = NULL,
allow_NA = NULL
)
## S4 method for signature 'hydroMet_BDHI'
agg_hydroMet(
obj,
slot_name,
col_name,
fun,
period,
out_name = NULL,
start_month = NULL,
end_month = NULL,
allow_NA = NULL
)
## S4 method for signature 'hydroMet_DGI'
agg_hydroMet(
obj,
slot_name,
col_name,
fun,
period,
out_name = NULL,
start_month = NULL,
end_month = NULL,
allow_NA = NULL
)
## S4 method for signature 'hydroMet_CR2'
agg_hydroMet(
obj,
slot_name,
col_name,
fun,
period,
out_name = NULL,
start_month = NULL,
end_month = NULL,
allow_NA = NULL
)
## S4 method for signature 'hydroMet_IANIGLA'
agg_hydroMet(
obj,
slot_name,
col_name,
fun,
period,
out_name = NULL,
start_month = NULL,
end_month = NULL,
allow_NA = NULL
)
Arguments
obj |
an |
slot_name |
a single or vector string containing the slot(s) to aggregate. |
col_name |
a single or vector string with the name of the column to aggregate in |
fun |
a single or vector string containing one of the following functions: mean, min, max or sum. |
period |
a single or vector string with the period of aggregation: hourly, daily, monthly, annual or climatic. NOTE_1: the 'climatic' option returns the all series annual statistics ('fun'). NOTE_2: if the object is of class |
out_name |
optional. Single or vector string with the output column name of the variable to aggregate. |
start_month |
optional. Numeric (or numeric vector) value of the first month. It only makes sense if the period is annual. NOTE: as an example, in case you have just two slots (out of five) that you want to aggregate annually you must provide a vector of length two. Default value is January. NOTE*: if the object is of class |
end_month |
optional. Numeric (or numeric vector) value of the last month. It only makes sense if the period is annual. NOTE: as an example, in case you have just two slots (out of five) that you want to aggregate annually you must provide a vector of length two. Default value es December. NOTE*: if the object is of class |
allow_NA |
optional. Numeric (or numeric vector) value with the maximum allowed number of |
Value
An hydroMet_XXX
class object with the required slot(s) aggregated.
Functions
-
agg_hydroMet,hydroMet_BDHI-method
: aggregation method for BDHI data -
agg_hydroMet,hydroMet_DGI-method
: aggregation method for DGI data -
agg_hydroMet,hydroMet_CR2-method
: aggregation method for CR2 data -
agg_hydroMet,hydroMet_IANIGLA-method
: aggregation method for IANIGLA data
Examples
# Create BDHI hydro-met station
guido <- create_hydroMet(class_name = 'BDHI')
# List with meteorological variables (slots in BDHI's object)
cargar <- list('precip', 'Qmd', 'Qmm')
# Assign as names the files
hydro_files <- list.files( system.file('extdata', package = "hydroToolkit"), pattern = 'Guido' )
names(cargar) <- hydro_files
# Build the object with the met records
guido <- build_hydroMet(obj = guido, slot_list = cargar,
path = system.file('extdata', package = "hydroToolkit") )
# Aggregrate precipitation serie
guido <- agg_hydroMet(obj = guido, slot_name = 'precip', col_name = 'precip', fun = 'sum',
period = 'monthly', out_name = 'P_month', allow_NA = 3)