TransfoParam_GR1A.R 531 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
TransfoParam_GR1A <- function(ParamIn, Direction) {
  
  NParam <- 1
  Bool <- is.matrix(ParamIn)
  
  if (Bool == FALSE) {
    ParamIn <- rbind(ParamIn)
  }
  
  if (ncol(ParamIn) != NParam) {
    stop(paste("the GR1A model requires ", NParam, " parameters \n", sep = ""))
    return(NULL)
  }
  
  if (Direction == "TR") {
    ParamOut     <-  (ParamIn + 10.0) / 8
  }
  if (Direction == "RT") {
    ParamOut     <-  ParamIn * 8 - 10.0
  }
  
  if (Bool == FALSE) {
    ParamOut <- ParamOut[1, ]
    
  }
  return(ParamOut)
  
Delaigue Olivier's avatar
Delaigue Olivier committed
28
}