function m1_comparePrr2Hr(NumOfDays)

if ~nargin
   NumOfDays = 7;
end

XLim = [now-NumOfDays now];


specprr = netcdf(fullfile(getOasisPath, 'm1', 'netcdf', 'm1_specprr.nc'));
hr2     = netcdf(fullfile(getOasisPath, 'm1', 'netcdf', 'm1_HR2_HR010424.nc'));
hr4     = netcdf(fullfile(getOasisPath, 'm1', 'netcdf', 'm1_HR4_HR010423.nc'));

PaperPosition = [0 0 4 3.25];
webPath = fullfile(getWebPath, 'bog', 'images');

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Look at Es
lambda1 = [412 443 490 510 555 656];
Es1 = [specprr{'Ed412_0_1'}(:) ...
      specprr{'Ed443_0_2'}(:) ...
      specprr{'Ed490_0_3'}(:) ...
      specprr{'Ed510_0_4'}(:) ...
      specprr{'Ed555_0_5'}(:) ...
      specprr{'Ed656_0_6'}(:)];
Es1(find(Es1 == -999)) = NaN;
tEs1 = nctime(specprr);
[tEs1 k] = sort(tEs1);
Es1 = Es1(k,:);

lambdaTmp = hr4{'wavelength1'}(:);
EsTmp = hr4{'Channel_1'}(:) * 100; % Convert W/m^2/nm to uW/cm^2/nm , Ed_Air (i.e Es)
EsTmp = EsTmp';
EsTmp(find(EsTmp == -999)) = NaN;
tEs2 = utc2sdn(hr4{'time1'}(:));
[tEs2 k] = sort(tEs2);
Es2 = Es1(k,:);

Es2 = ones(size(EsTmp,1), length(lambda1));
lambda2 = lambda1*NaN;

for i = 1:length(lambda1)
   good       = near(lambdaTmp, lambda1(i));
   lambda2(i) = lambdaTmp(good);
   Es2(:,i)   = EsTmp(:, good);
end


good = find(tEs1 >= now - NumOfDays);
tEs1 = tEs1(good);
Es1 = Es1(good, :);

good = find(tEs2 >= now - NumOfDays);
tEs2 = tEs2(good);
Es2 = Es2(good, :);

prop = readProperties(fullfile(getOasisPath, 'cfg', 'mooring.properties'));
lat = sscanf(getProperty(prop, 'm1.latitude'), '%f');
lon = sscanf(getProperty(prop, 'm1.longitude'), '%f');
loc = char(getLocationString(lat, lon));

E = frouin(tEs1, lat, lon);
lambdaE = [412 443 490 510 555 670];
n = 0;
for i = 1:length(lambda1)
   n = n + 1;
   figure;
   plot(tEs1, Es1(:,i), '-', 'Color', [.1 .1 .8]);
   hold on
   plot(tEs2, Es2(:,i), '-', 'Color', [.1 .8 .1]);
   plot(tEs1, E(:,i), '-', 'Color', [.8 .1 .1]);
   legend(['Specprr (' num2str(lambda1(i)) ')'], ...
      ['HR4 (' num2str(lambda2(i)) ')'], ...
      ['Clear-sky Model (' num2str(lambdaE(i)) ')'], 0)
   set(gca, 'XLim', XLim, 'XGrid', 'on')
   daytick('x')
   ylabel('\bf{Es (\muW cm^-^2 nm^-^1)}')
   xlabel('\bf{Date}')
   title(['\bf{M1 (' loc ')}'])
   setfontsize(7)
   set(gcf, 'PaperPosition', PaperPosition)
   writegif(fullfile(webPath, ['spec_es' num2str(n)]));
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Look at Ed
lambda1 = [412 443 490 510 555 656];
Ed1 = [specprr{'Ed412_2_1'}(:) ...
      specprr{'Ed443_2_2'}(:) ...
      specprr{'Ed490_2_3'}(:) ...
      specprr{'Ed510_2_4'}(:) ...
      specprr{'Ed555_2_5'}(:) ...
      specprr{'Ed656_2_6'}(:)];
Ed1(find(Ed1 == -999)) = NaN;
tEd1 = nctime(specprr);
[tEd1 k] = sort(tEd1);
Ed1 = Ed1(k,:);

lambdaTmp = hr2{'wavelength2'}(:);
EdTmp = hr2{'Channel_2'}(:) * 100; % Convert W/m^2/nm to uW/cm^2/nm, Ed_Wet
EdTmp(find(EdTmp == -999)) = NaN;
EdTmp = EdTmp';
tEd2 = utc2sdn(hr2{'time2'}(:));
[tEd2 k] = sort(tEd2);
Ed2 = Ed1(k,:);

Ed2 = ones(size(EdTmp,1), length(lambda1));
lambda2 = lambda1*NaN;

for i = 1:length(lambda1)
   good       = near(lambdaTmp, lambda1(i));
   lambda2(i) = lambdaTmp(good);
   Ed2(:,i)   = EdTmp(:, good);
end


good = find(tEd1 >= now - NumOfDays);
tEd1 = tEd1(good);
Ed1 = Ed1(good, :);

good = find(tEd2 >= now - NumOfDays);
tEd2 = tEd2(good);
Ed2 = Ed2(good, :);

n = 0;
for i = 1:length(lambda1)
   n = n + 1;
   figure;
   plot(tEd1, Ed1(:,i), '-', 'Color', [.1 .1 .8]);
   hold on
   plot(tEd2, Ed2(:,i), '-', 'Color', [.1 .8 .1]);
   %plot(tEd2, E(:,i), '-', 'Color', [.8 .1 .1]);
   legend(['Specprr (' num2str(lambda1(i)) ')'], ...
      ['HR2 (' num2str(lambda2(i)) ')'], 0)
   set(gca, 'XLim', XLim, 'XGrid', 'on')
   daytick('x')
   ylabel('\bf{Ed @ 10m (\muW cm^-^2 nm^-^1)}')
   xlabel('\bf{Date}')
   title(['\bf{M1 (' loc ')}'])
   setfontsize(7)
   set(gcf, 'PaperPosition', PaperPosition)
   writegif(fullfile(webPath, ['spec_ed' num2str(n)]));
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Look at Lu
lambda1 = [412 443 490 510 555 656];
Lu1 = [specprr{'Lu412_3_1'}(:) ...
      specprr{'Lu443_3_2'}(:) ...
      specprr{'Lu490_3_3'}(:) ...
      specprr{'Lu510_3_4'}(:) ...
      specprr{'Lu555_3_5'}(:) ...
      specprr{'Lu656_3_6'}(:)];
Lu1(find(Lu1 == -999)) = NaN;
tLu1 = nctime(specprr);
[tLu1 k] = sort(tLu1);
Lu1 = Lu1(k,:);

lambdaTmp = hr2{'wavelength1'}(:);
LuTmp = hr2{'Channel_1'}(:) * 100; % Convert W/m^2/nm to uW/cm^2/nm , Lu_Wet
LuTmp(find(LuTmp == -999)) = NaN;
LuTmp = LuTmp';
tLu2 = utc2sdn(hr2{'time1'}(:));
[tLu2 k] = sort(tLu2);
Lu2 = Lu1(k,:);

Lu2 = ones(size(LuTmp,1), length(lambda1));
lambda2 = lambda1*NaN;

for i = 1:length(lambda1)
   good       = near(lambdaTmp, lambda1(i));
   lambda2(i) = lambdaTmp(good);
   Lu2(:,i)   = LuTmp(:, good);
end


good = find(tLu1 >= now - NumOfDays);
tLu1 = tLu1(good);
Lu1 = Lu1(good, :);

good = find(tLu2 >= now - NumOfDays);
tLu2 = tLu2(good);
Lu2 = Lu2(good, :);
n = 0;
for i = 1:length(lambda1)
   n = n + 1;
   figure;
   plot(tLu1, Lu1(:,i), '-', 'Color', [.1 .1 .8]);
   hold on
   plot(tLu2, Lu2(:,i), '-', 'Color', [.1 .8 .1]);
   %plot(tLu2, E(:,i), '-', 'Color', [.8 .1 .1]);
   legend(['Specprr (' num2str(lambda1(i)) ')'], ...
      ['HR2 (' num2str(lambda2(i)) ')'], 0)
   set(gca, 'XLim', XLim, 'XGrid', 'on')
   daytick('x')
   ylabel('\bf{Lu @ 10m (\muW cm^-^2 nm^-^1 str^-^1)}')
   xlabel('\bf{Date}')
   title(['\bf{M1 (' loc ')}'])
   setfontsize(7)
   set(gcf, 'PaperPosition', PaperPosition)
   writegif(fullfile(webPath, ['spec_lu' num2str(n)]));
end


save m1_comparePrr2Hr tEs1 tEs2 Es1 Es2 tEd1 tEd2 Ed1 Ed2 tLu1 tLu2 Lu1 Lu2

ncquit(specprr);
ncquit(hr2);
ncquit(hr4);
