function [tEs, lambdaEs, k]= m1_calcHrProd(NumOfDays)

if ~nargin
   NumOfDays = 7;
end

XLim = [now-NumOfDays now];

hr2     = netcdf('\\tsunami.shore.mbari.org\oasis\m1\netcdf\hr2_hr000818.nc');
hr4     = netcdf('\\tsunami.shore.mbari.org\oasis\m1\netcdf\hr4_hr000819.nc');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Get Es
lambdaEs = hr4{'wavelength1'}(:);
Es       = hr4{'Ed_Air'}(:); % W/m^2/nm to uW/cm^2/nm
Es(find(Es == -999)) = NaN;
tEs      = utc2sdn(hr4{'time1'}(:));
[tEs k]  = sort(tEs);
Es       = Es(k,:);

good = find(tEs >= now - NumOfDays);
tEs  = tEs(good);
Es   = Es(good, :);

% Look at Ed
lambdaEd = hr2{'wavelength2'}(:);
Ed = hr2{'Ed_Wet'}(:) * 100; % Convert W/m^2/nm to uW/cm^2/nm
Ed(find(Ed == -999)) = NaN;
tEd = utc2sdn(hr2{'time2'}(:));
[tEd k] = sort(tEd);
Ed = Ed(k,:);

good = find(tEd >= now - NumOfDays);
tEd = tEd(good);
Ed = Ed(good, :);



prop = readProperties('\\tsunami.shore.mbari.org\oasis\cfg\mooring.properties');
lat = sscanf(getProperty(prop, 'm1.latitude'), '%f');
lon = sscanf(getProperty(prop, 'm1.longitude'), '%f');

solZen = solarzenith(tEs, lat, lon);
bad = find(solZen > 85);
R = 1 - fresnel_(solZen);
R(bad) = NaN;      
R(find(R < 0)) = NaN;

for i = 1:size(Es, 2)
   Es(:,i) = Es(:,i) .* R;
end

EdI = ones(size(Es))*NaN;
for i = 1:length(tEs)
   good = near(tEd, tEs(i));
   EdI(i,:) = interp1(lambdaEd, Ed(good, :), lambdaEs)';
end

%save hrProd tEd lambdaEd Ed tEs lambdaEs Es Es
%EdI = griddata(tEd, lambdaEd', Ed', tEs, lambdaEs')';

k = calc_k(Es, EdI, 10.5);

surf(tEs, lambdaEs, real(k'));
shading interp

ncquit(hr2);
ncquit(hr4);