%
%	This routine plots solar spectral irradiance
%	as a funciton of wavelength.  It is not normalized to a horizontal
%	suface.   
%	
%	Written by S. Ackerman 
%
clear all                       %  good to make sure all your data is zero
load sunspec.out                % load data

wavelength=sunspec(:,1);        % wavelength in microns

solar_toa=sunspec(:,2);         % top-of-atmosphere solar spectral flux
%  don't worry about the following parameters, at least for NOW!

o3coef=sunspec(:,3);            % ozone absorption coefficient

mixcoef=sunspec(:,4);           % CO2, O2 absorption coefficient

h2ocoef=sunspec(:,5);           % water vapor coefficient

o3amount=0.3;                   % set ozone amount (cm)

h2oamount=4.0;                  % set water vapor amount (cm)

solar_zenith=30.;               % set solar zenith angel in degrees

pressure=1013.;                 % set pressure at surface

% ok, back to the plotting........
rad_per_degree=pi/180.;          % radians per degree

% solar_sun is the spectral irradiance (or spectral flux)at the top of the
%    Earth's atmosphere.  We want the spectral irradiance from the Sun's surface
%    By the first test you should understand why I am correcting this
%     earth sun distance is 149597890 km
%     sun radius is         695980 km
solar_sun=solar_toa*(149597890./695980)^2
figure
plot(wavelength,solar_toa,'red');            % plot top-of-atmos solar spec 
axis([0.2 3.6 0 2200]);
xlabel('Wavelength (\mum)');
ylabel('Spectral Flux (W m^{-2} \mum^{-1})');
Title ('Solar flux at Top of Atmosphere');
%  OK, not it is your turn
% plot Spectral Flux (W/m**2/micron) (as a blue line) as a function of the variable wavelength
% for a temperature of 5777.   
T = 5777; 



