gr4j {hydromad}  R Documentation 
GR4J model (mode'le du GeĀ“nie Rural a' 4 parame'tres Journalier).
gr4j.sim(DATA, x1, etmult = 1, S_0 = 0.5, return_state = FALSE,transformed=FALSE) gr4jrouting.sim(U, x2, x3, x4, R_0 = 0, split = 0.9, return_components = FALSE, epsilon = hydromad.getOption("sim.epsilon"), transformed=FALSE)
DATA 
timeserieslike object with columns P (precipitation, mm) and E (potential evapotranspiration, mm). 
U 
effective rainfall series. 
x1 
maximum capacity of the production store (mm). 
x2 
groundwater exchange coefficient (mm). 
x3 
one day ahead maximum capacity of the routing store (mm). 
x4 
time base of unit hydrograph UH1 (time steps). 
etmult 
Multiplier for the 
S_0 
Initial soil moisture level as fraction of 
R_0 
Initial groundwater reservoir level as fraction of

split 
Fraction to go into quick flow routing, usually fixed at 0.9. 
return_state 
to return the series U, S (storage) and ET (evapotranspiration). 
return_components 
to return the series Xr, Xd and R (reservoir level). 
epsilon 
values smaller than this in the output will be set to zero. 
transformed 
transform parameters before use to improve identifiability. They can be untransformed using 
The default parameter ranges were taken from the "80 intervals" given in Perrin et. al. (2003).
the simulated effective rainfall, a time series of the same length as the input series.
Felix Andrews felix@nfrac.org and Joseph Guillaume josephguillaume@gmail.com
Perrin, C., C. Michel, et al. (2003). "Improvement of a parsimonious model for streamflow simulation." Journal of Hydrology 279(14): 275289
http://www.cemagref.fr/webgr/Modelesgb/gr4j/fonctionnement_gr4jgb.htm
hydromad(sma = "gr4j", routing = "gr4jrouting")
to work
with models as objects (recommended).
## view default parameter ranges: str(c(hydromad.getOption("gr4j"), hydromad.getOption("gr4jrouting"))) data(HydroTestData) mod0 < hydromad(HydroTestData, sma = "gr4j", routing = "gr4jrouting") mod0 ## example from ## http://www.cemagref.fr/webgr/Scilab/CONT_EN/HELP_HYDROGR/c_GR4J.htm dat < cbind(P = c(0,0,0,0,0,0.04,0.59,0.03,0.01,0.16,0.37,8.76,2.65, 0.05,0.02,0.02,0.38,0.00,0.02,0.46,4.46,7.71,5.71,0.79,1.33), E = c(0,0,0,0,0,0.24,0.24,0.24,0.24,0.24,0.25,0.25,0.26, 0.27,0.28,0.32,0.33,0.34,0.35,0.36,0.36,0.37,0.37,0.38,0.38)) datz < zoo(dat, as.Date("20000101") + 1:nrow(dat)) modz < hydromad(datz, sma = "gr4j", routing = "gr4jrouting", x1 = 665, x2 = 1.18, x3 = 90, x4 = 3.8, S_0 = 0.6, R_0 = 0.7) xyplot(predict(modz, return_state = TRUE, return_components = TRUE), strip = FALSE, strip.left = TRUE) ## simulate with some arbitrary parameter values mod1 < update(mod0, x1 = 100, x2 = 20, x3 = 1, x4 = 10) ## plot results with state variables testQ < predict(mod1, return_state = TRUE) xyplot(cbind(HydroTestData[,1:2], gr4j = testQ)) ## show effect of increase/decrease in each parameter parRanges < c(hydromad.getOption("gr4j")[1], hydromad.getOption("gr4jrouting")) parsims < mapply(val = parRanges, nm = names(parRanges), FUN = function(val, nm) { lopar < min(val) hipar < max(val) names(lopar) < names(hipar) < nm fitted(runlist(decrease = update(mod1, newpars = lopar), increase = update(mod1, newpars = hipar))) }, SIMPLIFY = FALSE) xyplot.list(parsims, superpose = TRUE, layout = c(1,NA), strip = FALSE, strip.left = TRUE, main = "Simple parameter perturbation example") + layer(panel.lines(fitted(mod1), col = "grey", lwd = 2))