function [U, V, T] = prcMetsys(mooring)

files = getDeployments(mooring, 'metsys');
numFiles = length(files);

% V stores full north south component
% U stores full East-West component
U = [];
V = [];
T = [];

% This loop will produce Daily averages of all data in the deployments directory
for i = 1:numFiles
    
    fprintf(1, 'Processing %s...', files{i});
    ncfile = netcdf(files{i});    % Open each file
    time   = nctime(ncfile);            % Time axis of each netcdf file
    nTime  = length(time);            % Number of samples along time axis
    time2  = floor(time);             % Floor time to integer precision (nearest day)
    day    = [min(time2):max(time2)]';       
    nDay   = length(day);
    
    uDailyMean  = ones(nDay, 1);            % Temporary storage of variables
    vDailyMean  = ones(nDay, 1);
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % Do a daily averaging first
    for j = 1:nDay
        
        currentDay = day(j);
        good  = find(time2 == currentDay);
        
        if (~isempty(good))
            
            sName = 'wind_speed';
            dName = 'wind_dir';
            
            %===================================
            % Get speed and flag all bad values
            s     = ncfile{sName}(good, :, 1, 1);
            
            if (j == 1)
                missingValue = ncfile{sName}.missing_value(:);
                fillValue = ncfile{sName}.FillValue_(:);
            end
            
            if (~isempty(missingValue)) 
                s(find(s == missingValue)) = NaN;
            end
            
            
            if (~isempty(fillValue)) 
                s(find(s == fillValue)) = NaN;
            end
            
            sFlag = ncfile{[sName '_flag']}(good, :, 1, 1);
            if (~isempty(sFlag)) 
                s(find(sFlag ~= 0)) = NaN;
            end
            
            %======================================
            % Get direction and flag all bad values
            d     = ncfile{dName}(good, :, 1, 1);
            
            if (j ==1)
                missingValue = ncfile{dName}.missing_value(:);
                fillValue = ncfile{dName}.FillValue_(:);
            end
            
            if (~isempty(missingValue)) 
                d(find(d == missingValue)) = NaN;
            end
            
            
            if (~isempty(fillValue)) 
                d(find(d == fillValue)) = NaN;
            end
            
            dFlag = ncfile{[dName '_flag']}(good, :, 1, 1);
            if (~isempty(dFlag)) 
                d(find(dFlag ~= 0)) = NaN;
            end
            
            %==================================
            % Convert polar to cartesian coords
            [u v] = pol2cart(geo2mth_(d)*pi/180, s); % m/s
            
            %%%%%%%%%%%%%%%%%%%%%%
            % Calculate daily mean
            uDailyMean(j, 1) = nanmean(u)';
            vDailyMean(j, 1) = nanmean(v)';
            
            
            
            
        else
            uDailyMean(j, 1) = NaN;
            vDailyMean(j, 1) = NaN;
        end
        
        
    end
    fprintf(1, 'completed\n');
    ncquit(ncfile);
    
    if (~isempty(uDailyMean)) 
        V = [V; vDailyMean];
        U = [U; uDailyMean]; 
        T = [T; day];
    end
    
    
    
end
