Learn R Programming

dynatopmodel (version 1.2.1)

aggregate_obs: Resample observation data at a new time interval

Description

Takes a list of time series and resample to a new interval.

Usage

aggregate_obs(obs, dt, is.rate = TRUE)

Arguments

obs

List of times series (zoo) objects with a POSIXct index.

dt

New time interval, hours.

is.rate

If TRUE then these are rates i.e m/hr. Otherwise they are absolute values across the interval and are scaled before return by a factor equal to the ratio of the old interval to the new interval.

Value

The list of observations resampled at the new interval.

Details

Time series of observation data are often of different temporal resolutions, however the input to most hydrological models, as is the case with the Dynamic TOPMODEL, requires those data at the same interval. This provides a method to resample a collection of such data to a single interval.

Examples

Run this code
# NOT RUN {
# Resample Brompton rainfall and PE data to 15 minute intervals
require(dynatopmodel)
data("brompton")

obs <- aggregate_obs(list("rain"=brompton$rain, "pe"=brompton$pe), dt=15/60)

# check totals for Sept - Oct 2012
sum(obs$rain*15/60, na.rm=TRUE)
sum(brompton$rain, na.rm=TRUE)

# }

Run the code above in your browser using DataLab