function scs1hz = read_SKQ1sec_SeaState_2015(ddd,path_working_ddd)
%{
Reads daily Sikuliaq ship data - 1-sec avg values produced by the
    parseSKQunderway_1min_1sec.m script.

Inputs are: ddd: day-of-year variable
            path: string path variable to raw data folder containing
                  SKQ files.

Returns 86400x20 array scsm, with NaN for data gaps.

Input file format:
 Column #1: Year                                                             
 Column #2: Month                                                            
 Column #3: Day                                                              
 Column #4: Hour                                                             
 Column #5: Minute                                                           
 Column #6: Second                                                           
 Column #7: ins_seapath_position - Latitude [Decimal Degrees]                
 Column #8: ins_seapath_position - Longitude [Decimal Degrees]               
 Column #9: ins_seapath_position - Speed over ground [m/s]                   
 Column #10: ins_seapath_position - Course over Ground [Decimal Degrees True] 
 Column #11: ins_seapath_position - Heading [Degrees]                         
 Column #12: ins_seapath_position - Roll [Degrees]                            
 Column #13: ins_seapath_position - Pitch [Degrees]                           
 Column #14: ins_seapath_position - Heading [Degrees]                         
 Column #15: ins_seapath_position - Heave                                     
 Column #16: wind_gill_fwdmast - Relative wind direction, 0 to 359 degrees    
 Column #17: wind_gill_fwdmast - Relative wind speed, M[m/s]                  
 Column #18: wind_gill_fwdmast_true - Wind direction, 0 to 359 degrees,T[True]
 Column #19: wind_gill_fwdmast_true - Wind speed, M[m/s]                      
 Column #20: gyro_1 - Heading [Degrees]                                       
 Column #21: gyro_1 - Rate of Turn                                            
 Column #22: speedlog - Longitudinal water speed [m/s]                        
 Column #23: speedlog - Transverse water speed [m/s]                          
 Column #24: speedlog - Longitudinal ground speed [m/s]                       
 Column #25: speedlog - Transverse ground speed [m/s]                         
%}

scs1hz = NaN(86400,20);
delta = double(1.0/86400);
last = ddd + 86399*delta;
jd_ref = [ddd:delta:last]; % ref 1Hz timestamp
scs1hz(:,1) = jd_ref';

fin = fullfile(path_working_ddd,['SKQ201512S_underway_',sprintf('%3i',ddd),'_1sec.txt']);
temp = load(fin);

% timestamp should be on exact 1-sec interval
jdscs = md2yd_vn(temp(:,1),temp(:,2),temp(:,3));
jdscs = jdscs + temp(:,4)/24 + temp(:,5)/1440 + temp(:,6)/86400;

% match timestamps and fill scsm array
[nr,nc] = size(temp);
for ii = 1:nr
    [~,dd] = min(abs(jd_ref-jdscs(ii)));
    scs1hz(dd,2:end) = temp(ii,7:end);
end

