%
%       lab9_answers.m
%
%   ....Written by Von P. Walden
%                  27 April 1998
%         modified by S. Ackerman  15 April 2000

%%%                 Part I.  Displaying MAS data                    %%%

%
%   ....Load the MAS data.
%   ..... observations at 3.7, .6 .8, 11 and 12 microns
%   ..... spatial resolution approximately 50 m
%   ..... type whos after loading to list data names
%
clear all
load lab9.mat

%
%   ....Plot the data.
%
%  make an image of the 0.6 micron band
h = image(ref0_6);
set(h,'CDataMapping','scaled');
caxis([0 1])
colorbar('horiz')
title('MAS data (band 2, 0.6 um), 960502, Denver, CO')

%  make an image of the 0.86 micron band in reflectance
figure
h = image(ref0_8);
set(h,'CDataMapping','scaled');
caxis([0 1])
colorbar('horiz')
title('MAS data (band 6, 0.8 um), 960502, Denver, CO')

figure
%  make an image of the 3.7 micron band, in brightness temperature
h = image(bt3_7);
set(h,'CDataMapping','scaled');
colorbar('horiz')
title('MAS data (band 31, 3.7 um), 960502, Denver, CO')

figure
%  make an image of the 11 micron band, in brightness temperature
h = image(bt11);
set(h,'CDataMapping','scaled');
colorbar('horiz')
title('MAS data (band 45, 11 um), 960502, Denver, CO')

figure
%  make an image of the 12 micron band, in brightness temperature
h = image(bt12);
set(h,'CDataMapping','scaled');
colorbar('horiz')
title('MAS data (band 46, 12 um), 960502, Denver, CO')

%%%          Part II.  Cloud Detection by Thresholds                %%%
% Look at color bars on 5 figures created above.

%%%    Part III.  Cloud Detection using Combinations of Channels    %%%

%  here's how to plot an image of the
%  brightness temperature (BT) at 11 microns minus BT at 12 microns
figure
h = image(bt11 - bt12);
set(h,'CdataMapping','scaled');
colorbar('horiz')
title('MAS data (11 um - 12 um), 960502, Denver, CO')


%%%    Part IV.  Cloud Detection using Scatter Plots                %%%
figure
hold on % keep figure to plot on
%  plot a region of the figure
plot(bt11(500:550,50:75)-bt12(500:550,50:75),bt11(500:550,50:75),'b.')
xlabel('bt11 - bt12 (K)')
ylabel('bt11 (K)')
title('Brightness Temperature Difference plot for various scene types')
h = text(2.5,305,'CLEAR');
set(h,'Color','b')

% Thin cloud
plot(bt11(250:300,275:300)-bt12(250:300,275:300),bt11(250:300,275:300),'g.')
h = text(7,260,'Thin Cloud');
set(h,'Color','g')
% Thick cloud
plot(bt11(625:650,250:275)-bt12(625:650,250:275),bt11(625:650,250:275),'r.')
h = text(.5,240,'Thick Cloud');
set(h,'Color','r')
hold off

