function scsm = read_scs_day_STRATUS_2017(path_working_ddd,ddd,yyyy,PosLims)
%{
Reads hourly scs files for one day and returns array with the
following columns:

1   jd_ref      1 Hz timestamp
2   lat         latitude deg, N positive
3   lon         longitude deg, E positive
4   cogm        gps course over ground, deg
5   sogm        gps speed over ground, m/s
6   tsgm        tsg sst from ship intake
7   tssm        tsg salinity
8   imrh        RH
9   imta        Air temp, C
10  imsol       psp radiation, W/m2
11  orgm        rain, mm/hr
12  lrg         laser ring gyro heading, deg
13  imum        true wind speed, m/s
14  imdm        true wind directin, deg
15  imir        pir radiation, W/m2
16  imPress     air pressure, mb
17  imqa        air specific humidity, g/kg

input parameters: path_working_ddd = path to daily data folder
                  ddd = julian date
                  yyyy = year string
                  PosLims = lat/lon limits for filtering position data
%}

fclose all;

scsm = NaN(86400,17);
delta = double(1.0/86400);
last = ddd + 86399*delta;
jd_ref = ddd:delta:last;	% ref 1 Hz timestamp
scsm(:,1) = jd_ref(1:end)';
jd = sprintf('%03i',ddd);

for hhh = 0:23              % cycle thru 24 hourly gprm files
    hr = sprintf('%02i',hhh);
    dfl = fullfile(path_working_ddd,['scs0' yyyy(3:4),jd,hr,'_raw.txt']);
    if exist(dfl,'file')==2
        scs = read_scs_STRATUS_2017(dfl,ddd,hhh,PosLims);
    else
        continue % no data this hour
    end
    jd_scs = scs(:,1);
    ii = find(abs(jd_ref-jd_scs(1))<double(0.5/86400));
    scsm(ii:ii+3599,2:17) = scs(:,2:17);
end
end
