Creates a runlist of model instances with separate data periods
splitData(object, start.dates = NULL, end.dates = NULL, periods = NULL)
an object of class hydromad
.
dates at which each model instance should start, passed
as start
to window.zoo
dates at which each model instance should end, passed as
end
to window.zoo
named list of start and end dates. Overrides
start.dates
and end.dates
if it is not NULL
A runlist of hydromad objects with data periods starting at
start.dates
and ending at end.dates
data(Cotter)
modx <- hydromad(Cotter,
sma = "cwi", routing = "expuh",
tau_s = c(2, 100), v_s = c(0, 1)
)
start.dates <- as.Date(c("1966-05-01", "1976-05-1"))
end.dates <- as.Date(c("1976-04-30", "1986-04-30"))
rl <- splitData(modx, start.dates, end.dates)
str(rl)
#>
#> List of Hydromad model runs:
#> List of 2
#> $ 1966-05-01_1976-04-30: language hydromad(DATA = dots[[1L]][[2L]](), tau_s = c(2, 100), v_s = c(0, 1), sma = "cwi", routing = "expuh")
#> $ 1976-05-01_1986-04-30: language hydromad(DATA = dots[[1L]][[2L]](), tau_s = c(2, 100), v_s = c(0, 1), sma = "cwi", routing = "expuh")
## Fit the first period
fitx <- fitByOptim(rl[[1]])
## Evaluate the resulting model on all periods
rl.first <- update(rl, newpars = coef(fitx))