% -- % Jeff Sevadjian % Research Technician % Monterey Bay Aquarium Research Institute % 7700 Sandholdt Rd % Moss Landing, CA 95039, USA % ph: +1 831-775-1888 % Parses DATALOG.txt file from OASIS controller. % May only work for specific configurations. %define buoy, deployment, data directory buoy = 'OA1'; dep = '201401'; mydir = ['//atlas.shore.mbari.org/OA_Moorings/deployment_data/' ... buoy '/' dep '/raw/cntl/']; myfile = 'DATALOG'; fid = fopen([mydir myfile '.txt']); AANDERAA_O2 = []; AIRMAR_PB200=[]; EXT_ANALOG1 = []; EXT_ANALOG2 = []; EXT_ANALOG3 = []; MICROCAT = []; PCO2 = []; SPECIAL1 = []; SPECIAL2 = []; while ~feof(fid) fline = fgetl(fid); f=strfind(fline,','); %O2 if ~isempty(strfind(fline,'AANDERAA_O2')) s = str2num(fline(f(2)+1:end)); if length(s)==11 AANDERAA_O2 = [AANDERAA_O2; datenum(fline(1:f(1)-1)) s]; end end %MET if ~isempty(strfind(fline,'AIRMAR_PB200')) ti = datenum(fline(1:f(1)-1)); fline = fgetl(fid); if ~isempty(strfind(fline,'$WIMDA')) f = strfind(fline,','); ap = str2double(fline(f(3)+1:f(4)-1)); %air press (bar) at = str2double(fline(f(5)+1:f(6)-1)); %air temp (C) rh = str2double(fline(f(9)+1:f(10)-1)); %rel hum (%) dp = str2double(fline(f(11)+1:f(12)-1)); %dewpoint (C) wd = str2double(fline(f(13)+1:f(14)-1)); %wind dir (true) ws = str2double(fline(f(19)+1:f(20)-1)); %wind spd (m/s) AIRMAR_PB200 = [AIRMAR_PB200; ti ap at rh dp wd ws]; end end %can humidity V1, V2 if ~isempty(strfind(fline,'EXT_ANALOG1')) s = str2num(fline(f(2)+1:end)); if length(s)==2 EXT_ANALOG1 = [EXT_ANALOG1; datenum(fline(1:f(1)-1)) s]; end end %pH V1 if ~isempty(strfind(fline,'EXT_ANALOG2')) EXT_ANALOG2 = [EXT_ANALOG2; datenum(fline(1:f(1)-1)) ... str2double(fline(f(2)+1:end))]; end %fluor if ~isempty(strfind(fline,'EXT_ANALOG3')) EXT_ANALOG3 = [EXT_ANALOG3; datenum(fline(1:f(1)-1)) ... str2double(fline(f(2)+1:end))]; end %CTD if ~isempty(strfind(fline,'MICROCAT')) MICROCAT = [MICROCAT; datenum(fline(1:f(1)-1)) ... str2num(fline(f(2)+1:f(end-1)-1))]; end %charging system if ~isempty(strfind(fline,'SPECIAL1')) % end %VR2C tag ID OR status msg if ~isempty(strfind(fline,'SPECIAL2')) && length(f)==7 SPECIAL2 = [SPECIAL2; datenum(fline(1:f(1)-1)) ... str2double(fline(f(6)+1:f(7)-1))]; end %CO2 if ~isempty(strfind(fline,'PCO2')) PCO2 = [PCO2; datenum(fline(1:f(1)-1)) str2num(fline(f(2)+1:end))]; end clear fline f; end fclose(fid); clear fid ans s ti ap at rh dp wd ws; save([mydir myfile '.mat'], 'AANDERAA_O2', 'AIRMAR_PB200', 'EXT_ANALOG1', ... 'EXT_ANALOG2', 'EXT_ANALOG3', 'MICROCAT', 'PCO2', 'SPECIAL1', 'SPECIAL2');