Commit 00551ea9 authored by unknown's avatar unknown
Browse files

v1.0.9.14 bug fixed in plot.OutputsModel for flows time series when...

v1.0.9.14 bug fixed in plot.OutputsModel for flows time series when log_scale=TRUE & BasinArea used #4732
Showing with 14 additions and 8 deletions
+14 -8
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.9.13 Version: 1.0.9.14
Date: 2017-07-11 Date: 2017-07-12
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")),
......
...@@ -162,9 +162,15 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = ...@@ -162,9 +162,15 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
kPlot <- 0 kPlot <- 0
## vector of Q values for the y-axis when it is expressed in ## vector of Q values for the y-axis when it is expressed in
seqDATA1 <- log(c(0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000)) Factor <- ifelse(!is.null(BasinArea), Factor_UNIT_M3S, 1)
seqDATA0 <- c(0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000)
seqDATA1 <- log(seqDATA0)
seqDATA2 <- exp(seqDATA1) seqDATA2 <- exp(seqDATA1)
if (!is.null(BasinArea)) {
seqDATA1ba <- log(seqDATA0 * Factor_UNIT_M3S)
seqDATA2ba <- round(exp(seqDATA1ba), digits = 2)
}
##Precip ##Precip
if (BOOLPLOT_Precip) { if (BOOLPLOT_Precip) {
...@@ -268,7 +274,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = ...@@ -268,7 +274,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
DATA2 <- log(DATA2) DATA2 <- log(DATA2)
DATA3 <- OutputsModel$Qsim DATA3 <- OutputsModel$Qsim
DATA2[!SelectQsimNotZero] <- mean(OutputsModel$Qsim, na.rm = TRUE) / 10000 DATA3[!SelectQsimNotZero] <- mean(OutputsModel$Qsim, na.rm = TRUE) / 10000
DATA3 <- log(DATA3) DATA3 <- log(DATA3)
ylim1 <- range(DATA3[IndPeriod_Plot], na.rm = TRUE); ylim1 <- range(DATA3[IndPeriod_Plot], na.rm = TRUE);
...@@ -282,7 +288,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = ...@@ -282,7 +288,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
par(las = 0); mtext(side = 2, paste0("flow ", plotunit), line = line, cex = cex.lab); par(las = 0); par(las = 0); mtext(side = 2, paste0("flow ", plotunit), line = line, cex = cex.lab); par(las = 0);
if (!is.null(BasinArea)) { if (!is.null(BasinArea)) {
Factor <- Factor_UNIT_M3S; Factor <- Factor_UNIT_M3S;
axis(side = 4, at = pretty(ylim1*Factor)/Factor, labels = pretty(ylim1*Factor), cex.axis = cex.axis, ...); axis(side = 4, at = seqDATA1ba, labels = seqDATA2ba, cex.axis = cex.axis, ...)
par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); } par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); }
if (BOOL_Dates) { if (BOOL_Dates) {
axis(side = 1, at = Seq1, labels = FALSE, cex.axis = cex.axis, ...); axis(side = 1, at = Seq1, labels = FALSE, cex.axis = cex.axis, ...);
...@@ -463,7 +469,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = ...@@ -463,7 +469,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
} }
if (!is.null(BasinArea)) { if (!is.null(BasinArea)) {
Factor <- Factor_UNIT_M3S; Factor <- Factor_UNIT_M3S;
axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor), cex.axis = cex.axis, ...) axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor, dig = 2), cex.axis = cex.axis, ...)
par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0) par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0)
} }
legend("topleft", txtleg, col = colleg, lty = 1, lwd = lwd, bty = "o", bg = bg, box.col = bg, cex = cex.leg) legend("topleft", txtleg, col = colleg, lty = 1, lwd = lwd, bty = "o", bg = bg, box.col = bg, cex = cex.leg)
...@@ -495,7 +501,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea = ...@@ -495,7 +501,7 @@ plot.OutputsModel <- function(x, Qobs = NULL, IndPeriod_Plot = NULL, BasinArea =
par(las = 0); mtext(side = 2, paste0("simulated flow ", plotunit), line = line, cex = cex.lab); par(las = 0); par(las = 0); mtext(side = 2, paste0("simulated flow ", plotunit), line = line, cex = cex.lab); par(las = 0);
if (!is.null(BasinArea)) { if (!is.null(BasinArea)) {
Factor <- Factor_UNIT_M3S; Factor <- Factor_UNIT_M3S;
axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor), cex.axis = cex.axis, ...); axis(side = 4, at = seqDATA1, labels = round(seqDATA2*Factor, dig = 2), cex.axis = cex.axis, ...);
par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); } par(las = 0); mtext(side = 4, paste0("flow ", "m3/s"), line = line, cex = cex.lab); par(las = 0); }
legend("bottomright", "log scale", lty = 1, col = NA, bty = "o", bg = bg, box.col = bg, cex = cex.leg) legend("bottomright", "log scale", lty = 1, col = NA, bty = "o", bg = bg, box.col = bg, cex = cex.leg)
} else { } else {
......
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