% Read Licors 6262 from Wade (5hz sampling rate)

jd=num2str(ddd);

directory=['E:\CRUISES_RAW_data\GasExIII\UConn_flux\D' jd '\'];
V=[];jd_6262=[];
for jam=hhh(1):hhh(length(hhh))
    if jam==0
        fname=['0' jd '0000' num2str(jam*3600)];
    elseif jam>0 & jam<3
        fname=['0' jd '0' num2str(jam*3600)];
    elseif jam>3
        fname=['0' jd num2str(jam*3600)];
    end;

    filename=[directory fname '.C06']

    [temp]=textread(filename,'','delimiter',',','headerlines',1);
    V=[V;temp];
    
    t6262=0:1/5:(length(temp)*2-1)/10;  %time is s
    jd_6262=[jd_6262 ddd+(jam+t6262/3600)/24];
    
end;

%**************************************************************************
co21=V(:,2); %Licor 834  (left one, P=72)   / unit 1
h2o1=V(:,3); 
t1=V(:,4);   
p1=V(:,5);   
Licor1=cat(2,co21,h2o1,t1,p1);

co22=V(:,6); %Licor 918 (right one, P=62)  /unit 2 
h2o2=V(:,7);
t2=V(:,8);
p2=V(:,9);
Licor2=cat(2,co21,h2o1,t1,p1);

co23=V(:,10); %Licor 598 NULL/ Unit    /  unit 3
h2o3=V(:,11);
t3=V(:,12);
p3=V(:,13);
Licor3=cat(2,co21,h2o1,t1,p1);
%**************************************************************************

[co2air_834,qcell_834,tcell_834,pcell_834] = licor6262(Licor1,1);
[co2air_918,qcell_918,tcell_918,pcell_918] = licor6262(Licor2,2);
[co2air_598,qcell_598,tcell_598,pcell_598] = licor6262(Licor3,3);


% t6262=0:1/5:35999/10;  %time is s
% jd_6262=ddd+(hhh+t6262/3600)/24;

ii=find(~isnan(co2air_834));
specsize=length(co2air_834(ii));
nover=18000-specsize;
[Sc_834,Fc_834]=psd2(detrend(co2air_834(ii)),specsize,5,hamming(specsize));
[Sh_834,Fh_834]=psd2(detrend(qcell_834(ii)),specsize,5,hamming(specsize));
[Scs_834,Fcs_834]=specsmoo(Sc_834,5);
[Shs_834,Fhs_834]=specsmoo(Sh_834,5);

[Sc_918,Fc_918]=psd2(detrend(co2air_918(ii)),specsize,5,hamming(specsize));
[Sh_918,Fh_918]=psd2(detrend(qcell_918(ii)),specsize,5,hamming(specsize));
[Scs_918,Fcs_918]=specsmoo(Sc_918,5);
[Shs_918,Fhs_918]=specsmoo(Sh_918,5);

[Sc_598,Fc_598]=psd2(detrend(co2air_598(ii)),specsize,5,hamming(specsize));
[Sh_598,Fh_598]=psd2(detrend(qcell_598(ii)),specsize,5,hamming(specsize));
[Scs_598,Fcs_598]=specsmoo(Sc_598,5);
[Shs_598,Fhs_598]=specsmoo(Sh_598,5);