An error occurred while loading the file. Please try again.
-
Delaigue Olivier authored78936193
#*****************************************************************************************************************
#' Function which extrapolates the precipitation and air temperature series for different elevation layers (method from Valery, 2010).
#'
#' Elevation layers of equal surface are created the 101 elevation quantiles (\emph{HypsoData})
#' and the number requested elevation layers (\emph{NLayers}). \cr
#' Forcing data (precipitation and air temperature) are extrapolated using gradients from Valery (2010).
#' (e.g. gradP=0.0004 [m-1] for France and gradT=0.434 [degreC/100m] for January, 1st). \cr
#' This function is used by the \emph{CreateInputsModel} function. \cr
#*****************************************************************************************************************
#' @title Altitudinal extrapolation of precipitation and temperature series
#' @author Laurent Coron, Pierre Brigode (June 2014)
#' @references
#' Turcotte, R., L.-G. Fortin, V. Fortin, J.-P. Fortin and J.-P. Villeneuve (2007),
#' Operational analysis of the spatial distribution and the temporal evolution of the snowpack water equivalent
#' in southern Quebec, Canada, Nordic Hydrology, 38(3), 211, doi:10.2166/nh.2007.009. \cr
#' Valéry, A. (2010), Modélisation précipitations-débit sous influence nivale ? : Elaboration d'un module neige
#' et évaluation sur 380 bassins versants, PhD thesis (in french), AgroParisTech, Paris, France. \cr
#' USACE (1956), Snow Hydrology, pp. 437, U.S. Army Coprs of Engineers (USACE) North Pacific Division, Portland, Oregon, USA.
#' @seealso \code{\link{CreateInputsModel}}, \code{\link{RunModel_CemaNeigeGR4J}}
#' @encoding UTF-8
#' @export
#_FunctionInputs__________________________________________________________________________________________________
#' @param DatesR [POSIXlt] vector of dates
#' @param Precip [numeric] time series of daily total precipitation (catchment average) [mm]
#' @param TempMean [numeric] time series of daily mean air temperature [degC]
#' @param TempMin (optional) [numeric] time series of daily min air temperature [degC]
#' @param TempMax (optional) [numeric] time series of daily max air temperature [degC]
#' @param ZInputs [numeric] real giving the mean elevation of the Precip and Temp series (before extrapolation) [m]
#' @param HypsoData [numeric] vector of 101 reals: min, q01 to q99 and max of catchment elevation distribution [m]
#' @param NLayers [numeric] integer giving the number of elevation layers requested [-]
#' @param quiet (optional) [boolean] boolean indicating if the function is run in quiet mode or not, default=FALSE
#_FunctionOutputs_________________________________________________________________________________________________
#' @return list containing the extrapolated series of precip. and air temp. on each elevation layer
#' \tabular{ll}{
#' \emph{$LayerPrecip } \tab [list] list of time series of daily precipitation (layer average) [mm] \cr
#' \emph{$LayerTempMean } \tab [list] list of time series of daily mean air temperature (layer average) [degC] \cr
#' \emph{$LayerTempMin } \tab [list] list of time series of daily min air temperature (layer average) [degC] \cr
#' \emph{$LayerTempMax } \tab [list] list of time series of daily max air temperature (layer average) [degC] \cr
#' \emph{$LayerFracSolidPrecip} \tab [list] list of time series of daily solid precip. fract. (layer average) [-] \cr
#' \emph{$ZLayers } \tab [numeric] vector of median elevation for each layer \cr
#' }
#*****************************************************************************************************************
DataAltiExtrapolation_HBAN <- function(DatesR,Precip,TempMean,TempMin=NULL,TempMax=NULL,ZInputs,HypsoData,NLayers,quiet=FALSE){
##Altitudinal_gradient_functions_______________________________________________________________
##unique_gradient_for_precipitation
GradP_Valery2010 <- function(){
return(0.00041); ### value from Val? PhD thesis page 126
}
##daily_gradients_for_mean_min_and_max_air_temperature
GradT_Valery2010 <- function(){
RESULT <- matrix(c(
1, 1, 0.434, 0.366, 0.498,
2, 1, 0.434, 0.366, 0.500,
3, 1, 0.435, 0.367, 0.501,
4, 1, 0.436, 0.367, 0.503,
5, 1, 0.437, 0.367, 0.504,
6, 1, 0.439, 0.367, 0.506,
7, 1, 0.440, 0.367, 0.508,
8, 1, 0.441, 0.368, 0.510,
9, 1, 0.442, 0.368, 0.512,
10, 1, 0.444, 0.368, 0.514,
11, 1, 0.445, 0.368, 0.517,
12, 1, 0.446, 0.368, 0.519,
13, 1, 0.448, 0.369, 0.522,
14, 1, 0.450, 0.369, 0.525,
15, 1, 0.451, 0.369, 0.527,
16, 1, 0.453, 0.370, 0.530,
17, 1, 0.455, 0.370, 0.533,
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
18, 1, 0.456, 0.370, 0.537,
19, 1, 0.458, 0.371, 0.540,
20, 1, 0.460, 0.371, 0.543,
21, 1, 0.462, 0.371, 0.547,
22, 1, 0.464, 0.372, 0.550,
23, 1, 0.466, 0.372, 0.554,
24, 1, 0.468, 0.373, 0.558,
25, 1, 0.470, 0.373, 0.561,
26, 1, 0.472, 0.374, 0.565,
27, 1, 0.474, 0.374, 0.569,
28, 1, 0.476, 0.375, 0.573,
29, 1, 0.478, 0.375, 0.577,
30, 1, 0.480, 0.376, 0.582,
31, 1, 0.483, 0.376, 0.586,
1, 2, 0.485, 0.377, 0.590,
2, 2, 0.487, 0.377, 0.594,
3, 2, 0.489, 0.378, 0.599,
4, 2, 0.492, 0.379, 0.603,
5, 2, 0.494, 0.379, 0.607,
6, 2, 0.496, 0.380, 0.612,
7, 2, 0.498, 0.381, 0.616,
8, 2, 0.501, 0.381, 0.621,
9, 2, 0.503, 0.382, 0.625,
10, 2, 0.505, 0.383, 0.630,
11, 2, 0.508, 0.384, 0.634,
12, 2, 0.510, 0.384, 0.639,
13, 2, 0.512, 0.385, 0.643,
14, 2, 0.515, 0.386, 0.648,
15, 2, 0.517, 0.387, 0.652,
16, 2, 0.519, 0.387, 0.657,
17, 2, 0.522, 0.388, 0.661,
18, 2, 0.524, 0.389, 0.666,
19, 2, 0.526, 0.390, 0.670,
20, 2, 0.528, 0.391, 0.674,
21, 2, 0.530, 0.392, 0.679,
22, 2, 0.533, 0.393, 0.683,
23, 2, 0.535, 0.393, 0.687,
24, 2, 0.537, 0.394, 0.691,
25, 2, 0.539, 0.395, 0.695,
26, 2, 0.541, 0.396, 0.699,
27, 2, 0.543, 0.397, 0.703,
28, 2, 0.545, 0.398, 0.707,
29, 2, 0.546, 0.399, 0.709,
1, 3, 0.547, 0.399, 0.711,
2, 3, 0.549, 0.400, 0.715,
3, 3, 0.551, 0.401, 0.718,
4, 3, 0.553, 0.402, 0.722,
5, 3, 0.555, 0.403, 0.726,
6, 3, 0.557, 0.404, 0.729,
7, 3, 0.559, 0.405, 0.732,
8, 3, 0.560, 0.406, 0.736,
9, 3, 0.562, 0.406, 0.739,
10, 3, 0.564, 0.407, 0.742,
11, 3, 0.566, 0.408, 0.745,
12, 3, 0.567, 0.409, 0.748,
13, 3, 0.569, 0.410, 0.750,
14, 3, 0.570, 0.411, 0.753,
15, 3, 0.572, 0.412, 0.756,
16, 3, 0.573, 0.413, 0.758,
17, 3, 0.575, 0.414, 0.761,
18, 3, 0.576, 0.415, 0.763,
19, 3, 0.577, 0.416, 0.765,
20, 3, 0.579, 0.417, 0.767,
21, 3, 0.580, 0.417, 0.769,
22, 3, 0.581, 0.418, 0.771,
23, 3, 0.582, 0.419, 0.773,
24, 3, 0.583, 0.420, 0.774,
25, 3, 0.584, 0.421, 0.776,
26, 3, 0.585, 0.422, 0.777,
27, 3, 0.586, 0.422, 0.779,