disp('read_PR_08') clear close all fclose('all'); % read in and plot Pitch and roll plots for MMCR from ICEALOT way_raw_mmcr = 'c:\data\icealot\data\mmcr\motion\'; way_raw_mmcr = 'y:\knorr\mmcr/PR\'; day =input('Input yearday to process (079): '); %Find all the Pitch and roll txt files %20080651500PitchRollLog.txt %15:00:00 -1.949365 -1.269141 %15:00:01 -1.949365 -1.216260 %hh:mm:ss Pitch roll fn1=['*.txt']; s1=[way_raw_mmcr fn1]; dr1=dir(s1); [n1 m1]=size(dr1); mx1=n1; display(['Processing MMCR pitch and roll files']); mx1 ict = 0; fid = -1; for i = 1:mx1 yd = str2num(dr1(i).name(5:7)); if day == yd flnm=dr1(i).name fid=fopen([way_raw_mmcr flnm],'r'); %20080651500PitchRollLog.txt YY = str2num(dr1(i).name(1:4)); %for p = 1:4 % short test read while feof(fid)==0, ict = ict + 1; clear st1 stz; dtmp = fgetl(fid); data1 = dtmp(9:length(dtmp)); C = textscan(data1,'%f%f','CollectOutput',1); tmp = C{:}; st2(ict,:) = tmp(1,:); tim = dtmp(1:8); hh = str2num(tim(:,1:2)); mm = str2num(tim(:,4:5)); ss = str2num(tim(:,7:8)); %calculate year day jdn(ict,1) = yd + ((hh+(mm+(ss/60))/60))/24; end; %end while feof fclose(fid); end % day test end; %end files loop mmcrPR(:,1) = st2(:,1); %pitch mmcrPR(:,2) = st2(:,2); %roll jad = jdn; if 1 tjd = num2str(fix(jad(1))); if length(tjd) == 2 jds(2:3) = tjd; jds(1) = '0'; %make jd 3 characters end if length(tjd) == 3 jds = tjd; end jds(2:3) = tjd; jds(1) = '0'; %make jd 3 characters s = 'c:\data\icealot\data\comparisons\'; figure;plot(jad,mmcrPR(:,1),'b',jad,mmcrPR(:,2),'g'); title(' MMCR Motion'); xlabel('Year Day (UTC)') ;ylabel('degrees'); ylim([-10,10]) legend('Ptich','Roll','Location','Best') print_buffer = [s 'ICEALOT_mmcr_PR_' jds '.png']; print('-dpng ', print_buffer); end %skip any plots %Save temperature profile to a file for calculating pwv % after save date/time info in same array [r,c] = size(mmcrPR); mmcrPR(:,c+1) = jad; if 1 f=['c:\data\icealot\data\mmcr\ICEALOT_PR_' jds '.txt']; flist=fopen(f,'w'); save( f, 'mmcrPR', '-ascii','-tabs') fclose('all'); end;