function [BTemp] = brittemp(wn,radiance)
%
%   ....This script converts radiance [in W/(m2 sr m)] into brightness
%       temperatures.  Since I usually use mW/(m2 sr (cm-1)) for 
%       radiance, these must first be converted to W/(m2 sr m).

h = 6.626e-34;
csl = 3.0e+8;
k = 1.381e-23;

%
%   ....Determines the wavelengths from the wavenumbers.
%
wv = 1. ./ (wn*100.);

%
%   ....Converts radiance  to  W/(m2 sr m) from mW/(m2 sr (cm-1)).
%
tmprad = radiance .* (wn.^2) / (1.e+3 * 1.e-2);


%
%   ....Converts from radiance to brightness temperature.
%
BTemp = (h*csl) ./ (wv*k) ./ log( (2.*h*csl*csl) ./ ( tmprad .* (wv.^5) ) + 1. );
