Commit 977eb64b authored by unknown's avatar unknown
Browse files

v1.0.5.21 function TransfoParam_GR2M() cleaned

Showing with 31 additions and 24 deletions
+31 -24
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.0.5.20 Version: 1.0.5.21
Date: 2017-01-23 Date: 2017-02-16
Authors@R: c( Authors@R: c(
person("Laurent", "Coron", role = c("aut", "trl")), person("Laurent", "Coron", role = c("aut", "trl")),
person("Charles", "Perrin", role = c("aut", "ths")), person("Charles", "Perrin", role = c("aut", "ths")),
......
TransfoParam_GR2M <- function(ParamIn,Direction){ TransfoParam_GR2M <- function(ParamIn, Direction) {
NParam <- 2; NParam <- 2
Bool <- is.matrix(ParamIn); Bool <- is.matrix(ParamIn)
if(Bool==FALSE){ ParamIn <- rbind(ParamIn); }
if(ncol(ParamIn)!=NParam){ stop(paste("the GR2M model requires ",NParam," parameters \n",sep="")); return(NULL); } if (Bool == FALSE) {
ParamIn <- rbind(ParamIn)
if(Direction=="TR"){ }
ParamOut <- ParamIn; if (ncol(ParamIn) != NParam) {
ParamOut[,1] <- exp(ParamIn[,1]); stop(paste("the GR2M model requires ", NParam, " parameters \n", sep = ""))
ParamOut[,2] <- ParamIn[, 2] / 4 + 2.5; return(NULL)
} }
if(Direction=="RT"){
ParamOut <- ParamIn; if (Direction == "TR") {
ParamOut[,1] <- log(ParamIn[,1]); ParamOut <- ParamIn
ParamOut[,2] <- (ParamIn[,2] - 2.5) * 4; ParamOut[, 1] <- exp(ParamIn[, 1])
} ParamOut[, 2] <- ParamIn[, 2] / 4 + 2.5
}
if(Bool==FALSE){ ParamOut <- ParamOut[1,]; } if (Direction == "RT") {
return(ParamOut); ParamOut <- ParamIn
ParamOut[, 1] <- log(ParamIn[, 1])
ParamOut[, 2] <- (ParamIn[, 2] - 2.5) * 4
}
if (Bool == FALSE) {
ParamOut <- ParamOut[1, ]
}
return(ParamOut)
} }
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