%Script used for processing EXO2 data that has been collected using the CHSD Profiler.
%
%This program computes loops through the excel files containing EXO2 CTD data, 
%with filenames listed below (CTDname). 
%
%Calls the following functions or scripts (Be sure they are in your matlab path or in the folder you are running this in):
%
%1. convertYSI6600_profile2MAT: which will take the micro CTD files in 
%the filename below and removes the headers and makes a structure array of
%the data 
%2.getaverageCTDL which will get the average data from TSS depths, the start and stop times and the number of records
%averaged. Note be sure to choose profile first and depth indexes from top to bottom
%
%Replace the files in "CTDname" to match the cruise's sample names
%
% Based off GetYSI6600_CTD_profile_AVGdata.m Orginially written by G. Massey 
%
%KAF Aug 2016
%
%% 
clear 

%Update Cruise name and ctd file names (CTDname) for each cruise 
cruise='YR160414';

Date=[2016 04 14];
CTDname=cellstr([
'C5617'
'C5618'
'C5619'
'C5620'
'C5621'
'C5622'
]);

folder=('/Users/kelsey/Desktop/Dissertation/Profiler Surveys/York River/Axial Surveys/YR160414-Yktwn2WestPoint/CTD');

%Enter Distance from the York River Mouth (or reference point of your choice).

distance=[10
    20
    30
    40
    50
    60];


for ii=1:length(CTDname)

convertEXO2_profile2MAT (char(CTDname(ii))); 
 
 
getaverageEXO2(char(CTDname(ii)));

end

create_data_struct_csv_profiler_EXO2(cruise,folder,distance,CTDname)

