% This a Matlab script that calls the BAO tower plotting
% functions one at a time with the beginning and ending
% year-day or month and the year.
% DEW 2/13/2014  Editting so I can run from my PC
% taking out BAO in path
% making it so everything runs all the and used input date.

try
    cd('z:\Tower\Programs');
    userpath('z:\Tower\Programs');
    
    d = load ('z:\Tower\Raw\dates.dat');
   %2014 02 13 2014 02 13 This is what is in the file Feb 10,2014 10:43
   %local updates every 5 mins I think

%     by = d(1);
%     bm = d(2);
%     bd = d(3);
%     ey = d(4);
%     em = d(5);
%     ed = d(6);
    
    by = 2016;
    bm = 7;
    bd = 11;
    ey = 2016;
    em = 7;
    ed = 28;
    
    % From my PC this is local time
    ct = clock(); %  2.0140    0.0020    0.0130    0.0110    0.0030    0.0300
    
    % DEW  Don't want to update current plots
    %retval = bao10100300_24hour_func( );  
    
    retval = BAOPLTSFC_loop_func(by,bm,bd,ey,em,ed);
    retval = BAOPLT10_loop_func_new(by,bm,bd,ey,em,ed);
    retval = BAOPLT100_loop_func(by,bm,bd,ey,em,ed);
    retval = BAOPLT300_loop_func(by,bm,bd,ey,em,ed);
    
    retval = bao10100300_daily_func(by,bm,bd,ey,em,ed);
    retval = baoozone_daily_func( by,bm,bd,ey,em,ed);
    
    retval = baotls_loop_func( by, bm, bd, ey, em, ed );
    
    % DEW mod to run always
    if 1 %(mod(ct(4),4) == 0) && (ct(5) > 5 && ct(5) < 11) % only run if mins at >5 and < 11
        retval = BAOPLTSFC_month_loop_func(by,bm,bd,ey,em,ed);
        retval = BAOPLT10_month_loop_func_new(by,bm,bd,ey,em,ed);
        retval = BAOPLT100_month_loop_func(by,bm,bd,ey,em,ed);
        retval = BAOPLT300_month_loop_func(by,bm,bd,ey,em,ed);
        
        %retval = bao10300_month_loop_func(by,bm,bd,ey,em,ed);
        retval = bao10100300_month_loop_func(by,bm,bd,ey,em,ed);
        retval = baoozone_monthly_func( by,bm,bd,ey,em,ed);
        
        retval = bao10300_month_rosehist_func( by, bm, bd, ey, em, ed );
    end
    
    cd('z:\Tower\Programs');
   
% DEW commented out 2/13/2014    
% catch ME
%     dd = clock;
%     fid = fopen( 'c:\matlab\logs\matlab_try.log','a');
%     fprintf(fid,'%4d-%02d-%02d %02d:%02d:%02d %s\n',...
%         dd(1),dd(2),dd(3),dd(4),dd(5),dd(6),ME.message);
%     exit
end

%exit

