function scsm = read_SKQ1min_SeaState_2015(ddd,path_working_ddd)
%{
Reads daily Sikuliaq ship data - 1-min 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 1440x46 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: mb_em302_centerbeam - Latitude [Decimal Degrees]                  
  Column #17: mb_em302_centerbeam - Longitude [Decimal Degrees]                 
  Column #18: mb_em302_centerbeam - Depth [Meters]                              
  Column #19: met_ptu307 - Atmospheric pressure[hPa]                            
  Column #20: met_ptu307 - Air Temperature[C]                                   
  Column #21: met_ptu307 - Relative Humidity[ ]                                 
  Column #22: tsg_sbe45_fwd - Temperature [C]                                   
  Column #23: tsg_sbe45_fwd - Conductivity [S/m]                                
  Column #24: tsg_sbe45_fwd - Salinity [psu]                                    
  Column #25: tsg_sbe45_fwd - Speed of Sound [m/s]                              
  Column #26: thermo_sbe38_incubator - Temperature [C]                          
  Column #27: wind_gill_fwdmast - Relative wind direction, 0 to 359 degrees     
  Column #28: wind_gill_fwdmast - Relative wind speed, M[m/s]                   
  Column #29: wind_gill_fwdmast_true - Wind direction, 0 to 359 degrees,T[True] 
  Column #30: wind_gill_fwdmast_true - Wind speed, M[m/s]                       
  Column #31: rad_psp-pir - PIR (thermopile, mV)                                
  Column #32: rad_psp-pir - LW (computed longwave downwelling irradiance,Wm**2) 
  Column #33: rad_psp-pir - TCASE (PIR case temperature, C)                     
  Column #34: rad_psp-pir - TDOME (PIR dome temperature, C)                     
  Column #35: rad_psp-pir - SW (computed shortwave downwelling irradiance,Wm**2)
  Column #36: rad_qsr2150a - PAR (uE/m2 sec)                                    
  Column #37: thermo_pyrometer-ct15 - Sea Surface skin temperature (deg C)      
  Column #38: flow_krohne_fwd - flow speed [m/s]                                
  Column #39: flow_krohne_fwd - volume flow [l/min]                             
  Column #40: flow_krohne_fwd - coil temperature [C]                            
  Column #41: flow_krohne_fwd - conductivity [S/m]                              
  Column #42: gyro_1 - Heading [Degrees]                                        
  Column #43: gyro_1 - Rate of Turn                                             
  Column #44: speedlog - Longitudinal water speed [m/s]                         
  Column #45: speedlog - Transverse water speed [m/s]                           
  Column #46: speedlog - Longitudinal ground speed [m/s]                        
  Column #47: speedlog - Transverse ground speed [m/s]                          
  Column #48: wind_mast_port_true - Wind direction, 0 to 359 degrees,T[True]    
  Column #49: wind_mast_port_true - Wind speed, M[m/s]
  Column #50: wind_mast_stbd_true - Wind direction, 0 to 359 degrees,T[True]    
  Column #51: wind_mast_stbd_true - Wind speed, M[m/s] 
%}

scsm = NaN(1440,46);
delta = double(1.0/1440);
last = ddd + 1439*delta;
jd_ref = [ddd:delta:last]; % ref 1-min timestamp
scsm(:,1) = jd_ref';

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

% timestamp should be on exact 1-min 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)));
    scsm(dd,2:end) = temp(ii,7:end);
end
