From 6a23e019a494745aac266809325b3e6e39d53995 Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Mon, 26 Jun 2017 11:21:33 +0200
Subject: [PATCH] v1.0.9.3 bug fixed in DataAltiExtrapolation_Valery when
 PrecipScale = FALSE #4521

---
 DESCRIPTION                      | 4 ++--
 R/DataAltiExtrapolation_Valery.R | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 5070970e..f75f8381 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
 Package: airGR
 Type: Package
 Title: Suite of GR Hydrological Models for Precipitation-Runoff Modelling
-Version: 1.0.9.2
-Date: 2017-06-22
+Version: 1.0.9.3
+Date: 2017-06-26
 Authors@R: c(
   person("Laurent", "Coron", role = c("aut", "trl")),
   person("Charles", "Perrin", role = c("aut", "ths")),
diff --git a/R/DataAltiExtrapolation_Valery.R b/R/DataAltiExtrapolation_Valery.R
index f6629f2e..c15cffec 100644
--- a/R/DataAltiExtrapolation_Valery.R
+++ b/R/DataAltiExtrapolation_Valery.R
@@ -433,7 +433,7 @@ DataAltiExtrapolation_Valery <- function(DatesR,
       ##Extrapolation
       ##Thresold_of_inputs_median_elevation
       Zthreshold <- 4000
-      LayerPrecip_df <- sapply(1:NLayers, function(iLayer) {
+      LayerPrecip_mat <- sapply(1:NLayers, function(iLayer) {
         ##If_layer_elevation_smaller_than_Zthreshold
         if (ZLayers[iLayer] <= Zthreshold) {
           prcp <- as.double(Precip * exp(TabGradP * (ZLayers[iLayer] - ZInputs)))
@@ -450,7 +450,7 @@ DataAltiExtrapolation_Valery <- function(DatesR,
         return(prcp)
       })
       if (PrecipScale) {
-        LayerPrecip_mat <- LayerPrecip_df / rowMeans(LayerPrecip_df) * Precip
+        LayerPrecip_mat <- LayerPrecip_mat / rowMeans(LayerPrecip_mat) * Precip
         LayerPrecip_mat[is.nan(LayerPrecip_mat)] <- 0
       }
       LayerPrecip <- as.list(as.data.frame(LayerPrecip_mat))
-- 
GitLab