function gprm = auto_read_gps_day_STRATUS_2017(path_working_ddd,ddd,yyyy,PosLims)
%{
Reads hourly gprm files for one day
Loops through 24 hours, calling auto_read_gprm_STRATUS_2017 for each hour
Raw 2Hz data is averaged to 10 min output

Inputs: path_working_ddd: path to daily folder containing hourly files
        ddd: day-of-year variable
        yyyy: year string

Output: gprm: 144 x 7 array of 10-min avg gps data
        Returns NaN for data gaps

        1   jd_ref      1 Hz timestamp
        2   cog         cog, deg
        3   sog         sog, kts
        4   Ngps        filtered N component of ship speed, m/s
        5   Egps        filtered E component of ship speed, m/s
        6   lat         latitude (N positive)
        7   lon         longitude (0-360 deg, east)
%}

fclose all;

gprm = NaN(144,7);
delta = double(10/1440);
last = ddd + 144*delta;
jd_bin = ddd:delta:last; jd_bin = jd_bin';	% ref 10 min timestamp
gprm(:,1) = jd_bin(1:end-1);
jd = sprintf('%03i',ddd);

for hhh = 0:23              % cycle thru 24 hourly 2 Hz gprm files
    hr = sprintf('%02i',hhh);
    dfl = fullfile(path_working_ddd,['gprm' yyyy(3:4),jd,hr,'_raw.txt']);
    if exist(dfl,'file')==2
        gps = auto_read_gprm_STRATUS_2017(dfl,ddd,hhh,PosLims);
    else
        continue % no data this hour
    end
    
    % average this hour's data into 10min gprm array
    start = ddd + hhh/24.0; % jd start time this hour
    diff = jd_bin - start;  % look for closest time stamp to start
    [~,ii] = min(abs(diff));
    temp = interval_avg(gps(:,1), gps(:,2:7), jd_bin(ii:ii+6));
    gprm(ii:ii+5,2:7) = temp(:,2:7);
end

% recompute cog/sog from averaged E/N speed components
cogm_10 = atan2(gprm(:,5), gprm(:,4))*180/pi;
cogm_10 = mod(cogm_10 + 360*3, 360);
sogm_10 = sqrt(gprm(:,5).^2 + gprm(:,4).^2);
gprm(:,2) = cogm_10;
gprm(:,3) = sogm_10;

end
