Commit b98b572a authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

Retrait du répertoire des codes d'exemple (les codes sont dans les fichiers .Rd)

parent 38a46716
## load of catchment data
require(airGR)
data(L0123001)
## preparation of InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## calibration period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## calibration criterion: preparation of the InputsCrit object
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
## preparation of CalibOptions object
CalibOptions <- CreateCalibOptions(FUN_MOD=RunModel_GR4J,FUN_CALIB=Calibration_Michel)
## calibration
OutputsCalib <- Calibration(InputsModel=InputsModel,RunOptions=RunOptions,InputsCrit=InputsCrit,
CalibOptions=CalibOptions,FUN_MOD=RunModel_GR4J,FUN_CRIT=ErrorCrit_NSE,
FUN_CALIB=Calibration_Michel)
## simulation
Param <- OutputsCalib$ParamFinalR
OutputsModel <- RunModel(InputsModel=InputsModel,RunOptions=RunOptions,
Param=Param,FUN=RunModel_GR4J)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## efficiency criterion: Kling-Gupta Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_KGE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## calibration period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## calibration criterion: preparation of the InputsCrit object
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
## preparation of CalibOptions object
CalibOptions <- CreateCalibOptions(FUN_MOD=RunModel_GR4J,FUN_CALIB=Calibration_Michel)
## calibration
OutputsCalib <- Calibration_Michel(InputsModel=InputsModel,RunOptions=RunOptions,
InputsCrit=InputsCrit,CalibOptions=CalibOptions,
FUN_MOD=RunModel_GR4J,FUN_CRIT=ErrorCrit_NSE)
## simulation
Param <- OutputsCalib$ParamFinalR
OutputsModel <- RunModel_GR4J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## efficiency criterion: Kling-Gupta Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_KGE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(734.568,-0.840,109.809,1.971)
OutputsModel <- RunModel(InputsModel=InputsModel,RunOptions=RunOptions,
Param=Param,FUN=RunModel_GR4J)
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## efficiency criterion: Nash-Sutcliffe Efficiency on log-transformed flows
transfo <- "log"
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run],transfo=transfo)
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## efficiency criterion: Nash-Sutcliffe Efficiency above a threshold (q75%)
BoolCrit <- rep(TRUE,length(BasinObs$Qmm[Ind_Run]));
BoolCrit[BasinObs$Qmm[Ind_Run]<quantile(BasinObs$Qmm[Ind_Run],0.75,na.rm=TRUE)] <- FALSE;
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run],BoolCrit=BoolCrit)
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## efficiency criterion: Kling-Gupta Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_KGE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_KGE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
cat(paste("SubCrit ",OutputsCrit$SubCritNames," ",round(OutputsCrit$SubCritValues,4),"\n",sep=""))
## efficiency criterion: Kling-Gupta Efficiency below a threshold (q10%) on log-trqansformed flows
transfo <- "log"
BoolCrit <- rep(TRUE,length(BasinObs$Qmm[Ind_Run]));
BoolCrit[BasinObs$Qmm[Ind_Run]>quantile(BasinObs$Qmm[Ind_Run],0.10,na.rm=TRUE)] <- FALSE;
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_KGE,InputsModel=InputsModel,RunOptions=RunOptions,
Qobs=BasinObs$Qmm[Ind_Run],BoolCrit=BoolCrit,transfo=transfo)
OutputsCrit <- ErrorCrit_KGE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
cat(paste("SubCrit ",OutputsCrit$SubCritNames," ",round(OutputsCrit$SubCritValues,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(734.568,-0.840,109.809,1.971)
OutputsModel <- RunModel(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param,
FUN_MOD=RunModel_GR4J)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123002)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_CemaNeige,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,TempMean=BasinObs$T,
ZInputs=BasinInfo$HypsoData[51],HypsoData=BasinInfo$HypsoData,
NLayers=5)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_CemaNeige,InputsModel=InputsModel,
IndPeriod_Run=Ind_Run)
## simulation
Param <- c(0.962,2.249)
OutputsModel <- RunModel_CemaNeige(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel)
## load of catchment data
require(airGR)
data(L0123002)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_CemaNeigeGR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E,TempMean=BasinObs$T,
ZInputs=BasinInfo$HypsoData[51],HypsoData=BasinInfo$HypsoData,
NLayers=5)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_CemaNeigeGR4J,InputsModel=InputsModel,
IndPeriod_Run=Ind_Run)
## simulation
Param <- c(408.774,2.646,131.264,1.174,0.962,2.249)
OutputsModel <- RunModel_CemaNeigeGR4J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123002)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_CemaNeigeGR5J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E,TempMean=BasinObs$T,
ZInputs=BasinInfo$HypsoData[51],HypsoData=BasinInfo$HypsoData,
NLayers=5)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_CemaNeigeGR5J,InputsModel=InputsModel,
IndPeriod_Run=Ind_Run)
## simulation
Param <- c(179.139,-0.100,203.815,1.174,2.478,0.977,2.774)
OutputsModel <- RunModel_CemaNeigeGR5J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123002)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_CemaNeigeGR6J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E,TempMean=BasinObs$T,
ZInputs=BasinInfo$HypsoData[51],HypsoData=BasinInfo$HypsoData,
NLayers=5)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_CemaNeigeGR6J,InputsModel=InputsModel,
IndPeriod_Run=Ind_Run)
## simulation
Param <- c(116.482,0.500,72.733,1.224,0.278,30.333,0.977,2.776)
OutputsModel <- RunModel_CemaNeigeGR6J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## conversion of example data from daily to yearly time-step
TabSeries <- data.frame(BasinObs$DatesR,BasinObs$P,BasinObs$E,BasinObs$T,BasinObs$Qmm)
TimeFormat <- "daily"
NewTimeFormat <- "yearly"
ConvertFun <- c("sum","sum","mean","sum")
YearFirstMonth <- 09;
NewTabSeries <- SeriesAggreg(TabSeries=TabSeries,TimeFormat=TimeFormat,
NewTimeFormat=NewTimeFormat,ConvertFun=ConvertFun,
YearFirstMonth=YearFirstMonth)
BasinObs <- NewTabSeries
names(BasinObs) <- c("DatesR","P","E","T","Qmm")
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR1A,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%Y")=="1990"),
which(format(BasinObs$DatesR,format="%Y")=="1999"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR1A,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(0.840)
OutputsModel <- RunModel_GR1A(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## conversion of example data from daily to monthly time-step
TabSeries <- data.frame(BasinObs$DatesR,BasinObs$P,BasinObs$E,BasinObs$T,BasinObs$Qmm)
TimeFormat <- "daily"
NewTimeFormat <- "monthly"
ConvertFun <- c("sum","sum","mean","sum")
NewTabSeries <- SeriesAggreg(TabSeries=TabSeries,TimeFormat=TimeFormat,
NewTimeFormat=NewTimeFormat,ConvertFun=ConvertFun)
BasinObs <- NewTabSeries
names(BasinObs) <- c("DatesR","P","E","T","Qmm")
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR2M,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%m/%Y")=="01/1990"),
which(format(BasinObs$DatesR,format="%m/%Y")=="12/1999"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR2M,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(265.072,1.040)
OutputsModel <- RunModel_GR2M(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123003)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4H,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/03/2004 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/2008 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4H,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(521.113,-2.918,218.009,4.124)
OutputsModel <- RunModel_GR4H(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR4J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR4J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(257.238,1.012,88.235,2.208)
OutputsModel <- RunModel_GR4J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR5J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR5J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(245.918,1.027,90.017,2.198,0.434)
OutputsModel <- RunModel_GR5J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
data(L0123001)
## preparation of the InputsModel object
InputsModel <- CreateInputsModel(FUN_MOD=RunModel_GR6J,DatesR=BasinObs$DatesR,
Precip=BasinObs$P,PotEvap=BasinObs$E)
## run period selection
Ind_Run <- seq(which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="01/01/1990 00:00"),
which(format(BasinObs$DatesR,format="%d/%m/%Y %H:%M")=="31/12/1999 00:00"))
## preparation of the RunOptions object
RunOptions <- CreateRunOptions(FUN_MOD=RunModel_GR6J,InputsModel=InputsModel,IndPeriod_Run=Ind_Run)
## simulation
Param <- c(242.257,0.637,53.517,2.218,0.424,4.759)
OutputsModel <- RunModel_GR6J(InputsModel=InputsModel,RunOptions=RunOptions,Param=Param)
## results preview
plot_OutputsModel(OutputsModel=OutputsModel,Qobs=BasinObs$Qmm[Ind_Run])
## efficiency criterion: Nash-Sutcliffe Efficiency
InputsCrit <- CreateInputsCrit(FUN_CRIT=ErrorCrit_NSE,InputsModel=InputsModel,
RunOptions=RunOptions,Qobs=BasinObs$Qmm[Ind_Run])
OutputsCrit <- ErrorCrit_NSE(InputsCrit=InputsCrit,OutputsModel=OutputsModel)
cat(paste(" Crit ",OutputsCrit$CritName," ",round(OutputsCrit$CritValue,4),"\n",sep=""))
## load of catchment data
require(airGR)
## preparation of the initial time series data frame at the daily time-step
data(L0123002)
TabSeries <- data.frame(BasinObs$DatesR,BasinObs$P,BasinObs$E,BasinObs$T,BasinObs$Qmm)
TimeFormat <- "daily"
## conversion at the monthly time-step
NewTimeFormat <- "monthly"
ConvertFun <- c("sum","sum","mean","sum")
NewTabSeries <- SeriesAggreg(TabSeries=TabSeries,TimeFormat,NewTimeFormat,ConvertFun)
## conversion at the yearly time-step
NewTimeFormat <- "yearly"
ConvertFun <- c("sum","sum","mean","sum")
NewTabSeries <- SeriesAggreg(TabSeries=TabSeries,TimeFormat,NewTimeFormat,ConvertFun)
require(airGR)
## transformation Raw->Transformed for the GR4J model
Xraw <- matrix( c( 221.41, -3.63, 30.00, 1.37,
347.23, -1.03, 60.34, 1.76,
854.06, -0.10, 148.41, 2.34),
ncol=4,byrow=TRUE)
Xtran <- TransfoParam(ParamIn=Xraw ,Direction="RT",FUN_TRANSFO=TransfoParam_GR4J)
## transformation Transformed->Raw for the GR4J model
Xtran <- matrix( c( +3.60, -2.00, +3.40, -9.10,
+3.90, -0.90, +4.10, -8.70,
+4.50, -0.10, +5.00, -8.10),
ncol=4,byrow=TRUE)
Xraw <- TransfoParam(ParamIn=Xtran,Direction="TR",FUN_TRANSFO=TransfoParam_GR4J)
require(airGR)
## transformation Raw->Transformed for the CemaNeige module
Xraw <- matrix( c( 0.19, 1.73,
0.39, 2.51,
0.74, 4.06),
ncol=2,byrow=TRUE)
Xtran <- TransfoParam_CemaNeige(ParamIn=Xraw ,Direction="RT")
## transformation Transformed->Raw for the CemaNeige module
Xtran <- matrix( c( -6.26, +0.55,
-2.13, +0.92,
+4.86, +1.40)
,ncol=2,byrow=TRUE)
Xraw <- TransfoParam_CemaNeige(ParamIn=Xtran,Direction="TR")
require(airGR)
## transformation Raw->Transformed for the GR1A model
Xraw <- matrix( c( 0.625,
1.250,
1.875),
ncol=1,byrow=TRUE)
Xtran <- TransfoParam_GR1A(ParamIn=Xraw ,Direction="RT")
## transformation Transformed->Raw for the GR1A model
Xtran <- matrix( c( -5.00,
+0.00,
+5.00),
ncol=1,byrow=TRUE)