function [jd_gps,Hor_acc,Vert_acc,Heave,Roll,Pitch]=read_rawSCS_MRU(ddd,hhh,year)


%reads in the raw GPS files from SCS system
[m,d]=yd2md(str2num(year), ddd);
% MRUs data is 10 Hz
nsampl=36000*1;
ncols=11;
jd_gps=NaN+zeros(1,nsampl*1.01); % preallocate with tiny 1% buffer
st2=NaN+zeros(ncols,nsampl*1.01);

jax1=1;jd1=[];
jd=sprintf('%03i',ddd);

way_raw_data_flux='S:\cruises\HIWINGS_2013\Knorr\SCS\Raw\kn213-03\underway\raw\';
% for jam=00:23
    hr=sprintf('%02i',hhh);
    dfl=[way_raw_data_flux,'kn2013', sprintf('%02i',m), sprintf('%02i',d), '_', hr, '00.MRU'];
    disp(['Reading gps file  ',dfl])
    flist=fopen(dfl);
%     stx=[];temp=[];
   
    if flist>0

        test =textscan(flist,'MRU %4f/%2f/%2f %2f:%2f:%f POSMV :%s %5f%*c%5f %5f %*[^\n]','emptyvalue', NaN);    
        accs=char(test{7});
        Hor_acc=hex2dec(accs(:,1:2));  %09       (.9 cm/sec^2)
        Vert_acc_b=hex2dec(accs(:,5))*10+hex2dec(accs(:,6));
            Vert_acc_b(Vert_acc_b<100)=Vert_acc_b(Vert_acc_b<100)/100;
            Vert_acc_b(Vert_acc_b>=100)=Vert_acc_b(Vert_acc_b>=100)/1000;

        Vert_acc=str2num(accs(:,3))*10+hex2dec(accs(:,4))+Vert_acc_b;  %0048     (.48 cm/sec^2)

        clear Vert_acc_b accs

        stx=[test{1} test{2} test{3} test{4} test{5} test{6} Hor_acc Vert_acc test{8} test{9} test{10};]';

        [nr1,nl1]=size(stx);
        st2(:,jax1:jax1+nl1-1)=stx;
%         jd1=ddd + (hhh+(st2(4,jax1:jax1+nl1-1)+(st2(5,jax1:jax1+nl1-1)+st2(6,jax1:jax1+nl1-1))/60)/60)/24;
%         jd_gps(:,jax1:jax1+nl1-1) = jd1;
        jax1=jax1+nl1;
        
    fclose(flist); % 
    else
        disp(sprintf('\b<--File not found.'))
    end;
% end;

% trim arrays to their filled size
st2=st2(:,1:jax1-1);
% jd_gps=jd_gps(:,1:jax1-1);
jd_gps=datenum(st2(1,:),st2(2,:),st2(3,:),st2(4,:),st2(5,:),st2(6,:))-datenum(2013,1,0);

Hor_acc=st2(7,:);  %cm/sec^2
Vert_acc=st2(8,:); %cm/sec^2
Heave =st2(9,:);   %cm
Roll=st2(10,:)/100;    %deg
Pitch=st2(11,:)/100;   %deg

