Commit 5287148e authored by Delaigue Olivier's avatar Delaigue Olivier
Browse files

v1.3.2.60 BUG: boxcox transformation formula corrected in .ErrorCrit #19

moreover, epsilon is useless with this transformation
Showing with 7 additions and 6 deletions
+7 -6
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.2.59 Version: 1.3.2.60
Date: 2019-11-20 Date: 2019-11-20
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")),
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
### 1.3.2.59 Release Notes (2019-11-19) ### 1.3.2.60 Release Notes (2019-11-20)
#### New features #### New features
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
- Fixed bug in <code>TransfoParam_GR1A()</code>. The number of model parameters was wrong (2 instead of 1) which caused an error when the GR1 model during the calibration. - Fixed bug in <code>TransfoParam_GR1A()</code>. The number of model parameters was wrong (2 instead of 1) which caused an error when the GR1 model during the calibration.
- Fixed bug in <code>plot.OutputsModel()</code>. The function does not return any error message when <code>log_scale = TRUE</code>, <code>Qobs = NULL</code> and user want to draw flows time series. - Fixed bug in <code>plot.OutputsModel()</code>. The function does not return any error message when <code>log_scale = TRUE</code>, <code>Qobs = NULL</code> and user want to draw flows time series.
- Fixed bug in <code>RunModel_&#42;GR&#42;()</code>. The functions do not return any error message anymore due to slightly negative values returned by GR4H, GR4J, GR5J or GR6J Fortran codes (the message was returned by <code>CreateIniStates()</code> when the final states were created). The <code>RunModel_&#42;GR&#42;()</code> functions now returns zero instead of these slightly negative values, except for the ExpStore where negatives values are allowed. - Fixed bug in <code>RunModel_&#42;GR&#42;()</code>. The functions do not return any error message anymore due to slightly negative values returned by GR4H, GR4J, GR5J or GR6J Fortran codes (the message was returned by <code>CreateIniStates()</code> when the final states were created). The <code>RunModel_&#42;GR&#42;()</code> functions now returns zero instead of these slightly negative values, except for the ExpStore where negatives values are allowed.
- Fixed bug in the <code>.ErrorCrit()</code> function. The Box-Cox transformation formula is now corrected when the <code>ErrorCrit&#42;()</code> are used.
#### Minor user-visible changes #### Minor user-visible changes
......
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
warning("zeroes detected in 'Qsim': the corresponding time-steps will be excluded from the criteria computation if the epsilon argument of 'CreateInputsCrit' = NULL", call. = FALSE) warning("zeroes detected in 'Qsim': the corresponding time-steps will be excluded from the criteria computation if the epsilon argument of 'CreateInputsCrit' = NULL", call. = FALSE)
} }
} }
if ("epsilon" %in% names(InputsCrit) & !is.null(InputsCrit$epsilon)) { if ("epsilon" %in% names(InputsCrit) & !is.null(InputsCrit$epsilon) & !(InputsCrit$transfo == "boxcox")) {
VarObs <- VarObs + InputsCrit$epsilon VarObs <- VarObs + InputsCrit$epsilon
VarSim <- VarSim + InputsCrit$epsilon VarSim <- VarSim + InputsCrit$epsilon
} }
...@@ -173,8 +173,9 @@ ...@@ -173,8 +173,9 @@
InputsCrit$BoolCrit <- sort(InputsCrit$BoolCrit, decreasing = TRUE) InputsCrit$BoolCrit <- sort(InputsCrit$BoolCrit, decreasing = TRUE)
} }
if (InputsCrit$transfo == "boxcox") { if (InputsCrit$transfo == "boxcox") {
VarSim <- (VarSim^0.25 - 0.01 * mean(VarSim, na.rm = TRUE)) / 0.25 muTransfoVarObs <- (0.01 * mean(VarObs, na.rm = TRUE))^0.25
VarObs <- (VarObs^0.25 - 0.01 * mean(VarObs, na.rm = TRUE)) / 0.25 VarSim <- (VarSim^0.25 - muTransfoVarObs) / 0.25
VarObs <- (VarObs^0.25 - muTransfoVarObs) / 0.25
} }
if (grepl("\\^", InputsCrit$transfo)) { if (grepl("\\^", InputsCrit$transfo)) {
VarObs <- VarObs^transfoPow VarObs <- VarObs^transfoPow
...@@ -221,7 +222,6 @@ ...@@ -221,7 +222,6 @@
CritCompute = CritCompute, CritCompute = CritCompute,
TS_ignore = TS_ignore, TS_ignore = TS_ignore,
Ind_TS_ignore = Ind_TS_ignore) Ind_TS_ignore = Ind_TS_ignore)
} }
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