SeriesAggreg {airGR} | R Documentation

## Conversion of time series to another time step (aggregation only)

### Description

Conversion of time series to another time step (aggregation only).
Warning : on the aggregated outputs, the dates correspond to the beginning of the time step
(e.g. for daily time-series 2005-03-01 00:00 = value for period 2005-03-01 00:00 - 2005-03-01 23:59)
(e.g. for monthly time-series 2005-03-01 00:00 = value for period 2005-03-01 00:00 - 2005-03-31 23:59)
(e.g. for yearly time-series 2005-03-01 00:00 = value for period 2005-03-01 00:00 - 2006-02-28 23:59)

### Usage

    SeriesAggreg(TabSeries, TimeFormat, NewTimeFormat, ConvertFun,
      YearFirstMonth = 1, TimeLag = 0, verbose = TRUE)

### Arguments

`TabSeries` | [POSIXt+numeric] data.frame containing the vector of dates (POSIXt) and the time series values numeric)
`TimeFormat` | [character] desired format (i.e. `"hourly"`, `"daily"`, `"monthly"` or `"yearly"`)
`NewTimeFormat` | [character] desired format (i.e. `"hourly"`, `"daily"`, `"monthly"` or `"yearly"`)
`ConvertFun` | [character] names of aggregation functions (e.g. for P[mm], T[degC], Q[mm] : `ConvertFun = c("sum", "mean", "sum"`))
`YearFirstMonth` | (optional) [numeric] integer used when `NewTimeFormat = "yearly"` to set when the starting month of the year (e.g. 01 for calendar year or 09 for hydrological year starting in September)
`TimeLag` | (optional) [numeric] numeric indicating a time lag (in seconds) for the time series aggregation (especially useful to aggregate hourly time series in daily time series)
`verbose` | (optional) [boolean] boolean indicating if the function is run in verbose mode or not, default = `FALSE`

### Value

[POSIXct+numeric] data.frame containing a vector of aggregated dates (POSIXct) and time series values numeric)

### Author(s)

Laurent Coron

### Examples

    library(airGR)

    ## loading catchment data
    data(L0123002)

    ## preparation of the initial time series data frame at the daily time step
    TabSeries <- BasinObs[, c("DatesR", "P", "E", "T", "Qmm")]

    ## conversion at the monthly time step
    NewTabSeries <- SeriesAggreg(TabSeries = TabSeries,
                                 TimeFormat = "daily", NewTimeFormat = "monthly",
                                 ConvertFun = c("sum", "sum", "mean", "sum"))

    ## conversion at the yearly time step
    NewTabSeries <- SeriesAggreg(TabSeries = TabSeries,
                                 TimeFormat = "daily", NewTimeFormat = "yearly",
                                 ConvertFun = c("sum", "sum", "mean", "sum"))

[Package airGR version 1.3.2.23 Index]