%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PLOT CEILOMETER DAILY AND COMPOSITE TIME SERIES AND BACKSCATTER INTENSITY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
pltflg = 1; % flag to control whether plots are made or not.
yy = year+2000;
data = [way_proc_data_ceilo jdn '_' fn '.txt'];
%scatter_data = [way_proc_data_ceilo  'backscatter_' jdn '_' fn '.mat'];
scatter_data = [way_proc_data_ceilo  'backscatter_' jdn '_' fn '.mat'];

ceil_series = load(data);
load(scatter_data);

ceil_time = ceil_series(:,5)+ceil_series(:,6)/60+ceil_series(:,7)/3600;
if ceil_time(length(ceil_time))==0
    step=diff(ceil_time);
    ceil_time(length(ceil_time))=ceil_time(length(ceil_time)-1)+step(1);
end;

figure()
set(gcf,'DefaultAxesFonts',12);
plot(ceil_time,ceil_series(:,2)/1000,'b.');
xlim([0 24]); set(gca,'xtick',[0:4:24]);ylim([0 7.7]);
xlabel('Time (UTC)','FontName','times','FontSize',16);
ylabel('Height (km)','FontName','times','FontSize',12);
title([cruise ' ' yyyy ' ' jdn '/' fn(1:2) '-' fn(4:5) '-' fn(7:8) ', Ceilometer Cloud Base'],'FontName','times','FontSize',12);
if pltflg
print_buffer = [way_images_ceilo, cruise, '_', yyyy, '_', ship, '_ceilobase_', mon, dy, '_' jdn(1:3), '.png'];
print('-dpng ', print_buffer);
end

figure()
set(gcf,'DefaultAxesFonts',12);
imagesc(ceil_time,ceil_range,log10(max(0,ceil_b))); % abs was goofy
axis xy; colorbar;
xlim([0 24]); set(gca,'xtick',[0:4:24]);ylim([0 7.7]);
xlabel('Time (UTC)','FontName','times','FontSize',12);
ylabel('Height (km)','FontName','times','FontSize',12);
title([cruise ' ' yyyy ' ' jdn '/' fn(1:2) '-' fn(4:5) '-' fn(7:8) ', Ceilometer Backscatter'],'FontName','times','FontSize',12);
if pltflg
print_buffer = [way_images_ceilo, cruise, '_', yyyy, '_', ship, '_ceilobackscatter_', mon, dy, '_' jdn(1:3), '.png'];
print('-dpng ', print_buffer);
end