SeriesAggreg {airGR} | R Documentation |
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)
SeriesAggreg(TabSeries, TimeFormat, NewTimeFormat, ConvertFun, YearFirstMonth = 1, TimeLag = 0, verbose = TRUE)
TabSeries |
[POSIXt+numeric] data.frame containing the vector of dates (POSIXt) and the time series values numeric) |
TimeFormat |
[character] desired format (i.e. |
NewTimeFormat |
[character] desired format (i.e. |
ConvertFun |
[character] names of aggregation functions (e.g. for P[mm], T[degC], Q[mm] : |
YearFirstMonth |
(optional) [numeric] integer used when |
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 = |
[POSIXct+numeric] data.frame containing a vector of aggregated dates (POSIXct) and time series values numeric)
Laurent Coron
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"))