Commit 9048f4f8 authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.3.0.19 CLEAN: number of param corrected for the use of Fortran subroutine...

v1.3.0.19 CLEAN: number of param corrected for the use of Fortran subroutine of CemaNeige with GR4H, GR4J, GR5J and GR6J (not a bug)
Showing with 18 additions and 14 deletions
+18 -14
Package: airGR Package: airGR
Type: Package Type: Package
Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
Version: 1.3.0.18 Version: 1.3.0.19
Date: 2019-05-21 Date: 2019-05-21
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")), person("Laurent", "Coron", role = c("aut", "trl"), comment = c(ORCID = "0000-0002-1503-6204")),
......
...@@ -14,7 +14,7 @@ output: ...@@ -14,7 +14,7 @@ output:
### 1.3.0.18 Release Notes (2019-05-21) ### 1.3.0.19 Release Notes (2019-05-21)
#### New features #### New features
......
...@@ -4,6 +4,7 @@ RunModel_CemaNeigeGR4H <- function(InputsModel,RunOptions,Param){ ...@@ -4,6 +4,7 @@ RunModel_CemaNeigeGR4H <- function(InputsModel,RunOptions,Param){
## Initialization of variables ## Initialization of variables
IsHyst <- inherits(RunOptions, "hysteresis") IsHyst <- inherits(RunOptions, "hysteresis")
NParam <- ifelse(test = IsHyst, yes = 8L, no = 6L) NParam <- ifelse(test = IsHyst, yes = 8L, no = 6L)
NParamCN <- NParam - 4L
NStates <- 4L NStates <- 4L
FortranOutputs <- .FortranOutputs(GR = "GR4H", isCN = TRUE) FortranOutputs <- .FortranOutputs(GR = "GR4H", isCN = TRUE)
...@@ -70,16 +71,16 @@ RunModel_CemaNeigeGR4H <- function(InputsModel,RunOptions,Param){ ...@@ -70,16 +71,16 @@ RunModel_CemaNeigeGR4H <- function(InputsModel,RunOptions,Param){
InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1] InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1]
InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC] InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC]
MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y] MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y]
NParam=as.integer(NParam), ### number of model parameter = 2 NParam=as.integer(NParamCN), ### number of model parameters = 2 or 4
Param=as.double(ParamCemaNeige), ### parameter set Param=as.double(ParamCemaNeige), ### parameter set
NStates=as.integer(NStates), ### number of state variables used for model initialising = 2 NStates=as.integer(NStates), ### number of state variables used for model initialisation = 4
StateStart=StateStartCemaNeige, ### state variables used when the model run starts StateStart=StateStartCemaNeige, ### state variables used when the model run starts
IsHyst = as.integer(IsHyst), ### use of hysteresis IsHyst = as.integer(IsHyst), ### use of hysteresis
NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series
IndOutputs=IndOutputsCemaNeige, ### indices of output series IndOutputs=IndOutputsCemaNeige, ### indices of output series
##outputs ##outputs
Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm] Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm]
StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run (reservoir levels [mm] and HU) StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run
) )
RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA; RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA;
RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA; RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA;
......
...@@ -4,6 +4,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ ...@@ -4,6 +4,7 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
## Initialization of variables ## Initialization of variables
IsHyst <- inherits(RunOptions, "hysteresis") IsHyst <- inherits(RunOptions, "hysteresis")
NParam <- ifelse(test = IsHyst, yes = 8L, no = 6L) NParam <- ifelse(test = IsHyst, yes = 8L, no = 6L)
NParamCN <- NParam - 4L
NStates <- 4L NStates <- 4L
FortranOutputs <- .FortranOutputs(GR = "GR4J", isCN = TRUE) FortranOutputs <- .FortranOutputs(GR = "GR4J", isCN = TRUE)
...@@ -70,16 +71,16 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){ ...@@ -70,16 +71,16 @@ RunModel_CemaNeigeGR4J <- function(InputsModel,RunOptions,Param){
InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1] InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1]
InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC] InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC]
MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y] MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y]
NParam=as.integer(NParam), ### number of model parameter = 2 NParam=as.integer(NParamCN), ### number of model parameters = 2 or 4
Param=as.double(ParamCemaNeige), ### parameter set Param=as.double(ParamCemaNeige), ### parameter set
NStates=as.integer(NStates), ### number of state variables used for model initialising = 2 NStates=as.integer(NStates), ### number of state variables used for model initialising = 4
StateStart=StateStartCemaNeige, ### state variables used when the model run starts StateStart=StateStartCemaNeige, ### state variables used when the model run starts
IsHyst = as.integer(IsHyst), ### use of hysteresis IsHyst = as.integer(IsHyst), ### use of hysteresis
NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series
IndOutputs=IndOutputsCemaNeige, ### indices of output series IndOutputs=IndOutputsCemaNeige, ### indices of output series
##outputs ##outputs
Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm] Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm]
StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run (reservoir levels [mm] and HU) StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run
) )
RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA; RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA;
RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA; RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA;
......
...@@ -3,6 +3,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ ...@@ -3,6 +3,7 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
IsHyst <- inherits(RunOptions, "hysteresis") IsHyst <- inherits(RunOptions, "hysteresis")
NParam <- ifelse(test = IsHyst, yes = 9L, no = 7L) NParam <- ifelse(test = IsHyst, yes = 9L, no = 7L)
NParamCN <- NParam - 5L
NStates <- 4L NStates <- 4L
FortranOutputs <- .FortranOutputs(GR = "GR5J", isCN = TRUE) FortranOutputs <- .FortranOutputs(GR = "GR5J", isCN = TRUE)
...@@ -68,16 +69,16 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){ ...@@ -68,16 +69,16 @@ RunModel_CemaNeigeGR5J <- function(InputsModel,RunOptions,Param){
InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1] InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1]
InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC] InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC]
MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y] MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y]
NParam=as.integer(NParam), ### number of model parameter = 2 NParam=as.integer(NParamCN), ### number of model parameters = 2 or 4
Param=as.double(ParamCemaNeige), ### parameter set Param=as.double(ParamCemaNeige), ### parameter set
NStates=as.integer(NStates), ### number of state variables used for model initialising = 2 NStates=as.integer(NStates), ### number of state variables used for model initialising = 4
StateStart=StateStartCemaNeige, ### state variables used when the model run starts StateStart=StateStartCemaNeige, ### state variables used when the model run starts
IsHyst = as.integer(IsHyst), ### use of hysteresis IsHyst = as.integer(IsHyst), ### use of hysteresis
NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series
IndOutputs=IndOutputsCemaNeige, ### indices of output series IndOutputs=IndOutputsCemaNeige, ### indices of output series
##outputs ##outputs
Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm] Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm]
StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run (reservoir levels [mm] and HU) StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run
) )
RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA; RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA;
RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA; RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA;
......
...@@ -3,6 +3,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ ...@@ -3,6 +3,7 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
IsHyst <- inherits(RunOptions, "hysteresis") IsHyst <- inherits(RunOptions, "hysteresis")
NParam <- ifelse(test = IsHyst, yes = 10L, no = 8L) NParam <- ifelse(test = IsHyst, yes = 10L, no = 8L)
NParamCN <- NParam - 6L
NStates <- 4L NStates <- 4L
FortranOutputs <- .FortranOutputs(GR = "GR6J", isCN = TRUE) FortranOutputs <- .FortranOutputs(GR = "GR6J", isCN = TRUE)
...@@ -72,16 +73,16 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){ ...@@ -72,16 +73,16 @@ RunModel_CemaNeigeGR6J <- function(InputsModel,RunOptions,Param){
InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1] InputsFracSolidPrecip=InputsModel$LayerFracSolidPrecip[[iLayer]][IndPeriod1], ### input series of fraction of solid precipitation [0-1]
InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC] InputsTemp=InputsModel$LayerTemp[[iLayer]][IndPeriod1], ### input series of air mean temperature [degC]
MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y] MeanAnSolidPrecip=RunOptions$MeanAnSolidPrecip[iLayer], ### value of annual mean solid precip [mm/y]
NParam=as.integer(NParam), ### number of model parameter = 2 NParam=as.integer(NParamCN), ### number of model parameters = 2 or 4
Param=as.double(ParamCemaNeige), ### parameter set Param=as.double(ParamCemaNeige), ### parameter set
NStates=as.integer(NStates), ### number of state variables used for model initialising = 2 NStates=as.integer(NStates), ### number of state variables used for model initialising = 4
StateStart=StateStartCemaNeige, ### state variables used when the model run starts StateStart=StateStartCemaNeige, ### state variables used when the model run starts
IsHyst = as.integer(IsHyst), ### use of hysteresis IsHyst = as.integer(IsHyst), ### use of hysteresis
NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series NOutputs=as.integer(length(IndOutputsCemaNeige)), ### number of output series
IndOutputs=IndOutputsCemaNeige, ### indices of output series IndOutputs=IndOutputsCemaNeige, ### indices of output series
##outputs ##outputs
Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm] Outputs=matrix(as.double(-999.999),nrow=LInputSeries,ncol=length(IndOutputsCemaNeige)), ### output series [mm]
StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run (reservoir levels [mm] and HU) StateEnd=rep(as.double(-999.999),as.integer(NStates)) ### state variables at the end of the model run
) )
RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA; RESULTS$Outputs[ round(RESULTS$Outputs ,3)==(-999.999)] <- NA;
RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA; RESULTS$StateEnd[round(RESULTS$StateEnd,3)==(-999.999)] <- NA;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment