% This program uses the matrix of heights for both the low and high mode % of the wind profiler and extracts data from the EDT_LATLON balloon data % at the same height. That data line is written out into a file along with % the date and time. htl=[ 147 203 259 315 371 427 483 539 595 651 706 762 818 874 930 986 1042 1098 1154 1210 1266 1322 1378 1434 1490 1546 1602 1658 1714 1770 1826 1882 1938 1994 2050 2105]; hth=[ 168 266 364 462 560 658 755 853 951 1049 1147 1245 1343 1441 1539 1637 1735 1833 1931 2029 2126 2224 2322 2420 2518 2616 2714 2812 2910 3008 3106 3204 3302 3400 3498 3595]; nmaxl = length(htl); nmaxh = length(hth); cd 't:\CALNEX_2010\Atlantis\balloon\Processed\'; files = dir('*EDT_LATLON.txt'); dt = zeros(6,1); d = zeros(11,1); fnl = fopen('balloonlow.txt','w'); fnh = fopen('balloonhigh.txt','w'); for i = 1:length(files) fprintf(1,'Processing %s\n', files(i).name); fid = fopen( files(i).name); dt(1:5) = sscanf(files(i).name,'%2d%2d%2d%2d%2d'); dt(1)=dt(1)+2000; for j = 1:10 line = fgetl(fid); end nhtl = 1; nhth = 1; while ~feof(fid) line = fgetl(fid); [d]=sscanf(line,'%f'); if ( nhtl <= nmaxl ) if ( d(2) > htl(nhtl) ) %dn = datenum([dt(1) dt(2) dt(3) dt(4) dt(5) d(1)]); %dv = datevec(dn); fprintf(fnl,'%4d %02d %02d %02d %02d %.2f %d %.1f %.1f %.2f %.1f %.1f %.1f %.1f %.7f %.7f %.1f\n',... dt(1:6),htl(nhtl),d(2:11)); nhtl = nhtl + 1; end end if ( nhth > nmaxh ) break; end if ( d(2) > hth(nhth) ) %dn = datenum([dt(1) dt(2) dt(3) dt(4) dt(5) d(1)]); %dv = datevec(dn); fprintf(fnh,'%4d %02d %02d %02d %02d %.2f %d %.1f %.1f %.2f %.1f %.1f %.1f %.1f %.7f %.7f %.1f\n',... dv(1:6),hth(nhth),d(2:11)); nhth = nhth + 1; end end %while fclose(fid); end %for close all