%This program is made daily sensitive to the data from the Vaissala ceilometer CL31
clear all;
fclose('all');
% modified 2/18/2014 DWolfe to manually enter date/time to process

%enter path of the raw data:
% raw_data_path=way_raw_data_ceilo;%'S:\GOMECC_2007\RHB\Ceilometer\Raw\';

%enter path of where to put the processed data:
% processed_data_path='C:\Data\CRUISES\RHB_Setup_Charleston-11-16_March_2007\ceilometer\test\OnRHB\';
% processed_data_path=way_proc_data_ceilo;%'S:\GOMECC_2007\RHB\Ceilometer\Processed\';

%enter path of where to put the processed images:
% process_images_path='C:\Data\CRUISES\RHB_Setup_Charleston-11-16_March_2007\ceilometer\test\OnRHB\';
% process_images_path=way_images_ceilo;%'S:\GOMECC_2007\RHB\Ceilometer\Raw_Images\';%
% modified read-parameters_BAO to find data on Z: my mapped drive
read_parameters_BAO;
cruise_name=[cruise year];%'WGC';
YM=input('Input year and month and day to read ( Mar 26 2014 = 40326).... ','s');

if true % Process all files
    rawdr=dir([way_raw_data_ceilo 'a' YM '*.DAT']);
    ls  ([way_raw_data_ceilo 'a' YM '*.DAT']);

    for ifname=1:length(rawdr)
        close all;
        fname=rawdr(ifname).name;
        
        read_daily_rawceilo_CL31_2007a;
        ceilo_daily_plot_program_2007a;
    end
else % process one user-specified file
    %ls([way_raw_data_ceilo '*.DAT'])
    %ls([way_raw_data_ceilo '*.TXT'])
    %fname=input('Input file name to evaluate Aymmddhh.DAT (ex: A7031600.DAT): ', 's');

    dd = clock; 
    % Mods by DEW 11/05/2009 to process only one day
    dd(1) = 2009;
    dd(2) = 10;
    dd(3) = 29;
    dd(4) = 0;
    dd(5) = 0;
    dd(6) = 0;
    %% End of Mods
    edn=datenum(dd(1),dd(2),dd(3),dd(4),dd(5),dd(6));
    bdn=edn-1;
    bdn = edn; %Mod by DEW 11/05/2009 single loop
    for i = bdn:edn
        dv=datevec(i);
        %if i == bdn && dv(4) > 0
        %    continue
        %end
        year = num2str(dv(1));
        fname=sprintf('a%c%02d%02d00.dat', year(4), dv(2), dv(3) )
        read_daily_rawceilo_CL31_2007a;
        ceilo_daily_plot_program_2007a;
    end
end

