Vignette about CemaNeige hysteresis to complete
As explained in Riboust et al. (2019)'s paper, the CemaNeige hysteresis must be used with a MeanAnSolidPrecip argument of CreateRunOptions set to different values for each elevation zone. As a consequence, we must add/modify a couple of things in the vignette showing how to use it, as well as in the example of RunModel_CemaNeigeGR4J.
In the vignette:
SolidPrecip_Cal <- rep(0, 5)
SolidPrecip_Val <- rep(0, 5)
for(iLayer in 1:5){
SolidPrecip_Cal[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Cal]*InputsModel$LayerPrecip[[iLayer]][Ind_Cal]);
SolidPrecip_Val[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Val]*InputsModel$LayerPrecip[[iLayer]][Ind_Val]);
}
if(inherits(InputsModel,"hourly" )){ Factor <- 365.25*24; }
if(inherits(InputsModel,"daily" )){ Factor <- 365.25; }
if(inherits(InputsModel,"monthly")){ Factor <- 12; }
if(inherits(InputsModel,"yearly" )){ Factor <- 1; }
SolidPrecip_Cal <- SolidPrecip_Cal*Factor
SolidPrecip_Val <- SolidPrecip_Val*Factor
## preparation of RunOptions object
RunOptions_Cal <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Cal, IsHyst = TRUE,
MeanAnSolidPrecip = SolidPrecip_Cal)
## preparation of RunOptions object
RunOptions_Val <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J,
InputsModel = InputsModel, IndPeriod_Run = Ind_Val, IsHyst = TRUE,
MeanAnSolidPrecip = SolidPrecip_Val)
In the example:
SolidPrecip <- rep(0, 5)
for(iLayer in 1:5){
SolidPrecip[iLayer] <- mean(InputsModel$LayerFracSolidPrecip[[iLayer]][Ind_Run]*InputsModel$LayerPrecip[[iLayer]][Ind_Run]);
}
if(inherits(InputsModel,"hourly" )){ Factor <- 365.25*24; }
if(inherits(InputsModel,"daily" )){ Factor <- 365.25; }
if(inherits(InputsModel,"monthly")){ Factor <- 12; }
if(inherits(InputsModel,"yearly" )){ Factor <- 1; }
SolidPrecip <- SolidPrecip*Factor
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD = RunModel_CemaNeigeGR4J, InputsModel = InputsModel,
IndPeriod_Run = Ind_Run, IsHyst = TRUE, MeanAnSolidPrecip = SolidPrecip)
@olivier.delaigue, please make it R beautiful. :D
I'm doing some tests and confirm tomorrow.
Thanks @francois.bourgin for spotting that.