function [lwr, lwrKz] =  get_lwr(rawdat)
sig_sb=5.67e-8;				        %Stefan Boltzmann constant

% case and dome temperatures for PIR Eppley
Tc1=rawdat(10,:);  %case temperature for PIR Eppley 1 (bridge)
Td1=rawdat(11,:);  %dome temperature for PIR Eppley 1 (bridge)
Tkz=rawdat(19,:);  %temperature for PIR K&Z (bridge)
% thermopile voltages
therm1=rawdat(12,:); %Eppley PIR #1 (bridge)
therm2=rawdat(18,:); %K&Z PIR (bridge)

C2K=273.15;
lwr=therm1+sig_sb*(Tc1+C2K).^4-4*sig_sb*((Td1+C2K).^4-(Tc1+C2K).^4);

% calculation to convert LW to W/M2 for K&Z PIR
% PIRKZ_Cte = 0.01059;  %2011 calibration of K&Z
%20110401 apparrently not used????
lwrKz=therm2+(sig_sb*((Tkz+C2K).^4));

% check this out:
% % calculation to convert LW to W/M2 for K&Z PIR
% PIRKZ_Cte = 0.01059;  %2011 calibration of K&Z
% % pir2=(mean2(16,:)/PIRKZ_Cte)+(sig_sb*((Tkz+273.15).^4));

%

