%rd_lights % Plot light status file from BAO function [retval] = baotls_loop_func( by, bm, bd, ey, em, ed ) pltflg = 1; %flag to plot the data: 1=yes, 0=no pngflg = 1; %flag to make a png of the plot: 1=yes, 0=no if ispc inpath = 'z:\bao\Tower\Lights\Data\'; outpath = 'z:\bao\Tower\Lights\images\'; else inpath = '/archive/BAO/Lights/Data/'; outpath = '/archive/BAO/Tower/Lights/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]); %1 2 3 4 5 6 7 8 9 10 11 12 13 14 %ID YR YD hhmm L1 L2 L3 L4 L5 L6 L7 L8 L9 Bat %12,2009,8,1731,-.413,-.446,-.392,-.432,-.398,-.453,-.389,-.451,-.361,13.7 %12,2009,8,1741,-.413,-.446,-.392,-.433,-.397,-.453,-.389,-.451,-.361,13.66 %12,2009,8,1751,-.413,-.446,-.391,-.433,-.397,-.453,-.388,-.452,-.36,13.63 for i = bdn:edn dv=datevec(i); yday = md2yd( dv(1), dv(2), dv(3) ); name10 = sprintf('BAO_010_%4d%03d.dat', dv(1), yday ); fprintf(1,'*** Processing %s ***\n', name10 ); fid10 = fopen( name10 ); if( fid10 > 0 ) fclose( fid10 ); else fprintf(1,'No 10m: %s\n',name10); continue; end data10 = load(name10); %load 1 day of PSD mean logger data hhmm = data10(:,4); hh = fix(hhmm/100); mm = hhmm - (hh*100); data10(:,3) = data10(:,3) + (((mm/60.) + hh)/24); %decimle year day clear hhmm hh mm if pltflg %skip plotting figure(1) clf subplot(3,1,1),plot(data100(:,3),data100(:,5:7)) ylim([-2 2]) %xlim([16,21]) ylabel('Volts') title('BAO Tower Lights Status'); legend('1','2','3','Location','BestOutside'); subplot(3,1,2),plot(data100(:,3),data100(:,8:10)) ylim([-2 2]) ylabel('Volts') %xlim([16,21]) legend('4','5','6','Location','BestOutside'); subplot(3,1,3),plot(data100(:,3),data100(:,11:13)) ylim([-2 2]) ylabel('Volts') xlabel('Year Day (UTC)'); %xlim([16,21]) legend('7','8','9','Location','BestOutside'); ll = length(data100); jd = fix(data100(ll,3)); jds = num2str(jd); if pngflg print_buffer = [outpath 'Lights_' dt '_WS.png']; print('-dpng ', print_buffer); end end % skip plotting