%% 5-min averaged X Y disturbances from the DB
%
%%

function out = dist_5m(year)

% ================================================
% input - year (YYYY)
% output - out structure of X_dist Y_dist 5-min averaged
%
% ================================================
    start_dt = [year,1,1,00,00,00];
    end_dt = [year,12,31,23,59,00];

   % Read X and Y data from the DB 
    x = dbget ( start_dt,end_dt,'x');
    y = dbget ( start_dt,end_dt,'y');
    ss_x = dbget ( start_dt,end_dt,'ss_x');
    ss_y = dbget ( start_dt,end_dt,'ss_y');
    qdc_x = dbget ( start_dt,end_dt,'qdc_x');
    qdc_y = dbget ( start_dt,end_dt,'qdc_y');
    
   % substract SS and QDC variations
    dist_xs = x - ss_x - qdc_x;
    dist_ys = y - ss_y - qdc_y;
    out.x = avr5min(dist_xs);
    out.y = avr5min(dist_ys);