function [] = create_his_cal_plots(print_flag,filedate)
%
%       function [] = create_his_cal_plots(print_flag,filedate)
%
%   ....This Matlab functions reads the HIS UME files and generates
%       radiance and brightness temperature plots of 10 spectra averages.
%
%       Written by Von P. Walden
%                  19 May 1998
%

%
%   ....Reads in the data.
%
eval(['h5 = umereader(''e:\ac',num2str(filedate),'\cal\hc5n6.ume'');']);
eval(['h3 = umereader(''e:\ac',num2str(filedate),'\cal\hc3n4.ume'');']);
eval(['h1 = umereader(''e:\ac',num2str(filedate),'\cal\hc1n2.ume'');']);

i5 = find(h5.freq > 600  & h5.freq < 1080);
i3 = find(h3.freq > 1080 & h3.freq < 1850);
i1 = find(h1.freq > 2000 & h1.freq < 2700);
wn5 = h5.freq(i5);
wn3 = h3.freq(i3);
wn1 = h1.freq(i1);

%N = fix(length(h5.current_time)/10);
N = 2;
ind = [1:10:N*10; 10:10:N*10];

for k = 1:N,
   
   mrad5 = mean(h5.rad(ind(1,k):ind(2,k),i5));
	mrad3 = mean(h3.rad(ind(1,k):ind(2,k),i3));
   mrad1 = mean(h1.rad(ind(1,k):ind(2,k),i1));
   
	plot(wn5,mrad5,wn3,mrad3,wn1,mrad1)
	axis([600 2700 0 120])
	xlabel('Wavenumber (cm^{-1})')
	ylabel('Upwelling Radiance [mW m^{-2} sr^{-1} (cm^{-1})^{-1}]')
	title(['HIS Radiance Spectra for ,',num2str(filedate)]);
	text(1500,110,[num2str(h5.current_time(ind(k,1))),' - ',num2str(h5.current_time(ind(k,2))),' UTC'])
   eval(['print -djpeg e:\ac',num2str(filedate),'\cal\',num2str(filedate),'_rad',num2str(k),'.jpg'])
   
	plot(wn5,brittemp(wn5,mrad5),wn3,brittemp(wn3,mrad3),wn1,brittemp(wn1,mrad1))
	axis([600 2700 220 300])
	xlabel('Wavenumber (cm^{-1})')
	ylabel('Brightness Temperature (K)')
	title(['HIS Brightness Temperature Spectra for ',num2str(filedate)]);
	text(1000,290,[num2str(h5.current_time(ind(k,1))),' - ',num2str(h5.current_time(ind(k,2))),' UTC'])
   eval(['print -djpeg e:\ac',num2str(filedate),'\cal\',num2str(filedate),'_bt',num2str(k),'.jpg'])

end 

