% run compile_noref.m to get compile-noref.mat
% run this script to find all measurements on a given day in array allDataCompileNoref
% array allDataCompileNoref (built by compile_noref.m) contains:
    % (:,1) date
    % (:,2) exceldate
    % (:,3) yearday
    % (:,4) lon
    % (:,5) lat
    % (:,6) flr_2m
    % (:,7) chl_2m
    % (:,8) flr_10m
    % (:,9) chl_10m
    % (:,10) flr_15m
    % (:,11) chl_15m
    % (:,12) b100_2m
    % (:,13) b125_2m
    % (:,14) b150_2m
    % (:,15) b_back_2m
    % (:,16) b100_10m
    % (:,17) b125_10m
    % (:,18) b150_10m
    % (:,19) b_back_10m
    % (:,20) b100_15m
    % (:,21) b125_15m
    % (:,22) b150_15m
    % (:,23) b_back_15m
    % (:,24) par_1m
    % (:,25) unknown (is this really flr_1m?)
    % (:,26) par_5m
    % (:,27) flr_5m
    % (:,28) par_10m
    % (:,29) c_10m
    % (:,30) par_20m
    % (:,31) flr_20m
    % (:,32) par_35m
    % (:,33) c_35m
    % (:,34) poc_bb_2m
    % (:,35) poc_bb_10m
    % (:,36) poc_beamc_10m
    % (:,37) poc_bb_15m
    % (:,38) poc_beamc_35m
% builds these arrays for first measurement of the day:
    % chl_2m_compile (:,1) chl at 2m
    % chl_10m_compile (:,1) chl at 10m
    % chl_15m_compile (:,1) chl at 15m
    % b_back_2m_compile (:,1) b_back at 2m
    % b_back_10m_compile (:,1) b_back at 10m
    % b_back_15m_compile (:,1) b_back at 15m
    % c_10m_compile (:,1) c_10m at 10m
    % c_35m_compile (:,1) c_35m at 35m
% saves min_sutton.mat
close all
clear all
load 'C:\Documents and Settings\Lisa Taylor\My Documents\Data\COASOSU\compile-noref'
j=1;
for i=1:73 %number of different days in compile_noref.txt (one less than excel says)
    I=find(datenum(datestr(allDataCompileNoref(:,1)))-datenum(datestr(allDataCompileNoref(j,1)))<1 & datenum(datestr(allDataCompileNoref(:,1)))-datenum(datestr(allDataCompileNoref(j,1)))>=0);
%   compares allDataCompileNoref(1,1) to allDataCompileNoref(1,1)
%   compares allDataCompileNoref(2,1) to allDataCompileNoref(1,1)
%   compares allDataCompileNoref(3,1) to allDataCompileNoref(1,1) and so on...all <1 are found (all dates from same day)
    chl_2m_compile(i)=allDataCompileNoref(min(I),7); %then stores chl at minimum time in array chldata
    chl_10m_compile(i)=allDataCompileNoref(min(I),9);
    chl_15m_compile(i)=allDataCompileNoref(min(I),11);
    b_back_2m_compile(i)=allDataCompileNoref(min(I),15);
    b_back_10m_compile(i)=allDataCompileNoref(min(I),19);
    b_back_15m_compile(i)=allDataCompileNoref(min(I),23);
    c_10m_compile(i)=allDataCompileNoref(min(I),29);
    c_35m_compile(i)=allDataCompileNoref(min(I),32);
    time_compile(i)=datenum(datestr(allDataCompileNoref(min(I),1))); %minimum time    
    j=max(I)+1;
end
%
save min_sutton -v6