c_GENEPAR — Function to calculate the parameters of the daily rainfall generator
PAR = c_GENEPAR(DateDep,P)
Date of the first value of P vector (format 199001010000)
Observed daily rainfall time series (in mm/day, vector of N lines where N is the number of days of observation)
PAR(i,:) are the 8 generator parameters for each season i calculated from rainfall time series.
PAR(i,1) = a parameter : exponential law parameter (high rainfall distribution)
PAR(i,8) = b parameter : truncated exponential law parameter (law rainfall distribution)
PAR(i,2) = probability to have a state 1 with a state 1 on preceeding day
PAR(i,4) = probability to have a state 1 with a state 2 on preceeding day
PAR(i,6) = probability to have a state 1 with a state 3 on preceeding day
PAR(i,3) = probability to have a state 2 with a state 1 on preceeding day
PAR(i,5) = probability to have a state 2 with a state 2 on preceeding day
PAR(i,7) = probability to have a state 2 with a state 3 on preceeding day
PAR(NBSEAS+1,1:2) are 2 synthetic values of the time series
PAR(NBSEAS+1,1)=average of positive rainfall x log(2) (partition between law and high rainfall)
PAR(NBSEAS+1,2)=average of rainfall
WARNING : This function is written in C language and interfaced with SCILAB (HYDROGR.dll).
CAUTION : If PAR contains -9.999 values, it means that the rainfall data are not sufficient to calculate the parameters of the generator.
The generator has three states : null rainfall, low rainfall (under the average rainfall) and high rainfall (over the average rainfall). Eeach day, a new rainfall is generated based on the state of the generator on the preceeding day: the transition probability are known (parameter matrix) and the generator uses an exponential law and a random number to calculate the new value.
The 3 states of the generator determined by x0 (x0 =mean(P,P>0) x log(2) ) :
(1) P=0,
(2) P sup.0 and Pinf or eq. x0,
(3) P sup.x0
Repartition function used to simulate rainfall values (u = random number in ]0..1[ ):
(State 1) P = 0 (no repartition function needed)
(State 2) P = [exp(b.x/x0)-1]/[exp(b)-1]
(State 3) P = 1 - exp[(x-x0)/a]