disp(['read_HMP T rh q: ', cruise]);
% fclose('all');
jd=sprintf('%03i',ddd);

%trh output
% 08/31/2013 20:00 Vaisala model HMP230 (SN: 12222)
% 0000697  91.606, 21.969, 20.543
jax1=1;
ct = 0;

%declare arrays
jax=1;                              %line counter
nr2=6;
trhdata=ones(nr2+1,3600)*NaN;

% for hhh=0:23,					    %cycle thru 24 hourly stats files
    hr=sprintf('%02i',hhh);
%     e=[way_raw_data_flux, yyyy(3:4),jd,'\trh0' yyyy(3:4) jd hr '_raw.txt'];
    e=[way_raw_data_flux, yyyy(3:4),jd,'/trh0' yyyy(3:4) jd hr '_raw.txt'];
    %e=[way_raw_data_flux, 'day',jd,'\met0' year(3:4) jd hr '_raw.txt'];
    disp(['Reading trh file from hour ',e]);
    flist=fopen(e,'r');
    temp=[];stx=[];
    
    if flist>0,					    %if the file exists,
        while ~feof(flist)
            try
                temp =textscan(flist,'%2f%2f%3f %f %f %f  %*[^\n]', 'delimiter', ',', 'headerlines', 1,  'emptyvalue', NaN);
                stx=[stx cell2mat(temp)'];
            catch
                [lnr2,cnr2]=size(temp{1,nr2});
                for ll=1:nr2
                     if length(temp{1,ll})~=lnr2
                         temp{1,ll}(lnr2+1)=[];
                     end;
                end;
                if isempty(temp{1,1}); continue; end
                if isempty(temp{1,1});
                    disp('Should never do this!')
                    temp{1,nr2}=temp{1,nr2}';
                end;
             stx=[stx cell2mat(temp)'];
            end;
        end;  %end while
    
        [nr1,nl1]=size(stx);
        hhrs=ones(1,nl1)*hhh;
        trhdata(:,jax:jax+nl1-1)=[stx' hhrs']';
        jax=jax+nl1;
    
    else
        disp(sprintf('\b<--File not found.'))
        stx=ones(nr2,3600)*NaN;
%         stx(1,:)=ones(1,3600)*hhh; stx(2,:)=ones(1,3600)*hhh;
        [nr1,nl1]=size(stx);
        hhrs=ones(1,nl1)*hhh;
        trhdata(:,jax:jax+nl1-1)=[stx' hhrs']';
        jax=jax+nl1;
    end;      %     end if list
  
% end;                                %end for hhh

% trim arrays to their filled size
% trhdata=trhdata(:,1:jax-1);

RH = trhdata(4,:);
T  = trhdata(5,:);
Td  = trhdata(6,:);
hh = trhdata(7,:);
mm = trhdata(1,:);
ss = trhdata(2,:) + trhdata(3,:)/1000;
jd1 = ddd + (hh+((mm+(ss/60))/60))/24; % time in decimal yearday
            
   