%BAOPLT10100300 % Plot daily combined data for levels 10, 100 and 300 meters. function [retval] = baoozone_monthly_func( by, bm, bd, ey, em, ed ) %clear pltflg = 1; % do the plot 1=yes 0=no pngflg = 1; % save data to png's flag 1= yes 0 = no if ispc inpath = 'z:\bao\Tower\Ozone\Processed\monthly\'; outpath = 'z:\bao\Tower\Ozone\Processed_Images\'; else inpath = '/archive/BAO/Tower/Ozone/Processed/'; outpath = '/archive/BAO/Tower/Ozone/Processed_Images/'; end %cd(inpath); if( nargin == 0 ) bys = input('Input year to process (2007) ','s'); bms = input('Input the month to process (1-12) ','s'); bds = input('Input the beginning day to process (1-31) ','s'); eys = input('Input year to process (2007) ','s'); ems = input('Input the month to process (1-12) ','s'); eds = input('Input end day to process (1-31) ','s'); by = str2double( bys ); bm = str2double( bms ); bd = str2double( bds ); ey = str2double( eys ); em = str2double( ems ); ed = str2double( eds ); end bdn = datenum([by bm bd 0 0 0]); edn = datenum([ey em ed 0 0 0]); bdv=datevec(bdn); edv=datevec(edn); yr = bdv(1); mo = bdv(2); nloops = edv(2) + (edv(1) - bdv(1)) * 12 - bdv(2) + 1; nmax = 90000; for i = 1:nloops %name10 = sprintf('%sBAO_010_%4d%02d.dat', inpath, yr, mo ); name300 = sprintf('%sBAO_OZ3_%4d%02d.dat', inpath, yr, mo ); %fprintf(1,'*** Processing 10m and 300m monthly ***\n'); fprintf(1,'*** Processing 300m monthly %d %d ***\n',yr,mo); fid300 = fopen( name300 ); if( fid300 > 0 ) fclose( fid300 ); else fprintf(1,'No 300m: %s\n',name300); continue; end [data300 dt n] = load300ozone( name300, nmax); jdb = fix(dt(1,7)); jde = fix(dt(n,7))+1; if pltflg %skip plotting figure1 = figure('Position',[10 50 650 650]); plot(dt(1:n,7),data300(1:n,1),'r') stitle=sprintf('BAO %4d-%02d Ozone **Not Calibrated**', yr, mo); title(stitle) elim = max(data300(1:n,1))+5; xlim([jdb,jde]) ylabel('O3 (PPB)') xlabel('Day (UTC)') datetick('x','mm/dd','keeplimits','keepticks'); legend('300m','Location','NorthEast','Orientation','horizontal'); legend('boxoff'); axis tight grid on ylim([0 elim]) annotation(figure1,'textbox',[0.007154 0.01077 0.4498 0.02462],... 'String',{'NOAA/ESRL PSD and GMD'},... 'FontSize',8,'FitBoxToText','off','LineStyle','none'); if pngflg print_buffer = sprintf('%sBAO_10300_%4d%03d_Ozo.png',... outpath, yr, mo ); set(gcf,'PaperPositionMode','auto'); print('-dpng', print_buffer); %f=getframe(gcf); %imwrite(f.cdata,print_buffer,'png'); end end % skip plotting clear data300 dt %data10 data100 close all mo = mo + 1; if mo > 12 mo = mo - 12; yr = yr + 1; end end %loop through days retval = 0;