Name

c_CORRIGE — Function to correct data

Calling Sequence

CORRECTED = c_CORRIGE(INPUT,TYPE)

Parameters

INPUT

Data to correct (matrix [Nx1] where N is the number of time steps)

TYPE

Type of correction.

If TYPE=1, the negative values are replaced by the last positive value.

If TYPE=2, the negative values are interpolated linearly.

CORRECTED

Corrected data (matrix [Nx1])

Description

  • WARNING : This function is written in C language and interfaced with SCILAB (HYDROGR.dll).

  • This function has been designed to correct input data to hydrological models.

Examples

   INI = [3*rand(10,1)+3; -9.99 * ones(5,1) ; rand(5,1)];
   COR1 = c_CORRIGE(INI,1);
   COR2 = c_CORRIGE(INI,2);
   
   // Graph
   INI(find(INI<0))=%nan;
   subplot(3,1,1),plot(INI);legend(['Raw values'],a=3,%f); xtitle('','Time','Variable');  
   subplot(3,1,2),plot(COR1);legend(['Correction 1 (last non negative value)'],a=3,%f); xtitle('','Time','Variable');
   subplot(3,1,3),plot(COR2);legend(['Correction 2 (linear interpolation)'],a=3,%f); xtitle('','Time','Variable');
  

Authors

Julien Lerat

CEMAGREF Antony, HBAN Unit, julien.lerat@cemagref.fr