function[Data] = CleanData (DataFolder,Data)
%SUBFUNCTION of readData: Takes away all calculations with an standard diviation of zero in the meridional component and with "wrong" latitudes
% standard division =zero: because that means that the calculation methode has fallen over and the the calculated wind is wrong.
% wrong latitudes : latitudes ~= general latitude
%%
Name=Data.Name;
Data.Name=strcat(Data.Name,'Clean');

keep=find(Data.SD_Vx~=0);
fprintf(['Number of Data deleted (SD_Vx=0): ',int2str(size(Data.Year,1)-size(keep,1)) '\n'])

    Data.Year    = Data.Year(keep);
    Data.Month   = Data.Month(keep);
    Data.Day     = Data.Day(keep);
    Data.Hour    = Data.Hour(keep);
    Data.NMeteor = Data.NMeteor(keep);
    Data.Frang   = Data.Frang(keep);
    Data.Rsep    = Data.Rsep(keep);
    Data.Vx      = Data.Vx(keep);
    Data.Vy      = Data.Vy(keep);
    Data.Lat     = Data.Lat(keep);
    Data.Lon     = Data.Lon(keep);
    Data.Vm      = Data.Vm(keep);
    Data.Vm_lat  = Data.Vm_lat(keep);
    Data.Vm_lon  = Data.Vm_lon(keep);
    Data.SD_Vx   = Data.SD_Vx(keep);
    Data.SD_Vy   = Data.SD_Vy(keep);
    Data.DateNum = datenum(Data.Year,Data.Month,Data.Day,Data.Hour,0,0);
  
keep=find(Data.Lat>=Data.Lat(1)-0.3 & Data.Lat<=Data.Lat(1)+0.3);
fprintf(['Number of Data deleted (Data.Lat~=',num2str(Data.Lat(1)),'): ',int2str(size(Data.Year,1)-size(keep,1)) '\n'])

    Data.Year    = Data.Year(keep);
    Data.Month   = Data.Month(keep);
    Data.Day     = Data.Day(keep);
    Data.Hour    = Data.Hour(keep);
    Data.NMeteor = Data.NMeteor(keep);
    Data.Frang   = Data.Frang(keep);
    Data.Rsep    = Data.Rsep(keep);
    Data.Vx      = Data.Vx(keep);
    Data.Vy      = Data.Vy(keep);
    Data.Lat     = Data.Lat(keep);
    Data.Lon     = Data.Lon(keep);
    Data.Vm      = Data.Vm(keep);
    Data.Vm_lat  = Data.Vm_lat(keep);
    Data.Vm_lon  = Data.Vm_lon(keep);
    Data.SD_Vx   = Data.SD_Vx(keep);
    Data.SD_Vy   = Data.SD_Vy(keep);
    Data.DateNum = datenum(Data.Year,Data.Month,Data.Day,Data.Hour,0,0);
   
  if strmatch(Name,{'Kapuskasing'})>0
  fprintf(['Number of Data deleted, wrong data Kapuskasing: ',int2str(size(Data.Year,1)-size(keep,1)) '\n'])
  
  keep=find(Data.DateNum<=datenum(2009,3,4) | Data.DateNum>=datenum(2010,4,10));
  Data.Year    = Data.Year(keep);
    Data.Month   = Data.Month(keep);
    Data.Day     = Data.Day(keep);
    Data.Hour    = Data.Hour(keep);
    Data.NMeteor = Data.NMeteor(keep);
    Data.Frang   = Data.Frang(keep);
    Data.Rsep    = Data.Rsep(keep);
    Data.Vx      = Data.Vx(keep);
    Data.Vy      = Data.Vy(keep);
    Data.Lat     = Data.Lat(keep);
    Data.Lon     = Data.Lon(keep);
    Data.Vm      = Data.Vm(keep);
    Data.Vm_lat  = Data.Vm_lat(keep);
    Data.Vm_lon  = Data.Vm_lon(keep);
    Data.SD_Vx   = Data.SD_Vx(keep);
    Data.SD_Vy   = Data.SD_Vy(keep);
    Data.DateNum = datenum(Data.Year,Data.Month,Data.Day,Data.Hour,0,0);
  end
    save(fullfile(DataFolder,Name,Data.Name),'Data')
  

end