Utils.R 2.35 KB
Newer Older
1

2
3
4
5
6
7
8
9
10
11
12
13
## =================================================================================
## function to check
## =================================================================================

# .onLoad <- function(libname, pkgname){
#   if (requireNamespace("airGRteaching", quietly = TRUE)) {
#     if (packageVersion("airGRteaching") %in% package_version(c("0.2.0.9", "0.2.2.2", "0.2.3.2"))) {
#       packageStartupMessage("In order to be compatible with the present version of 'airGR', please update your version of the 'airGRteaching' package.")
#     }
#   }
# }

14
15
16
17
18
## =================================================================================
## function to manage Fortran outputs
## =================================================================================

.FortranOutputs <- function(GR = NULL, isCN = FALSE) {
19

20
21
  outGR <- NULL
  outCN <- NULL
22

23
24
25
26
27
28
29
  if (is.null(GR)) {
    GR <- ""
  }
  if (GR == "GR1A") {
    outGR <- c("PotEvap", "Precip",
               "Qsim")
  } else if (GR == "GR2M") {
30
    outGR <- c("PotEvap", "Precip", "Prod", "Pn", "Ps",
31
32
33
34
               "AE",
               "Perc", "PR",
               "Rout", "Exch",
               "Qsim")
35
36
  } else if (GR == "GR5H") {
    outGR <- c("PotEvap", "Precip", "Interc", "Prod", "Pn", "Ps",
37
               "AE", "EI", "ES",
38
39
               "Perc", "PR",
               "Q9", "Q1",
40
               "Rout", "Exch",
41
42
               "AExch1", "AExch2",
               "AExch", "QR",
43
44
               "QD",
               "Qsim")
45
  } else if (GR %in% c("GR4J", "GR5J", "GR4H")) {
46
47
48
49
    outGR <- c("PotEvap", "Precip", "Prod", "Pn", "Ps",
               "AE",
               "Perc", "PR",
               "Q9", "Q1",
50
               "Rout", "Exch",
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
               "AExch1", "AExch2",
               "AExch", "QR",
               "QD",
               "Qsim")
  } else if (GR == "GR6J") {
    outGR <- c("PotEvap", "Precip", "Prod", "Pn", "Ps",
               "AE",
               "Perc", "PR",
               "Q9", "Q1",
               "Rout", "Exch",
               "AExch1", "AExch2",
               "AExch", "QR",
               "QRExp", "Exp",
               "QD",
               "Qsim")
  }
  if (isCN) {
68
69
70
    outCN <- c("Pliq", "Psol",
               "SnowPack", "ThermalState", "Gratio",
               "PotMelt", "Melt", "PliqAndMelt", "Temp",
71
72
               "Gthreshold", "Glocalmax")
  }
73

74
  res <- list(GR = outGR, CN = outCN)
75

76
}