PROPAG_CAL_LM — Function to calibrate routing models with a split sample test using lsqrsolve
[X,CR,[CRlog,CRrac,CALC]]=PROPAG_CAL_LM(Qdo,Qup,TS,PRopt,[ICAL,TSini,DEBFIN,FOBJ,XFIX])
Downstream discharge data (matrix [Nx1] where N is the number of time steps)
Upstream discharge data (matrix [Nx1] where N is the number of time steps)
Time step length in hours (default = 24)
Options to select different routing models (see c_PROPAG)
Indices of the value to use in the Q vector during the calibration process. Default = find(Q>=0) (for example, if ICAL=[1,2] only the 2 first time steps are used for calibration)
Number of time-steps required for model initialisation (default = 30*24/TS)
Delimitation of the 2 sub-periods in the dataset (periods including the intialisation of length TSini). DEBFIN should be filled in the following way: [[Beg. of P1 ; End of P1], [Beg. of P2; End of P2]]
Transformation applied to calculate the objective function (default = 'Q', possible = 'logQ' - logarithm transform - or 'racQ' -square root transform -)
Values of fixed parameters, i.e. parameters set to constant values during the calibration process (matrix [4x1]). To calibrate some paramaters and fix others, use the %nan value in XFIX (Ex. [1.5;%nan;100;1.5] allows only the second parameter to be calibrated).
Optimised parameters for the 2 subperiods (matrix [4x2])
Numerical quality criteria on each sub-period in calibration mode and on a cross-validation mode (matrix [5x4], see CRIT)
Numerical quality criteria on each sub-period in calibration mode and on a cross-validation mode (matrix [5x4], see CRIT)
Numerical quality criteria on each sub-period in calibration mode and on a cross-validation mode (matrix [5x4], see CRIT)
Calculated downstream streamflow time-series (matrix [Nx2], first column = calibrated data on P1 and P2, second colmun = validation data).
The function performs the following actions:
(1) The dataset is split into 2 parts defined by the parameter DEBFIN, P1 and P2.
(2) On each sub-period, c_PROPAG is calibrated with the lsqrsolve function.
(3) The calibration quality on P1 and P2 is assessed by calculating quality criteria (see CRIT function).
(4) The model quality in validation mode is assessed by calculating quality criteria on a simulation made on P1 with parameters from P2 and vice-versa.
// Time t = (0:500)'; // Upstream hydrograph (two identical flood hydrographs) Qup=[t.*exp(-(t/50)^2);t.*exp(-(t/50)^2)]; // Downstream hydrograph (two identical flood hydrographs) Qdo=[t.*exp(-((t+50)/200)^2);t.*exp(-((t+50)/200)^2)]; // Independant optimisation on the two flood hydrgraphs [X,CR,CRlog,CRrac,CALC] = PROPAG_CAL_LM(Qdo,Qup,1,11,'def',1); // Plot of results in validation mode t2=0:2*size(t,1)-1;CALC(find(CALC<0))=%nan; plot(t2,Qup,'k',t2,Qdo);xstring('','Time','Discharge'); plot(t2,CALC(:,2),'r');legend(['Uptream, Obs','Downstream, Obs','Downstream, Calc'],%f);